[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/6 gnumach] i386/cpuboot: Simplify for legibility
From: |
Damien Zammit |
Subject: |
[PATCH 1/6 gnumach] i386/cpuboot: Simplify for legibility |
Date: |
Mon, 09 Dec 2024 12:17:23 +0000 |
The current segmentation already adds -KERNELBASE.
But only when accessing the memory.
Don't forget to reload gdt.
---
i386/i386/cpuboot.S | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/i386/i386/cpuboot.S b/i386/i386/cpuboot.S
index 7e6c4770..9ac86845 100644
--- a/i386/i386/cpuboot.S
+++ b/i386/i386/cpuboot.S
@@ -169,12 +169,13 @@ apboot_jmp_offset:
movl %ecx,%eax
movl $PC_SIZE,%ebx
mul %ebx
- addl $percpu_array - KERNELBASE, %eax
+ addl $percpu_array, %eax
/* Record our cpu number */
- movl %ecx, (PERCPU_CPU_ID + KERNELBASE)(%eax)
+ movl %ecx, (PERCPU_CPU_ID)(%eax)
/* Set up temporary percpu descriptor */
+ addl $(-KERNELBASE), %eax
movw %ax, apboot_percpu_low
shr $16, %eax
movb %al, apboot_percpu_med
@@ -184,6 +185,11 @@ apboot_jmp_offset:
movw $PERCPU_DS, %ax
movw %ax, %gs
+ /* Reload the gdt because we changed it */
+ lgdtl apboot_gdt_descr
+ ljmpl $KERNEL_CS, $2f
+2:
+
/* Load null Interrupt descriptor table */
mov apboot_idt_ptr, %ebx
lidt (%ebx)
--
2.45.2
- [PATCH 0/6 gnumach] Preparation for parallel SMP init, Damien Zammit, 2024/12/09
- [PATCH 1/6 gnumach] i386/cpuboot: Simplify for legibility,
Damien Zammit <=
- [PATCH 2/6 gnumach] i386/cpuboot: Dont use CPU_NUMBER_NO_STACK() early, Damien Zammit, 2024/12/09
- [PATCH 3/6 gnumach] i386/cpuboot: Write gs selector correctly, Damien Zammit, 2024/12/09
- [PATCH 4/6 gnumach] pmap: Separate temporary_mapping from set_page_dir, Damien Zammit, 2024/12/09
- [PATCH 5/6 gnumach] smp: Use logical destination not physical apic id, Damien Zammit, 2024/12/09
- [PATCH 6/6 gnumach] i386/apic: Fix condition on non-BSP, Damien Zammit, 2024/12/09