6.5 Memory Management

In this operating system, the responsibility of memory management is left up to the game. That is, the operating system provides no heap or dynamic memory allocation mechanism for the game. Since the game can access the entire memory map, it has complete control on how memory is partitioned and used. The operating system simply runs in the kernel mode (kseg0) with cache and direct mapping enabled. In this mode, the virtual address 0x80000000 is mapped directly to the physical address 0x0. Translation Lookaside Buffer (TLB) is not used by the operating system to provide virtual memory support. However, low-level routines are available for game developers to program the TLBs directly. Furthermore, a region library is provided to simplify the task of allocating and de-allocating fixed-size memory buffers.

Game developers should be aware of the importance of invalidating and flushing caches before transferring data between either cartridge ROM or RCP and main memory. The operating system provides useful functions to invalidate both instruction and data caches and to write back data cache.

UP