Difference between revisions of "GeneveOS Memory Management Functions"

From Ninerpedia
Jump to navigation Jump to search
Line 81: Line 81:
|-
|-
| R0
| R0
| Opcode (0003) || Error code
| Opcode (0003) || Error code (-, 2, 3)
|-
|-
| R1
| R1
Line 90: Line 90:
|-
|-
|}
|}
Error code 2 is returned when the local page number or the execution page number is 0.
Error code 3 is returned when the execution page number is higher than 7 or (TODO)


=== Get address map ===
=== Get address map ===

Revision as of 21:52, 11 November 2011

Memory management in MDOS is available via XOP 7. In the MDOS sources the relevant files are manage2s and manage2t.

General purpose XOPs

Return number of free pages in system

Opcode: 0

Input Output
R0 Opcode (0000) Error code (always 0)
R1 Number of free pages
R2 Number of fast free pages
R3 Total number of pages in system

Claim pages into local map from free pages

Opcode: 1

Input Output
R0 Opcode (0001) Error code (0, 1, 7, 8)
R1 Number of pages Number of pages actually fetched to complete map as required
R2 Local page address Number of fast pages fetched
R3 Speed flag (if not 0, only fast)

Return pages into free pool from local map

Opcode: 2

Input Output
R0 Opcode (0002) Error code (0, 2)
R1 Number of pages
R2 Local page address

Error code 2 is returned when the local page address (R2) is 0; page 0 cannot be freed in this way.

Map local page at excution page

Opcode: 3

Input Output
R0 Opcode (0003) Error code (-, 2, 3)
R1 Local page number
R2 Execution page number

Error code 2 is returned when the local page number or the execution page number is 0.

Error code 3 is returned when the execution page number is higher than 7 or (TODO)

Get address map

Opcode: 4

Input Output
R0 Opcode (0004) Error code
R1 Pointer to buffer Count of pages reported
R2 Size of area for map

Declare shared pages

Opcode: 5

Input Output
R0 Opcode (0005) Error code
R1 Number of pages to declare as shared
R2 Local page address
R3 Type to be assigned to shared pages

Release shared pages (type)

Opcode: 6

Input Output
R0 Opcode (0006) Error code
R1 Type

Also have to check their current execution map

Get shared pages

Opcode: 7

Input Output
R0 Opcode (0007) Error code
R1 Type
R2 Local page number for start of shared area

Return size of shared page group

Opcode: 8

Input Output
R0 Opcode (0008) Error code
R1 Type Number of pages in shared group

Privileged XOPs (only available for operating system)

Release task

Opcode: 9

Input Output
R0 Opcode (0009)

Task header at >8000

Page get

Opcode: 10

Input Output
R0 Opcode (000A) Error code
R1 Page number to get (if high byte not 0, get first available) Pointer to node
R2 Speed flag (if not 0, only fast) Page number from node

Add page to free pages in system

Opcode: 11

Input Output
R0 Opcode (000B) Error code (if no free nodes available)
R1 Page number Pointer to node

Add a node to the list of free nodes

Opcode: 12

Input Output
R0 Opcode (000C) Error code (always 0000)
R1 Pointer to node

Link a node to the specified node

Opcode: 13

Input Output
R0 Opcode (000D) Error code (always 0000)
R1 Pointer to node
R2 Pointer to node to link to

Get address map (system)

Opcode: 14

Input Output
R0 Opcode (000E) Count of valid pages

Error codes

Code Meaning
00 No error
01 not enough free pages
02 can't remap execution page zero
03 no page at LOCAL address
04 user area not large enough for list
05 shared type already defined
06 shared type doesn't exist
07 can't overlay shared and private memory
08 out of table space