kzinti wrote:
Initializing PAE is not much more complicated than non-PAE. Here is what I do:
Code:
---snip---
You can see the whole implementation here:
https://github.com/kiznit/kiznix/blob/f ... ot_pae.asmHope this helps...
Easy for you to say, my pages are 4 KB not 2 MB.
Thanks anyways!
Btw, I found a solution to my problem, that doesn't work, yet.
What I did is basically inspected the paging structures in memory (C++ generated) and then I figured out where to put stuff at and what bytes are flags and what bytes are address bytes. That made my job a lot easier.
After all the pain I created 6 page tables filled them accordingly did all the math, interconnected everything and yet Bochs is not happy:
Code:
SetCR0(): PDPTR check failed !
Emulation stops at mov cr0, eax and I can't inspect my page tables (via Bochs GUI debugger) and no "physical address not available" errors were thrown. Any ideas?
Anyways here are chunks of my code:
Code:
//Do so for all 4, make sure that page directory pointer table has 4 page directories
mov eax, (first_page_directory - 0xC0000000)
shr eax, 12
mov dword [page_directory_pointer_table.first_page_directory_pointer_table_entry - 0xC0000000 + 1], eax
mov byte [page_directory_pointer_table.first_page_directory_pointer_table_entry - 0xC0000000], 1
//Inserting page table address and flags into page directory entry, do so for all six of them
mov eax, (first_page_table - 0xC0000000)
shr eax, 12
mov dword [first_page_directory.first_page_directory_entry - 0xC0000000 + 1], eax
mov dword [third_page_directory.first_page_directory_entry - 0xC0000000 + 1], eax
mov byte [first_page_directory.first_page_directory_entry - 0xC0000000], 3
mov byte [third_page_directory.first_page_directory_entry - 0xC0000000], 3
//The way I fill my page tables, only showing the first 3
mov ecx, 512
xor eax, eax
xor edx, edx
.Fill_First_Page_Table:
cmp ecx, 0
je .Done_Filling_First_Page_Table
shr eax, 12
mov dword [first_page_table - 0xC0000000 + 1 + edx], eax
shl eax, 12
mov byte [first_page_table - 0xC0000000 + edx], 3
add eax, 0x1000
dec ecx
add edx, 8
jmp .Fill_First_Page_Table
.Done_Filling_First_Page_Table:
mov ecx, 512
mov eax, 0x200000
xor edx, edx
.Fill_Second_Page_Table:
cmp ecx, 0
je .Done_Filling_Second_Page_Table
shr eax, 12
mov dword [second_page_table - 0xC0000000 + 1 + edx], eax
shl eax, 12
mov byte [second_page_table - 0xC0000000 + edx], 3
add eax, 0x1000
dec ecx
add edx, 8
jmp .Fill_Second_Page_Table
.Done_Filling_Second_Page_Table:
mov ecx, 512
mov eax, 0x400000
xor edx, edx
.Fill_Third_Page_Table:
cmp ecx, 0
je .Done_Filling_Third_Page_Table
shr eax, 12
mov dword [third_page_table - 0xC0000000 + 1 + edx], eax
shl eax, 12
mov byte [third_page_table - 0xC0000000 + edx], 3
add eax, 0x1000
dec ecx
add edx, 8
jmp .Fill_Third_Page_Table
.....etc
//Last chunk
mov eax, (page_directory_pointer_table - 0xC0000000)
mov cr3, eax
mov eax, cr4
or eax, 00000000000000000000000000100000b
mov cr4, eax
mov eax, cr0
or eax, 10000000000000000000000000000000b
mov cr0, eax
I know this thread is getting long, sorry for that.