Octocontrabass wrote:
You can't call VBE in 64-bit mode, but you can use the linear framebuffer provided by VBE in 64-bit mode. In fact, the linear framebuffer works exactly the same in all CPU modes, and regardless of how you set it up (VBE, GOP, or native driver).
It sounds like you don't have an appropriate mapping in your page tables, causing a page fault, and you don't have working exception handlers, turning the page fault into a triple fault. You can add "-d int" (and maybe "-no-reboot") to your QEMU command line to see exactly what's causing the reboot.
So, It's a problem with my page table mapping? If so, then could that be related to the way I enter long mode? (Shown bellow, using osdev tutorial 'Setting Up Long Mode'). I've done some research but still don't understand page tables and that lot very well, so it would be great if someone could help.
Code:
bits 32
mov dword [lfb0], ebx
mov edi, 0x1000
mov cr3, edi
xor eax, eax
mov ecx, 4096
rep stosd
mov edi, cr3
mov dword [edi], 0x2003
add edi, 0x1000
mov dword [edi], 0x3003
add edi, 0x1000
mov dword [edi], 0x4003
add edi, 0x1000
mov dword ebx, 0x00000003
mov ecx, 512
.setEntry:
mov dword [edi], ebx
add ebx, 0x1000
add edi, 8
loop .setEntry
mov eax, cr4
or eax, 1 << 5
mov cr4, eax
mov ecx, 0xc0000080
rdmsr
or eax, 1 << 8
wrmsr
mov eax, cr0
or eax, 1 << 31
mov cr0, eax
lgdt [GDT.Pointer]
jmp GDT.Code:LongMode
[bits 64]
LongMode:
mov ebx, dword [lfb0]
mov edi, dword [ebx+22]
Thanks in advance (if advance exists).