Hello,

Damien Zammit via Bug reports for the GNU Hurd, le sam. 21 déc. 2024 23:55:17 
+0000, a ecrit:
> +     movl    %eax, %ebx
> +
> +     /* Make eax hold offset to my cpus gdt */
> +     movl    $((GDT_DESCR_M32 + GDT_TABLE_M32) * 4), %eax
> +     mul     %ebp
> +
> +     /* Patch only our own copy of gdt */
> +     movl    $apboot_percpu_low, %ecx
> +     addl    %eax, %ecx
> +     movw    %bx, (%ecx)
> +     shr     $16, %ebx
> +     addl    $2, %ecx
> +     movb    %bl, (%ecx)
> +     shr     $8, %bx
> +     addl    $3, %ecx
> +     movb    %bl, (%ecx)
> +
> +     /* Patch only our own copy of gdt descriptor */
> +     movl    $apboot_gdt_descr, %ecx
> +     addl    %eax, %ecx
> +     movl    %ecx, %edx
> +     addl    $2, %edx
> +     movl    (%edx), %ebx
> +     addl    %eax, %ebx
> +     movl    %ebx, (%edx)
> +
> +     /* Reload our copy of gdt */
> +     lgdtl   (%ecx)
> +     ljmpl   $KERNEL_CS, $2f

This is quite verbose. Could you check that the attached patch on top of
it still works?

Samuel
diff --git a/i386/i386/cpuboot.S b/i386/i386/cpuboot.S
index b9b6d632..6ba7aa42 100644
--- a/i386/i386/cpuboot.S
+++ b/i386/i386/cpuboot.S
@@ -44,6 +44,7 @@ apboot_gdt_top:
        .word 0
 apboot_gdt_descr:
        .word (GDT_TABLE_M32 * 4) - 1
+apboot_gdt_descr_addr:
        .long apboot_gdt - KERNELBASE
 .align 16
 apboot_gdt:
@@ -200,27 +201,17 @@ apboot_jmp_offset:
        mul     %ebp
 
        /* Patch only our own copy of gdt */
-       movl    $apboot_percpu_low, %ecx
-       addl    %eax, %ecx
-       movw    %bx, (%ecx)
+       movw    %bx, apboot_percpu_low(%eax)
        shr     $16, %ebx
-       addl    $2, %ecx
-       movb    %bl, (%ecx)
+       movb    %bl, apboot_percpu_med(%eax)
        shr     $8, %bx
-       addl    $3, %ecx
-       movb    %bl, (%ecx)
+       movb    %bl, apboot_percpu_high(%eax)
 
        /* Patch only our own copy of gdt descriptor */
-       movl    $apboot_gdt_descr, %ecx
-       addl    %eax, %ecx
-       movl    %ecx, %edx
-       addl    $2, %edx
-       movl    (%edx), %ebx
-       addl    %eax, %ebx
-       movl    %ebx, (%edx)
+       addl    %eax, apboot_gdt_descr_addr(%eax)
 
        /* Reload our copy of gdt */
-       lgdtl   (%ecx)
+       lgdtl   apboot_gdt_descr(%eax)
        ljmpl   $KERNEL_CS, $2f
 2:
 

Reply via email to