If the dynamic area has a handler routine then virtual memory can only
be enabled for it if this module was loaded when the area was created.
SWI "Virtualise_End" (&4B6C2)
Disable virtual memory in a dynamic area.
On entry:
- R0
The number of the dynamic area to un-virtualise.
On exit:
All registers preserved.
Interrupts: Interrupts are enabled. Fast interrupts are enabled.
Processor mode: Processor is in SVC mode.
Re-entrancy: SWI is not re-entrant.
Use:
Use this SWI to disable virtual memory for a dynamic area. If virtual
memory is not active for the specified dynamic area then the call
returns without error.
If any virtual memory is associated with the area then an attempt is
made to convert it into physical memory. If it is not possible to
claim sufficient memory then the SWI will return an error, and the
virtual memory will remain active.
If the area contains pages locked using Virtualise_Lock then an error
will be produced, and the area will remain with virtual memory active.
If the dynamic area is removed without virtual memory being first
disabled then this SWI is implicitly called, but no check is made
for locked pages. It is better to call this SWI explicitly to allow
more elaborate checks to be performed.
SWI "Virtualise_Lock" (&4B6C3)
Lock pages of a dynamic area for which virtual memory has been enabled.
On entry:
- R0
Start of range of addresses to lock.
- R1
End of range of addresses to lock.
On exit:
All registers preserved.
Interrupts: Interrupt status is undefined. Fast interrupts are enabled.
Processor mode: Processor is in SVC mode.
Re-entrancy: SWI is not re-entrant.
Use:
This SWI allows an area of virtual memory to be locked in physical
memory. This enables the use of that area for interrupt routines,
and other cases which could otherwise lead to reentrancy of either
the virtual memory manager or the file system.
All pages that are included in the range R0 to (R1-1) are locked.
This range must lie fully within the current size of a dynamic area
for which virtual memory has been enabled. A count of how many times a
page has been locked is maintained, and a page will only be unlocked
when the count reaches zero.
Care should be taken when using this SWI to ensure that the minimum
possible number of pages are locked at any time, otherwise there may
not be sufficient physical memory available to provide the rest of
the virtual memory. It is advised that pages are locked for the
shortest possible period.
It is possible to use this call to improve performance of the virtual
memory system by forcing particular pages to remain in memory.
However, this approach should only be used in rare circumstances
where the performance increase would be substantial. If possible,
locking pages in this manner should be a user configurable option.
SWI "Virtualise_Unlock" (&4B6C4)
Unlock pages of a dynamic area for which virtual memory has been enabled.
On entry:
- R0
Start of range of addresses to unlock.
- R1
End of range of addresses to unlock.
On exit:
All registers preserved.
Interrupts: Interrupt status is undefined. Fast interrupts are enabled.
Processor mode: Processor is in SVC mode.
Re-entrancy: SWI is not re-entrant.
Use:
This SWI unlocks pages that were previously locked with
Virtualise_Lock. Exactly the same values of R0 and R1 should be
used when unlocking pages as were used when they were originally
locked; unpredictable results might otherwise occur.
SWI "Virtualise_MiscOp" (&4B6C5)
This is for the internal use of the "!Virtualis" front-end, and should
not be used.
SWI "Virtualise_UserConfigure" (&4B6C6)
Configure the memory and disc usage.
On entry:
- R0
Set the fraction of the logical virtual memory size to claim as physical memory, or -1 to read the current value. This is a fixed point value, with (1 << 15) corresponding to 100%.
- R1
Lower limit of memory to claim, below which all of the required memory is claimed, or -1 to read the current value.
- R2
Upper limit of memory to claim, above which no more memory will be claimed, or -1 to read the current value.
- R3
Amount of memory to keep even when another task is attempting to claim memory, or -1 to read the current value.
- R4
Amount of disc space to leave free, or -1 to read the current value.
On exit:
- R0
Fraction of required memory to claim.
- R1
Minimum memory to claim, in bytes.
- R2
Maximum memory to claim, in bytes.
- R3
Memory to keep, in bytes.
- R4
Disc space to leave free, in bytes.
Interrupts:
Interrupt status is undefined. Fast interrupts are enabled.
Processor mode: Processor is in SVC mode.
Re-entrancy: SWI is not re-entrant.
Use:
This call provides extra control over how much real memory and disc
space to claim. It is provided as a supplement to Virtualise_Configure
to provide extra configuration options while ensuring backwards
compatibility. Some of the values are adjusted by the user when the
bar in the Task Manager is dragged. These values are only guidelines.
More or less memory may be claimed depending upon other constraints.
Do not rely on any particular default values. They may be altered by
another application, by the user dragging the bar in the Task
Manager, or they could change in a future release of this module.
The amount of memory claimed is (approximately) chosen as follows:
The amount of physical memory that could usefully be used to
cache virtual memory is calculated.
This value is scaled by the specified fraction to obtain the
initial allocation.
If the value is above the specified upper limit, then the upper
limit is used instead.
If the value is below the specified lower limit, then the lower
limit is used instead.
If the value is below the minimum amount to claim, then the
required minimum amount to claim is used instead.
If the value does not leave the specified amount of memory free,
then the claimed amount is reduced as required.
If the value is below the minimum memory to keep, then the
amount is increased to the minimum to keep.
Other constraints, such as the number of locked pages and the
maximum memory that can be used, are then enforced.
The amount of memory to keep is also used to decide whether to reduce
the memory claimed when another task attempts to allocate memory.
The disc space to leave free value allows disc space to be reserved
for other purposes, and to avoid problems with FileCore that can
result in corruption of the disc.
Be careful using this call. Inappropriate use could make virtual
memory use very inefficient.
RISCWorld
