OSDev.org

The Place to Start for Operating System Developers
It is currently Sat Sep 19, 2020 12:42 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: The general workflow to enable memory management
PostPosted: Fri Feb 14, 2020 10:13 am 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 394
You basically have to map your page tables somewhere in your page tables so that you can access them from virtual addresses.

You want to map them in your kernel address range, so somewhere at or above 0xC0000000. You will want to do this before you remove the identity mapping of the first 4MB.

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: The general workflow to enable memory management
PostPosted: Fri Feb 14, 2020 11:27 am 
Offline
Member
Member

Joined: Sat Feb 08, 2020 11:11 am
Posts: 100
Or can I just keep the identity map? It seems simpler right?

Any disadvantage of keeping an identity map?


Top
 Profile  
 
 Post subject: Re: The general workflow to enable memory management
PostPosted: Fri Feb 14, 2020 1:04 pm 
Offline
Member
Member
User avatar

Joined: Fri Aug 07, 2015 6:13 am
Posts: 1090
sunnysideup wrote:
Or can I just keep the identity map? It seems simpler right?

Any disadvantage of keeping an identity map?


Yeah, because you're pretty basically ignoring the whole point of paging.
Also if your kernel is loaded at 1 MB then you won't be able to load your programs at lower addresses, such as zero.
Also don't just map 4 MB and call it a day.
You should map just enough, according to the size of your kernel. Or you will run into random errors once your code expands beyond 4 MB. Just something to keep in mind for the future.
For sure you can have certain sections identity mapped but the whole kernel, better not.
Didn't read the whole topic, just giving some general heads up.

_________________
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader


Top
 Profile  
 
 Post subject: Re: The general workflow to enable memory management
PostPosted: Fri Feb 14, 2020 1:17 pm 
Offline
Member
Member

Joined: Sat Feb 08, 2020 11:11 am
Posts: 100
Thanks for the heads up!

However, I'm not identity mapping the kernel exactly... I'm identity mapping 0 - 4M, and mapping the kernel at 0xC0000000.... There's some overlap, sure, Eg. 0x100000 and 0xC0000000 are the same thing...
I was wondering this identity mapping should be temporary or permanent

Edit: I was doing a bit of reading, and it looks like 0-4M identity map could be a bad idea in the long run as user mode programs usually 'want' to run at virtual address 0.
Also, I'm guessing that the permanent higher half kernel map (where the kernel is permanently mapped at 0xC0000000 (or 2Gb)) is really useful for system calls, where the ISR will have linear address in the kernel space. Is this right?


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

All times are UTC - 6 hours


Who is online

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