Actually that is what I am doingfrank wrote:I don't see where you setup the temporary GDT. I would use the already booted processor to build a GDT and GDT_LOC at fixed addresses in memory, then just do a lgdt fixed_address. The way the code is setup now, you would have complications if you started more than 1 processor at a time. Also it might be a good idea to 16 byte align structures in memory that the CPU has to access.
The GDT limit is at address 0x901C and the base at 0x901E
The GDT table is from 0x9004 to 0x901B
The code that I am using now is this:
Code: Select all
.globl AP_startup_start
.globl AP_startup_end
.globl AP_flush
.equ GDT_ADDRESS 0x901C
.text
.code16
AP_startup_start:
cli
xor %ax, %ax
mov %ax, %ds
mov %ax, %ss
mov 0x100, %sp
movb $0xFF,%al
movb %al,(0x1000)
/* Load temporary GDT */
lgdt GDT_ADDRESS
/* Switch to Protected Mode */
mov %cr0,%eax
inc %eax
mov %eax,%cr0
/* Jmp to AP_flush */
ljmp $0x8, $(0x7000 + AP_flush - AP_startup_start)
/* If we get here just halt */
loop:
hlt
jmp loop
.code32
AP_flush:
mov $0x10, %eax
mov %eax, %ds
mov %eax, %es
mov %eax, %fs
mov %eax, %gs
mov %eax, %ss
/*For debugging*/
movb $0x55,%al
movb %al,(0x1000)
AP_startup_end: