<aname="l7"></a>In ZealOS, the lowest 2Gig of memory is called the </span><spanclass=cF2>code heap</span><spanclass=cF0>. ZealOS's compiler always uses 32-bit signed relative JMP & CALL
<aname="l12"></a>You can create new, independent heaps using </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Memory/HeapCtrl.ZC.html#l1"><spanclass=cF4>HeapCtrlInit</span></a><spanclass=cF0>(). Then, use the </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l3560"><spanclass=cF4>CHeapCtrl</span></a><spanclass=cF0> as the 2nd arg to </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Memory/MAllocFree.ZC.html#l391"><spanclass=cF4>MAlloc</span></a><spanclass=cF0>(). See </span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Utils/HeapLog.ZC.html#l83"><spanclass=cF4>HeapLog</span></a><spanclass=cF0>()
<aname="l15"></a>Memory alloced by a task will be freed when the task is killed. The </span><ahref="https://zeal-operating-system.github.io/ZealOS/Doc/Glossary.DD.html#l154"><spanclass=cF4>System Task</span></a><spanclass=cF0> is a task that never dies. Its memory is like
<aname="l16"></a>kernel memory in other operating systems. See </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Memory/MAllocFree.ZC.html#l408"><spanclass=cF4>SysCAlloc</span></a><spanclass=cF0>(), </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Memory/MAllocFree.ZC.html#l394"><spanclass=cF4>SysMAlloc</span></a><spanclass=cF0>(), </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Memory/MAllocFree.ZC.html#l427"><spanclass=cF4>SysMAllocIdent</span></a><spanclass=cF0>() and </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Memory/MAllocFree.ZC.html#l503"><spanclass=cF4>SysStrNew</span></a><spanclass=cF0>().
<aname="l19"></a>lowest 4Gig addresses have an alias to access hardware located toward the top of mapped space, </span><spanclass=cF2>0x01D7800000</span><spanclass=cF0>. See </span><spanclass=cF4>
<aname="l25"></a>See </span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Utils/MemRep.ZC.html#l219"><spanclass=cF4>MemRep</span></a><spanclass=cF0>() and </span><ahref="https://zeal-operating-system.github.io/ZealOS/Demo/MemDemo.ZC.html#l1"><spanclass=cF4>::/Demo/MemDemo.ZC</span></a><spanclass=cF0>.
<aname="l31"></a> Kernel module, placed here by the boot-loader, </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l4477"><spanclass=cF4>BOOT_RAM_BASE</span></a><spanclass=cF0>.
<aname="l34"></a> Boot block relocated here before loading the Kernel module, </span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootDVD.ZC.html#l1"><spanclass=cF4>BootDVD</span></a><spanclass=cF0>&</span><ahref="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootHD.ZC.html#l1"><spanclass=cF4>BootHD</span></a><spanclass=cF0>.
<aname="l38"></a></span><spanclass=cF2> 0x00000A0000- 0x00000BFFFF</span><spanclass=cF0> VGA graphics mem with alias at </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KGlobals.ZC.html#l30"><spanclass=cF4>text</span></a><spanclass=cF0>.vga_alias.
<aname="l39"></a></span><spanclass=cF2> 0x0000100000- 0x0000101FFF</span><spanclass=cF0></span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KernelA.HH.html#l4120"><spanclass=cF4>CSysFixedArea</span></a><spanclass=cF0> for misc.
<aname="l44"></a> 0xF0000000. PCI devices are supported, so </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Memory/MemPhysical.ZC.html#l64"><spanclass=cF4>Mem32DevAlloc</span></a><spanclass=cF0>() flaws could become an issue.
<aname="l54"></a> 64-bit devices are alloced with </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Memory/MemPhysical.ZC.html#l122"><spanclass=cF4>Mem64DevAlloc</span></a><spanclass=cF0>() counting backward.
<aname="l59"></a>contiguous requests. You can </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Memory/MAllocFree.ZC.html#l391"><spanclass=cF4>MAlloc</span></a><spanclass=cF0>() an 8Gig chunk on a 12Gig machine. You can </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Memory/MAllocFree.ZC.html#l391"><spanclass=cF4>MAlloc</span></a><spanclass=cF0>() a 32Gig chunk on a 64Gig machine.
<aname="l62"></a>the code heap is 1/4 of the total. See </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Memory/BlkPool.ZC.html#l31"><spanclass=cF4>BlkPoolsInit</span></a><spanclass=cF0>().
<aname="l81"></a>the lowest 2Meg area directly was cached but the alias he created up at the top of address space was uncached. See </span><spanclass=cF4>
<aname="l82"></a></span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Memory/MemPhysical.ZC.html#l157"><spanclass=cF4>UncachedAliasAlloc</span></a><spanclass=cF0>(). Unfortunately, he could no longer boast of the simplicity of identity mapping everything. Since many
<aname="l84"></a>easy-to-understand numbers of A0000-BFFFF, but must access the relocated alias location. See </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/KMain.ZC.html#l113"><spanclass=cF4>text.vga_alias</span></a><spanclass=cF0>. We also no
<aname="l87"></a>Then, Terry switched to 1Gig page sizes. For the lowest 4Gig, he set-up an alias up at the top of address space. See </span><spanclass=cF4>
<aname="l88"></a></span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/Memory/MemPhysical.ZC.html#l157"><spanclass=cF4>UncachedAliasAlloc</span></a><spanclass=cF0>(). Not all computers support 1Gig page tables, however, so he also supported 2Meg.
<aname="l92"></a>all of the first 4Gig can be accessed without caching at the </span><ahref="https://zeal-operating-system.github.io/ZealOS/Kernel/MultiProc.ZC.html#l152"><spanclass=cF4>dev.uncached_alias</span></a><spanclass=cF0>.