Today I stumbled upon an issue I cannot resolve at the moment.
It is located in the boot code for my AP, when I try to load some data in high addresses.
My code is the following:
Code: Select all
... /* Code before jumpt to 64 bits */
; Set CR3
mov eax, [OFFSET_ADDR(_ap_boot_pgdir)]
mov cr3, eax
; Enable PAE
mov eax, cr4
or eax, 0x20
mov cr4, eax
; Switch to compatibility mode
mov ecx, 0xC0000080
rdmsr
or eax, 0x00000100
wrmsr
; Enable paging
mov eax, cr0
or eax, 0x80010000
mov cr0, eax
; Far jump to 64 bit mode
jmp CODE64:OFFSET_ADDR(__ap_loader_lm)
[bits 64]
__ap_loader_lm:
cli
; Init data segments
mov ax, DATA64
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
; Get stack index
mov rax, init_cpu_count
mov rbx, [rax]
inc rbx
.... /* Rest of the code
Code: Select all
; Get stack index
mov rax, init_cpu_count
mov rbx, [rax]
I tried to set the IDT but I got a triple fault on the lidt instruction too.
The address in RAX is mapped before the instruction is executed, the AP is in ring 0.
Do you have any idea about what could happen?
Thanks!