[coyotos-dev] SMP: apboot.S misbehaves for cpu_ncpu > 2 [PATCH]

Jeroen Visser jeroen.c.visser at gmail.com
Sun Nov 4 13:34:08 EST 2007


The following patch (or similar) is needed for cpu_ncpu > 2.

-JCV


diff -r d1b5db861bdc src/sys/arch/i386/kernel/apboot.S
--- a/src/sys/arch/i386/kernel/apboot.S Sat Nov 03 09:48:19 2007 -0400
+++ b/src/sys/arch/i386/kernel/apboot.S Sun Nov 04 13:28:09 2007 -0500
@@ -81,7 +81,11 @@ GEXT(ap_boot)
        /* This code runs relocated but identity mapped. Relocate base of
         * temporary GDT using quasi PC-relative addressing:
         */
-       addl    %eax,ap_boot_gdt_base - ap_boot         /* seg
relative address */
+
+       /* Store seg relative address of gdt_start, then adjust to PA. */
+       movl    $(ap_boot_gdt_start - ap_boot), ap_boot_gdt_base - ap_boot
+       addl    %eax, ap_boot_gdt_base - ap_boot        /* seg
relative address */
+
        lidt    ap_boot_idt_descriptor - ap_boot        /* seg
relative address */
        lgdt    ap_boot_gdt_descriptor - ap_boot        /* seg
relative address */

@@ -130,7 +134,7 @@ ap_boot_gdt_descriptor:
 ap_boot_gdt_descriptor:
        .word   ap_boot_gdt_end - ap_boot_gdt_start
 ap_boot_gdt_base:
-       .long   ap_boot_gdt_start - ap_boot
+       .long   0x0

 ap_boot_idt_descriptor:
        .word   0x0


More information about the coyotos-dev mailing list