Memory Layout

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
omin0us

Memory Layout

Post by omin0us »

I am curious how you all have laid out your memory (when using virtual memory/paging).

ie:
0-4mb: identity mapped
0xc0000000 - 0xc0001000: kernel
0xc00b8000 - 0xc00a0000: video memory
0xd0000000 - 0xe0000000: kernel heap
...
etc.

I would like to know where other people are mapping their kernel, kernel stack, kernel heap, etc.
Zeii[at-uni]

Re:Memory Layout

Post by Zeii[at-uni] »

My design is odd.
However, the one constant thing across all 'tasks' and such, is that memory is identity mapped 0-1MB. (Kernel). (but even that maybe changed!)
proxy

Re:Memory Layout

Post by proxy »

here is my memory map:

Code: Select all

0x0000000000000000 - 0x0000000000001000     : (unaccesible/null pointer detection)
0x0000000000001000 - 0x00000000c0000000     : (user space, to be divided up more)
   0x00000000bfffd000 - 0x00000000c0000000 : primary thread stack of current process
0x00000000c0000000 - 0x00000000d0000000     : Identity map of lower 256 megs of mem including kernel
   0x00000000c0000000 - 0x00000000c0000400 : Real Mode IVT (Interrupt Vector Table)
   0x00000000c00b8000 - 0x00000000c00bffff : Video RAM
   0x00000000c00c0000 - 0x00000000c00c7fff : Video Bios
   0x00000000c0100000 - ?                  : Kernel (code/data/bss)
0x00000000e0000000 - 0x00000000e4000000     : Kernel Heap (64 megs)
0x00000000e5000000 - 0x00000000ed000000     : Video Linear Frame Buffer
0x00000000f0000000 - 0x00000000f0100000     : Temp page mapping 
0x00000000ffc00000 - 0x00000000fffff000     : Page Tables as mapped by active page directory
0x00000000fffff000 - 0x0000000100000000     : Page Directory
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:Memory Layout

Post by Brendan »

Hi,

My memory map/s go like this:

0x00000000 Process space
0x?0000000 Thread space
0x?0000000 Kernel space
0xFFFFFFFF End of kernel space

Thread space is always aligned on a 1 GB boundary, where it starts (and it's size) depends on the process (the header in the executable file).

Kernel space starts at different addresses for different kernels - 3.5 GB for 32 bit plain paging, 3 GB for PAE, and for 64 bit kernels it depends on the number of linear addressing bits supported by the CPU.

Kernel space and the highest chunk of "user space" is split into "sub-areas" for a variety of reasons.


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.
Pyr0Mathic

Re:Memory Layout

Post by Pyr0Mathic »

this is mine, its very old build it like 4 years agoo before i knew how paging etc worked...

Kernell.
first gig is Paged directly to phisical mem. so: 0000.0000 - 3FFF.FFF
0000.0000 - 002F.FFFF ; kernell code, initial required Data-segs, all constant size etc...
0030.0000 - 003F.FFFF ; Tells me what phisical data is in use
0040.0000 - 007F.FFFF ; TSS or PageDir's..
0080.0000 - 3FFF.FFFF ; 4KB data

Paged memory:
4000.0000 - 7FFF.FFFF ; Kernell paged data seg.
8000.0000 - EFFF.FFFF ; Prog Paged Data seg.

that's about it, i know i trash the first 8 MB of the RAM.. only use half of it.

Regards.
PyroMathic
Post Reply