This is an old version from the tos.hyp. The new is on GitHub!

HomeAppendixDeclaration of sourcesTOS list

16.6 The PMMU functions-handler

The Paged Memory Management Unit functions-handler can be reached via the PMMU-Cookie, and is created by programs such as Outside or VRAM that can swap blocks of memory to and from a hard drive when insufficient RAM is available for a given task. These memory blocks will then lie in so-called 'virtual RAM' divided into 'pages' on the drive.

The handler can only be called in supervisor-mode, and works via a function number that is stored in data register d0. Possible return values will be found in this register as well. Other processor registers are not altered.

The following functions are available at present:

Important note: These functions only have meaning for a few programs in the region of system software, an have no place in user programs.

See also: Super   Supexec

16.6.1 ClearPageMode

Name: »ClearPageMode« - Clear PMMU mode for a memory block.
Number: 2
Declaration: ULONG ClearPageMode ( ULONG mode, ULONG start_address, ULONG length );
Description: The call ClearPagemode clears the PMMU mode for a given block of memory. The following apply:

Parameter Meaning
mode Bit-vector as in SetPageMode
start_address Start address of memory segment
length Length of desired segment


Note: All other bits are reserved for future purposes. A program may only clear those bits that it has set itself previously.
Return value: The function returns zero on error-free execution. Otherwise a value is returned in which the bits that could not be manipulated are set.
Group: PMMU functions-handler
See also: GetHdv_inuse   GetPageSize   pmem_size   PMMUversion   SetPageMode   vmem_size

16.6.2 GetHdv_inuse

Name: »GetHdv_inuse« - Obtain the activity of the hard disk driver.
Number: 4
Declaration: UWORD *GetHdv_inuse ( VOID );
Description: The call GetHdv_inuse enables one to check whether the hard disk driver is currently in the process of swapping a page from or to RAM.

Note: A check of this WORD must be made before the virtual RAM is accessed from an interrupt routine. This is because the hard disk driver may not be interrupted by an access to a non-existing memory page if it is currently offloading another page. If the status WORD is non-zero, the access has to be delayed.
Return value: The function returns a pointer to the hdv_inuse WORD.
Group: PMMU functions-handler
See also: ClearPageMode   GetPageSize   pmem_size   PMMUversion   SetPageMode   vmem_size

16.6.3 GetPageSize

Name: »GetPageSize« - Obtain size of a memory page.
Number: 3
Declaration: ULONG GetPageSize ( VOID );
Description: The call GetPageSize obtains the current size of a memory page.

Note: With a MC-68030 the size can lie between 256 bytes and 32 kbytes.
Return value: The function returns the size of a memory page.
Group:
See also: ClearPageMode   GetHdv_inuse   pmem_size   PMMUversion   SetPageMode   vmem_size

16.6.4 pmem_size

Name: »pmem_size« - Obtain total size of the physical memory handled by the memory manager.
Number: 6
Declaration: ULONG pmem_size ( VOID );
Description: The call pmem_size obtains the total size of the physical memory that is being handled by the memory manager.

Note: This function is only available as of Version 1.01 of the PMMU cookie.
Return value: The function returns the named size.
Group: PMMU functions-handler
See also: ClearPageMode   GetHdv_inuse   GetPageSize   PMMUversion   SetPageMode   vmem_size

16.6.5 PMMUversion

Name: »PMMUversion« - Obtains the version number of the handler.
Number: 0
Declaration: UWORD PMMUversion ( VOID );
Description: The call PMMUversion obtains the version number of the PMMU handler. Here the bits 8..15 store the version, and the bits 0..7 the revision. A value of 0x102 thus represents Version 1.02.
Return value: The function returns the version number of the handler in the above-mentioned format.
Group: PMMU functions-handler
See also: ClearPageMode   GetHdv_inuse   GetPageSize   pmem_size   SetPageMode   vmem_size

16.6.6 SetPageMode

Name: »SetPageMode« - Set PMMU mode for a memory block.
Number: 1
Declaration: ULONG SetPageMode ( ULONG mode, ULONG start_address, ULONG length );
Description: The call SetPageMode sets the PMMU mode for a given block of memory. The following apply:
Parameter Meaning
   
mode Mode as a bit-vector
Bit 0 = SwapInhibit
The memory block will not be offloaded
Bit 1 = WriteProtect
The memory block will be write-protected; attempts to write to it lead to a bus error
Bit 2 = Used
The memory block is marked as being in use; by this it temporarily gets a higher priority and is not offloaded at first
Bit 3 = Modified
The memory block is marked as having been modified; due to this the block is written to disk in any case before new data are read into its ophysical address
Bit 4 = CacheInhibit
The processor caches are switched off for the specified block
start_address Start address of memory block
length Length of the desired block


Note: The remaining bits are reserved and must be set to zero. For the virtual memory management the SwapInhibit bit is the most meaningful one, since it offers the possibility of protecting given memory blocks from being offloaded to disk.

With write-protection of memory blocks it is imperative to note that the memory is subdivided into pages, which form the smallest unit that can be write-protected. One has to ensure that the write-protection does not extend to a block that must not be protected, because it does not belong to the program in question, for instance.
Return value: The function returns zero on error-free execution. Otherwise a value is returned in which the bits that could not be manipulated are set.
Group: PMMU functions-handler
See also: ClearPageMode   GetHdv_inuse   GetPageSize   pmem_size   PMMUversion   vmem_size

16.6.7 vmem_size

Name: »vmem_size« - Inquire total size of the virtual memory.
Number: 5
Declaration: ULONG vmem_size ( VOID );
Description: The call vmem_size obtains the total size of the virtual memory.
Return value: The function returns the named size.
Group: PMMU functions-handler
See also: ClearPageMode   GetHdv_inuse   GetPageSize   pmem_size   PMMUversion   SetPageMode

HomeAppendixDeclaration of sourcesTOS list