The Memory Manager (MMC)
The MMC interfaces directly with the HAL to manage the computer's memory. The HAL provides a somewhat abstracted interface to the memory management hardware. The MMC provides a view of the HAL memory interface that is compatible with the way that UOS uses memory. There are many memory management schemes. Being platform-agnostic, UOS has to be able to handle any of them.
The purpose of the MMC is to manage memory by responding to requests to allocate RAM for a process.
MMC manages a master page table and a process page list. Since the executive does operations on behalf of the whole system, it operates as if it were its own process, separate from all other processes running on the system. A PID of 0 is used for executive-specific operations.
The Page_Table is a list of 32-bit integers, one per page (the HAL defines the size of a memory page). The low 16 bits of each value indicate the process ID that currently owns the page. The upper 16 bits are flags:
Mnuemonic |
Value (Hex) |
Meaning |
Page_Flag_Locked |
1000 |
Page is locked |
Page_Flag_No_RAM |
2000 |
Non-existent memory (unmapped in a paging scheme) |
Page_Flag_Read_Only |
4000 |
Physical read-only |
Page_Flag_Write_Only |
8000 |
Physical write-only |
Page_Flag_Allow_Read |
10000 |
Allow read access |
Page_Flag_Allow_Write |
20000 |
Allow write access |
Page_Flag_Allow_Execute |
40000 |
Allow execution |
The MMC supports allocation types, which indicates the type of memory. The memory types are defined by the HAL. Each process has a page list that is a list of allocations per allocation type. On a typical modern CPU architecture, the allocation types are: Stack, Data, and Instruction (S, D, and I), and a page list would look like this:
Each set of allocations has one or more segments associated with it. If hardware requires contiguous segments, there will only ever be a single segment for each allocation type. Each segment is a represented with the following structure:
type TSegment = class
public // API...
Physical : int64 ;
Length : int64 ;
Flags : integer ;
Typ : char ;
Index : integer ;
end ;
Name |
Type |
Description |
Physical |
int64 |
Starting physical address |
Length |
int64 |
Segment length, in bytes |
Flags |
integer |
Page flags |
Type |
char |
Allocation type |
Index |
integer |
Type index |