OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Mar 29, 2024 8:16 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Virtual memory management
PostPosted: Fri Sep 22, 2017 11:00 am 
Offline
Member
Member
User avatar

Joined: Sat May 20, 2017 1:25 am
Posts: 51
Location: PCI bus: 3, slot: 9, function: 5
I will load my kernel at physical address 0xC0000000, I will map the virtual kernel address to the same value (0xC0000000) and I will start some programs. All my interrupt handlers will work virtual addresses right? Do I will have any problem (something extra to do) using multiprocessor? I am thinking memory like this (ex):

Code:
Physical memory                                                 Programs 1 Virtual memory                                       Programs 2 Virtual memory
0x00000000-0x00000FFF program1                                  0x00000000-0x00000FFF program1                                  0x00000000-0x00005FFF program2.1
0x00001000-0x00001FFF file1                                     0x00001000-0x00001FFF file1                                     0x00006000-0x00007FFF program2.2
0x00002000-0x00003FFF physical memory bitmap                    0x00002000-0x00002FFF file4                                     0x00008000-0x00008FFF file 2
0x00004000-0x00009FFF program2.1                                0x00003000-0xBFFFFFFF undefined                                 0x00009000-0x00009FFF file 3
0x0000A000-0x0000AFFF file2                                     0xC0000000-0xC000FFFF kernel                                    0x0000A000-0xBFFFFFFF undefined
0x0000B000-0x0000CFFF program2.2                                0xC0010000-0x0003FFFF kernel data                               0xC0000000-0xC000FFFF kernel
0x0000D000-0x0000DFFF file3                                     0xC0040000-0xC0041FFF physical memory bitmap                    0xC0010000-0x0003FFFF kernel data
0x0000E000-0x0000EFFF free                                      0xC0042000-0x00049FFF VGA                                       0xC0040000-0xC0041FFF physical ...
0x0000F000-0x0000FFFF file4                                     0xC004A000-0xFFFFFFFF undefined                                 0xC0042000-0x00049FFF VGA
0x00010000-0x0004FFFF free                                                                                                      0xC0042000-0xFFFFFFFF undefined
0x00050000-0x0007FFFF kernel data
0x00080000-0x000B7FFF free
0x000B8000-0x000BFFFF VGA
0x000C0000-0xBFFFFFFF free
0xC0000000-0xC000FFFF kernel
0xC0010000-0xFFFFFFFF free


Is it correct (of course the kernel virtual pages will be set as not user access pages)?

_________________
How people react when a new update of your OS is coming:
Linux user: Cool, more free stuff!
Mac user: Ooh I have to pay!
Windows user: Ah not again!


Top
 Profile  
 
 Post subject: Re: Virtual memory management
PostPosted: Fri Sep 22, 2017 8:23 pm 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

ARISTOS wrote:
I will load my kernel at physical address 0xC0000000,


No, you won't - it's very unlikely that there's RAM at physical address 0xC0000000 (even on computers with 4 GiB or more RAM) because this area is typically used for memory mapped PCI devices.

ARISTOS wrote:
I will map the virtual kernel address to the same value (0xC0000000) and I will start some programs. All my interrupt handlers will work virtual addresses right?


Almost everything in the entire OS uses virtual addresses, which means that physical addresses are almost always relatively irrelevant - they only matter very early during boot and for some device drivers (for devices that use DMA and bus mastering).

For an example of how much physical addresses don't matter; my boot loaders set up a temporary physical memory manager and then use it to allocate "deliberately randomised for security purposes" physical pages for everything else. I literally can't know/predict which physical addresses my own boot loader will load my kernel into.

ARISTOS wrote:
Do I will have any problem (something extra to do) using multiprocessor?


For memory management, multiprocessor often doesn't involve anything extra (beyond locks/spinlocks/mutexes to make sure 2 or more CPUs don't confuse each other when using the same data at the same time).


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


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: KN9296 and 196 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