Upper or Lower 2GB

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
srg

Upper or Lower 2GB

Post by srg »

Hi

I've noticed that OSs like Windows 2000 and Linux put the os code and data into the top 2GB of the Virtual Address Space.

What is the advantages of doing this? I thought that it would be more logical to have the os code and data in the lower 2GB and the apps in the Upper 2GB of Virtual space.

Thanks
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Upper or Lower 2GB

Post by Pype.Clicker »

For windows, i think this is because it must run some old progs in virtual mode (thus locking 0..1Mb address ranges). Having user code @ low addresses also allow easy implementation of 0-based user segments which is known to allow faster user-2-kernel switches
srg

Re:Upper or Lower 2GB

Post by srg »

IC

Is this why Linux does it?

It seems that all the major os do this.

If I want to use v86 at any time will I have to do this then?

Thanks
Tim

Re:Upper or Lower 2GB

Post by Tim »

I don't see any reason for doing one or the other, except that V86-mode code always uses the bottom megabyte. That is, if you want to run V86-mode code, you will need to make the bottom megabyte accessible to user mode.

Also, Windows 95/98\Me must make at least the bottom 4MB accessible from user mode because DOS and the BIOS are still used.
srg

Re:Upper or Lower 2GB

Post by srg »

Also, If the OS is using the top part of memory, what about DMA, that only uses the bottom 16MB.
Tim

Re:Upper or Lower 2GB

Post by Tim »

ISA DMA uses the bottom 16MB of the physical address space; in other words, it can only access the RAM chips that are placed below the 16MB mark. The bottom 16MB of RAM can be put anywhere in the virtual address space by means of paging.
Post Reply