In UEFI,how to prevent me from overwriting the page table?

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
wishedtobe
Member
Member
Posts: 25
Joined: Sat May 04, 2024 7:48 am
Libera.chat IRC: wishedtobe

In UEFI,how to prevent me from overwriting the page table?

Post by wishedtobe »

I was trying to find out where the page table and gdt is in UEFI.Then I found that gdt is located in RT_data,while page table is located in BS_data.It is easy to prevent my OS from overwriting gdt,but how can I deal with the page table?It is said that BS_data would be reclaimed after exiting boot services,and can I reclaim the RT_data?
Octocontrabass
Member
Member
Posts: 5560
Joined: Mon Mar 25, 2013 7:01 pm

Re: In UEFI,how to prevent me from overwriting the page table?

Post by Octocontrabass »

wishedtobe wrote: Fri Jul 05, 2024 8:00 pmIt is easy to prevent my OS from overwriting gdt,but how can I deal with the page table?
You need to create your own GDT and page tables. You can't reuse the ones set up by UEFI.
wishedtobe wrote: Fri Jul 05, 2024 8:00 pmIt is said that BS_data would be reclaimed after exiting boot services,and can I reclaim the RT_data?
No, you can't reclaim memory containing runtime data.
wishedtobe
Member
Member
Posts: 25
Joined: Sat May 04, 2024 7:48 am
Libera.chat IRC: wishedtobe

Re: In UEFI,how to prevent me from overwriting the page table?

Post by wishedtobe »

Octocontrabass wrote: Fri Jul 05, 2024 8:07 pm
wishedtobe wrote: Fri Jul 05, 2024 8:00 pmIt is easy to prevent my OS from overwriting gdt,but how can I deal with the page table?
You need to create your own GDT and page tables. You can't reuse the ones set up by UEFI.
wishedtobe wrote: Fri Jul 05, 2024 8:00 pmIt is said that BS_data would be reclaimed after exiting boot services,and can I reclaim the RT_data?
No, you can't reclaim memory containing runtime data.
Due to the dirty memory space, I can hardly use any part of the memory (overwriting the page table may cause serious problems), making me unable to create my own page tables.
Octocontrabass
Member
Member
Posts: 5560
Joined: Mon Mar 25, 2013 7:01 pm

Re: In UEFI,how to prevent me from overwriting the page table?

Post by Octocontrabass »

Why not create your page tables before you reclaim the boot services data?
wishedtobe
Member
Member
Posts: 25
Joined: Sat May 04, 2024 7:48 am
Libera.chat IRC: wishedtobe

Re: In UEFI,how to prevent me from overwriting the page table?

Post by wishedtobe »

Octocontrabass wrote: Fri Jul 05, 2024 8:28 pm Why not create your page tables before you reclaim the boot services data?
Maybe you are right.Then what will it be if I overwrite the runtime services?
Octocontrabass
Member
Member
Posts: 5560
Joined: Mon Mar 25, 2013 7:01 pm

Re: In UEFI,how to prevent me from overwriting the page table?

Post by Octocontrabass »

Probably something bad will happen, but you shouldn't do it because the UEFI spec says you're not allowed to do it.
Post Reply