bug-hurd
[Top][All Lists]
Advanced

[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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]