OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Apr 20, 2024 9:54 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: understanding paging
PostPosted: Tue May 25, 2021 5:18 pm 
Offline

Joined: Sat May 01, 2021 8:47 pm
Posts: 15
How do you setup paging, so you can page anywhere.. I'm wondering if you can page and "un-page" memory?

I'm wondering about any POC of properly setting up paging on x64 so I can understand properly

If I turn on paging, would the CPU only recognize addresses that map to a page? Like no physical addresses? As in paging the entire RAM or just certain parts?

I'm struggling to understand paging


Top
 Profile  
 
 Post subject: Re: understanding paging
PostPosted: Tue May 25, 2021 5:37 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5137
newosdeveloper2021 wrote:
I'm wondering if you can page and "un-page" memory?

Yes, you are free to add and remove mappings at any time. On x86, you need to make sure you flush the TLB appropriately.

newosdeveloper2021 wrote:
If I turn on paging, would the CPU only recognize addresses that map to a page? Like no physical addresses?

It depends on the CPU. On x86, turning on paging means only the page tables use physical addresses, and everything else uses virtual addresses. In order to read or write data at a virtual address, your page tables have to specify which physical address to use for that virtual address. You don't have to specify a physical address for every virtual address.

newosdeveloper2021 wrote:
As in paging the entire RAM or just certain parts?

It's up to you. Some 64-bit operating systems map all of RAM somewhere only the kernel can access. Others only map memory that they're using, and leave unused memory unmapped.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 46 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