How do I access pages

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
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

How do I access pages

Post by nexos »

Hello,
I am currently improving my paging code. I was curious as to how I should access the tables themselves, since the cpu can only use physical address for these tables. I have been accessing them via physical addresses, as the first 4MB are identity mapped. Thank you for your help.
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
kzinti
Member
Member
Posts: 898
Joined: Mon Feb 02, 2015 7:11 pm

Re: How do I access pages

Post by kzinti »

Map the pages you want to access in your page table. Then you can access them using virtual addresses.
thumble
Member
Member
Posts: 29
Joined: Thu May 25, 2017 10:41 pm

Re: How do I access pages

Post by thumble »

You might want to look into recursive paging.
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: How do I access pages

Post by iansjack »

This article: https://os.phil-opp.com/paging-implementation/ discusses the problem, and various solutions. I favour the "Map the Complete Physical Memory" approach.
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: How do I access pages

Post by nexos »

Thank you for your help. I have decided to use recursive paging and it works quite well for me.
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
Post Reply