OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Apr 27, 2024 2:35 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject: Re: How can I impliment Paging
PostPosted: Sun Mar 03, 2024 3:23 pm 
Offline
Member
Member

Joined: Tue Apr 03, 2018 2:44 am
Posts: 402
iProgramInCpp wrote:
thewrongchristian wrote:
Loading in uninitialised memory into the paging structure is very dangerous


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.

Of course the other levels need to be zeroed out before being inserted. I was saying that the whole time!


OK, understood, it's a difference in terminology.

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.)


Top
 Profile  
 
 Post subject: Re: How can I impliment Paging
PostPosted: Sun Mar 03, 2024 8:53 pm 
Offline
Member
Member

Joined: Tue Oct 10, 2023 7:40 pm
Posts: 51
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!


Top
 Profile  
 
 Post subject: Re: How can I impliment Paging
PostPosted: Sun Mar 03, 2024 10:13 pm 
Offline
Member
Member

Joined: Sun Apr 21, 2019 7:39 am
Posts: 76
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

What junk PTE? There is no junk PTE. The last level means the actual page itself.

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.

_________________
Hey! I'm developing two operating systems:

NanoShell --- A 32-bit operating system whose GUI takes inspiration from Windows 9x and early UNIX desktop managers.
Boron --- A portable SMP operating system taking inspiration from the design of the Windows NT kernel.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 33 posts ]  Go to page Previous  1, 2, 3

All times are UTC - 6 hours


Who is online

Users browsing this forum: DotBot [Bot], Google [Bot] and 29 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group