mm.inc

StupidOS Memory Manager

Summary
mm.incStupidOS Memory Manager
Memory Layout
Macros
KV2PConvert virtual address to physical
KP2VConvert physical address to virtual
Functions
mm_kmap
mm_clone_pte
mm_clone_pgdir
mm_initInitialize the memory manager
mm_mmap
mm_munmap

Memory Layout

                Virtual
0xFFFFFFFF +---------------+
           |               |
           | Device Memory |
           |               |
           +---------------+
           |               |
           | Kernel Heap   |
           |               |
  KERN_END +---------------+
           |               |
           | Stupid Kernel |
           |               |
0xC0100000 +---------------+
           | I/O Space and |
           | phys memory   |
           | Lower than 1M | kernel mode only
0xC0000000 +---------------+
           |               | user mode
           |  userspace    |
           |               |
0x00000000 +---------------+

Macros

KV2P

Convert virtual address to physical

KP2V

Convert physical address to virtual

Functions

mm_kmap

mm_clone_pte

In

EAXsource page table

Out

EAXcloned page table

mm_clone_pgdir

In

EAXsource page dir

Out

EAXcloned page dir

mm_init

Initialize the memory manager

mm_mmap

In

XXXaddr
XXXlength
XXXprot
XXXflags

mm_munmap

In

XXXaddr
XXXlength
Close