Page 1 of 1
In UEFI,how to prevent me from overwriting the page table?
Posted: Fri Jul 05, 2024 8:00 pm
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?
Re: In UEFI,how to prevent me from overwriting the page table?
Posted: Fri Jul 05, 2024 8:07 pm
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.
Re: In UEFI,how to prevent me from overwriting the page table?
Posted: Fri Jul 05, 2024 8:20 pm
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.
Re: In UEFI,how to prevent me from overwriting the page table?
Posted: Fri Jul 05, 2024 8:28 pm
by Octocontrabass
Why not create your page tables before you reclaim the boot services data?
Re: In UEFI,how to prevent me from overwriting the page table?
Posted: Fri Jul 05, 2024 8:32 pm
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?
Re: In UEFI,how to prevent me from overwriting the page table?
Posted: Fri Jul 05, 2024 9:08 pm
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.