33 lines
2.1 KiB
Plaintext
33 lines
2.1 KiB
Plaintext
$WW,1$I didn't want to use virtual memory mode, but had to for 64-bit mode to work. For all intents and purposes, it's as though virtual memory (paging) is not used except you can mark pages as uncached or write-through for multicore programming. LoseThos maps pages identically to physical memory. All cores use the same page table entries. Page table entries have a resolution of 2 Meg. Currently, 128 Gig total is mapped, though it does not swap or even check if it exists.
|
|
|
|
LoseThos uses 32-bit signed relative branch instructions in code. That means if one part of your code calls a function, the function must be located within 2Gig distance. Therefore, all code must reside within the lowest 2Gig memory addresses. The default heap, I call the "code heap" and the $LK,"MAlloc","MN:MAlloc"$() function allocates from within this range.
|
|
|
|
You can create new heap by first allocating memory with $LK,"AllocUncachedMemBlks","MN:AllocUncachedMemBlks"$() or $LK,"AllocNonTskMemBlks","MN:AllocNonTskMemBlks"$(), then calling $LK,"InitHeapCtrl","MN:InitHeapCtrl"$() and using $LK,"MAllocHC","MN:MAllocHC"$() and $LK,"FreeHC","MN:FreeHC"$(). If you want to access memory above 0x7FFFFFFF with a heap, pass a pointer and size to $LK,"InitHeapCtrl","MN:InitHeapCtrl"$(). There is an uncached 2 Meg heap useful for multicore with heap control $LK,"mp_heap","MN:mp_heap"$.
|
|
|
|
See $LK,"Mem Usage","FI:::/LT/Doc/MemInfo.TXZ"$
|
|
|
|
$FG,5$$TX+CX,"Memory Map"$
|
|
|
|
$FG,2$0x40000-~0x70000$FG$
|
|
$ID,2$OSMain kernel module, placed here by the boot-loader.
|
|
$ID,-2$
|
|
$FG,2$~0x9C000-0x9FFFF
|
|
$ID,2$$FG$Boot block relocated here. It loads the OSMain module.
|
|
$ID,-2$
|
|
$FG,2$0xA0000-0xBFFFF$FG$
|
|
$ID,2$VGA graphics memory, marked as write-through cache.
|
|
$ID,-2$
|
|
$FG,2$0x100000-~0x183000$FG$
|
|
$ID,2$Page tables
|
|
$ID,-2$
|
|
$FG,2$~0x183000-0x7FFFFFFF$FG$
|
|
$ID,2$Code Heap memory.
|
|
$ID,-2$
|
|
$FG,2$0xF0000000-0xFFFFFFFF$FG$
|
|
$ID,2$Various hardware devices have addresses here.
|
|
$ID,-2$
|
|
$FG,2$0x80000000-~0xEFFFFFFF$FG$
|
|
$FG,2$0x100000000-~0x1FFFFFFFFF$FG$
|
|
$ID,2$Unmanaged memory (pass a number to $LK,"InitHeapCtrl","MN:InitHeapCtrl"$ to manage it or do what you like.)
|
|
$ID,-2$
|
|
$FG,2$ |