-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
When I go to long mode like the first edition and try to write something to framebuffer, the qemu just reboot again and again with a page fault.
By searching, it happended for page map error.
The start address of buffer is 0xfd000000.
So, I just do identify map for 0~5G (maybe?) like this , it works well, but I don't think it is a good method.
...
set_up_page_tables:
; map first P4 entry to P3 table
mov eax, p3_table
or eax, 0b11 ; present + writable
mov [p4_table], eax
; map first five P3 entries to P2 table
mov eax, p2_table + 0x1000 * 0
or eax, 0b11
mov [p3_table], eax
mov eax, p2_table + 0x1000 * 1
or eax, 0b11
mov [p3_table+8], eax
mov eax, p2_table + 0x1000 * 2
or eax, 0b11
mov [p3_table+16], eax
mov eax, p2_table + 0x1000 * 3
or eax, 0b11
mov [p3_table+24], eax
mov eax, p2_table + 0x1000 * 4
or eax, 0b11
mov [p3_table+32], eax
; map each P2 entry to a huge 2MiB page
mov ecx, 0 ; counter variable
...Please tell me a better solution
Metadata
Metadata
Assignees
Labels
No labels