Is there a way to check if the PML4 is valid?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
22OsC
Member
Member
Posts: 35
Joined: Tue Jul 13, 2021 5:15 am
Libera.chat IRC: 22OsC
Location: Metaverse

Is there a way to check if the PML4 is valid?

Post by 22OsC »

Just out of curiosity, you can check if a Page Map Level 4 is valid and will not cause a triple fault if we write it to cr3? I know that I can check if it's NULL but it's not helping in some cases.
The code does get a bit quirky at night.
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Is there a way to check if the PML4 is valid?

Post by iansjack »

Just make sure it points to a valid page table.
User avatar
22OsC
Member
Member
Posts: 35
Joined: Tue Jul 13, 2021 5:15 am
Libera.chat IRC: 22OsC
Location: Metaverse

Re: Is there a way to check if the PML4 is valid?

Post by 22OsC »

iansjack wrote:Just make sure it points to a valid page table.
How can I do that?
The code does get a bit quirky at night.
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Is there a way to check if the PML4 is valid?

Post by iansjack »

You know the structure of a page table. So just read it and check the validity of each entry.

If you are using qemu then the monitor can do this for you with the "info mem" command.
User avatar
22OsC
Member
Member
Posts: 35
Joined: Tue Jul 13, 2021 5:15 am
Libera.chat IRC: 22OsC
Location: Metaverse

Re: Is there a way to check if the PML4 is valid?

Post by 22OsC »

iansjack wrote:You know the structure of a page table. So just read it and check the validity of each entry.

If you are using qemu then the monitor can do this for you with the "info mem" command.
Oh, okay, I'll check that out.
The code does get a bit quirky at night.
Post Reply