How can I impliment Paging
Re: How can I impliment Paging
Even in that case there still is a race condition as what if the CPU speculatively reads from the junk PTE? Then you just read junk data into the pipeline
-
- Member
- Posts: 426
- Joined: Tue Apr 03, 2018 2:44 am
Re: How can I impliment Paging
OK, understood, it's a difference in terminology.iProgramInCpp wrote:I said specifically the last level. The memory associated with the last level (whose entry belongs in a PT on x86 32-bit) isn't associated with the paging structure, rather being actual usable memory. It doesn't matter if the TLB reads the entry associated with that page before it's mapped. In fact you don't strictly have to zero that page out at all! Sure, you will be able to read what was in that page, but you're the kernel, and when dishing out pages to user space you of course would zero them out anyway.thewrongchristian wrote:Loading in uninitialised memory into the paging structure is very dangerous
Of course the other levels need to be zeroed out before being inserted. I was saying that the whole time!
When you say the last level, I took that as meaning the last level of the paging structure (i.e. the page table,) whereas you were talking about what the paging structure points to (the destination page of the PTE mapping.)
Re: How can I impliment Paging
Hmmm, didn't see this thread grew...
Well thanks for all the input. I think I know how I will implement it, just havent really had time yet, got some drivers done... I am going a bit off the beaten path for my memory managment. Kernel is located at 0xFA0000000000, and quite a few other odd mapings I have chosen
But thanks for all the replies, I belive I now understand paging!
Well thanks for all the input. I think I know how I will implement it, just havent really had time yet, got some drivers done... I am going a bit off the beaten path for my memory managment. Kernel is located at 0xFA0000000000, and quite a few other odd mapings I have chosen
But thanks for all the replies, I belive I now understand paging!
-
- Member
- Posts: 81
- Joined: Sun Apr 21, 2019 7:39 am
Re: How can I impliment Paging
What junk PTE? There is no junk PTE. The last level means the actual page itself.nexos wrote:Even in that case there still is a race condition as what if the CPU speculatively reads from the junk PTE? Then you just read junk data into the pipeline
On 64-bit the page table layout is as follows, top to bottom:
* PML4 (pointed to by CR3)
* PML3 (pointed to by entries in the PML4)
* PML2
* PML1
* The pages themselves (pointed to by entries in the PML1, this is the last level I was talking about)
When mapping actual pages, you don't need to zero them out because they aren't part of the page table tree that's processed using the TLB.