Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question for page #1381

Open
xuanplus opened this issue Jan 27, 2025 · 0 comments
Open

Question for page #1381

xuanplus opened this issue Jan 27, 2025 · 0 comments

Comments

@xuanplus
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant