AcornSearch - Acorn and RISC OS information searching
RISC OS Search
containing
"Nutty quip goes here!"
Home  |  About  |  Filebase Archive  |  StrongHelp Manuals  |  Newsgroups  |  Module Database
=>     R0 =     reason code (bits 0-7)
           and flags (bits 8-31) which are reason code specific

Peforms miscellaneous operations for memory management.
OS_Memory reason codes
R0     Action

0     General page block operations
1-5     Reserved for system use
6     Read the size of the physical memory arrangement table
7     Read the physical memory arrangement table
8     Read the amount of a specified sort of memory available
9     Read controller presence and base address
10-12     Reserved for system use
13     Map in IO permanent
14     Map in IO temporary
15     Map out temporary IO
16     Memory areas
17     Memory access privileges
18     Find access privilege
19     Prepare for DMA
20     Compatibility settings
21     Map in IO permanent from 64 bit space
22     Map in IO temporary from 64 bit space
24     Check memory access
64     General page block operations for 64 bit space
65     Logical to physical
OS_Memory 0
=>     R0 =     0 (reason code)
           and flags
     R1 =     pointer to page block
     R2 =     number of entries in page block

This call converts between the different memory spaces used to specify addresses in a page block, and can alter their cacheability. The addresses must be in RAM, but need not be page aligned. If a page is made uncacheable, the cache will be flushed. If there is an error processing any page in the block, the call has no effect on any pages.
OS_Memory page blocks
Offset     Contents

0     Physical page number
4     Logical address
8     Physical address
OS_Memory 0 flags
Bits     Meaning when set

0-7     0 (reason code)
8     physical page number provided
9     logical address provided
10     physical address provided
11     return physical page number (if bit 8 clear)
12     return logical address (if bit 9 clear)
13     return physical address (if bit 10 clear)
14-15     cacheability control:
     0,1 =>     no change
     2 =>     disable cacheing on all specified pages
     3 =>     enable cacheing on all specified pages
16-31     reserved, must be clear
OS_Memory 6
=>     R0 =     6 (reason code)
           all flags bits reserved
<=     R1 =     table size (in bytes)
     R2 =     page size (in bytes)

This call reads the size of the physical memory arrangement table, as returned by OS_Memory 7
OS_Memory 7
=>     R0 =     7 (reason code)
           all flags bits reserved
     R1 =     pointer to table to be filled in

This call reads the physical memory arrangement table, to get the size of this table, use OS_Memory 6
OS_Memory 8
=>     R0 =     8 (reason code)
           and flags
<=     R1 =     number of pages of specified type of memory
     R2 =     page size (in bytes)

This call reads the amount of a specified type of memory available in the computer.
OS_Memory 8 flags
Bits     Meaning

0-7     8 (reason code)
8-11     type of memory:
     1 =>     DRAM
     2 =>     VRAM
     3 =>     ROM
     4 =>     I/O (including all I/O, VIDC and EASI space)
     5 =>     Soft ROM (5.00+)
12-31     reserved, must be clear.
OS_Memory 9
=>     R0 =     9 (reason code)
           all flags bits reserved
     R1 =     controller ID
<=     R1 =     controller base address, or 0 if not present

This call checks for the presence of a given controller and returns its base address if present.
OS_Memory 9 controller ID
Bit     Meaning

0-7     controller sequence number
8-31     controller type:
           0 => EASI card ECTCR (for internal use only)
           1 => EASI space (for internal use only)
           2 => VIDC1
           3 => VIDC20
           4 => SSpace (5.00+)
           5 => Extension ROMs (5.00+)
           6 => Tube ULA (5.17+)
           34=> 82C710 compatible SuperIO chip (5.19+)
OS_Memory 13 map in IO permanently (5.00+)
=>     R0 =     13 (reason code)
           and flags
     R1 =     physical address to map in
     R2 =     size to map in
<=     R3 =     logical address assigned

Permanently maps in a region of IO memory at run time.
OS_Memory 14 map in IO temporarily (5.00+)
=>     R0 =     14 (reason code)
           bit 8 = 1 to map bufferable space, 0 for unbufferable
           bits 9..31 = reserved, must be zero
     R1 =     physical address to map in
<=     R2 =     logical address assigned
     R3 =     reference key (required when releasing)

Temporarily maps in 1MByte of IO memory at run time.
If multiple 1MByte chunks are required keep calling this until done, when ready to release it is only necessary to release the first reference key - the kernel will then free the rest for you.
OS_Memory 15 release IO region (5.00+)
=>     R0 =     15 (reason code)
           all flags bits reserved
     R1 =     reference key (assigned when claimed)

Frees up a region of IO memory previously mapped in at run time.
OS_Memory 16 get system area info (5.00+)
=>     R0 =     16 (reason code)
           bits 8-15 =
             1 =     cursor/system/sound
              2 =     IRQ stack
              3 =     SVC stack
              4 =     ABT stack
              5 =     UND stack
              6 =     Soft CAM
              7 =     Level 1 page tables
              8 =     Level 2 page tables
              9 =     HAL workspace
              10 =     Kernel buffers
              11 =     HAL uncacheable workspace
           bits 16-31 reserved, must be 0
<=     R1 =     base of area
     R2 =     address space allocated for area
     R3 =     actual memory used by area

Returns details on the selected area, rounded to a whole number of pages, or zero if not present.
Flags
Bit(s)     Meaning

8     1 to map bufferable space (0 is normal, non-bufferable)
9     1 to map cacheable space (0 is normal, non-cacheable)
16     1 to doubly map
17     1 if access privileges specified
24-27     access privileges (if bit 17 set)
others reserved, must be zero
OS_Memory 21 map in IO permanently (5.27+)
=>     R0 =     21 (reason code)
           and flags
     R1 =     low word of physical address to map in
     R2 =     high word of physical address to map in
     R3 =     size to map in
<=     R3 =     logical address assigned

Permanently maps in a region of IO memory at run time on memory controllers that allow IO above 32 bits.
OS_Memory 22 map in IO temporarily (5.27+)
=>     R0 =     22 (reason code)
           bit 8 = 1 to map bufferable space, 0 for unbufferable
           bits 9..31 = reserved, must be zero
     R1 =     low word of physical address to map in
     R2 =     high word of physical address to map in
<=     R2 =     logical address assigned
     R3 =     reference key (required when releasing)

Temporarily maps in 1MByte of IO memory at run time on memory controllers that allow IO above 32 bits.
If multiple 1MByte chunks are required keep calling this until done, when ready to release it is only necessary to release the first reference key - the kernel will then free the rest for you.

[sh-index] Back to list of manuals