home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 5
/
DATAFILE_PDCD5.iso
/
demos
/
proart24
/
Virtualise
/
Docs
/
SWIs
< prev
next >
Wrap
Text File
|
1996-08-08
|
12KB
|
342 lines
File : SWIs
Date : 08-Aug-96
Author : © A.Thoukydides, 1995, 1996
Description : Description of the SWIs provided by the "Virtualise" module.
INTRODUCTION
The Virtualise module can be controlled directly via a number of SWIs
(SoftWare Interrupts). These are described in detail below. However, they are
really only required by programs which offer control over how virtual memory
is used; just using the module to provide virtual memory for other author's
software does not require use or knowldedge of these SWIs.
The interface is logically split into two parts: existing RISC OS calls whose
behaviour has been modified, and new SWIs provided by the module.
CHANGES TO OPERATING SYSTEM SWIS
SWI "OS_DynamicArea" (&66)
This SWI has been extended to allow dynamic areas larger than physical
RAM to be created, and to return the logical size of the area rather than
the physical size.
An extra area flag has been defined:
Bit Meaning
31 Virtual memory is active for dynamic area. If this bit is set
when the area is created then virtual memory is activated
immediately. Note that no error is produced if it is not possible
to start virtual memory for the new dynamic area.
Note that reading this flag bit only gives meaningful results if the
Virtualise module is loaded at the time. This is because the OS is
perfectly happy to maintain and return this bit itself.
The area size may be specified to be larger than the amount of RAM in the
computer, up to a limit of 256MB. However, if -1 is specified for the
maximum size of the area then the maximum size is set to the limit set
using Virtualise_Configure (by default the amount of physical RAM (as at
present). The maximum may be specified larger than the RAM size even if
virtual memory is not being started initially. If Virtualise_Start is
later used then the virtual memory will be able to utilise all the of the
allocated address space.
One important point to note is that there is only 3.5GB of address space
available in the machine. This can soon get used up if all applications
ask for the maximum possible of 256MB. This problem is made worse by a
bug in Filecore which fails with top bit set addresses (over 2GB). Other
applications, such as !ChangeFSI, sometimes fall over at even lower
addresses.
SWI "OS_ChangeDynamicArea" (&2A)
If used on an area that has virtual memory active this SWI adjusts the
logical size of the area, otherwise the physical size is adjusted. In
practice this means that this call can be used by the application without
worrying whether virtual memory is active.
SWI "OS_ReadDynamicArea" (&5C)
If used on an area that has virtual memory active this SWI reads the
logical size of the area, otherwise the behaviour is the same as before.
In practice this means that this call can be used by the application
without worrying whether virtual memory is active.
SWIS PROVIDED BY VIRTUALISE
The SWI chunk starting at &4B6C0 has been officially allocated by Acorn for
use by this module.
SWI "Virtualise_Configure" (&4B6C0)
Configure logical and physical memory usage.
On entry:
R0 = Set the amount of logical address space, in bytes, allocated for
dynamic areas when -1 is passed to OS_DynamicArea 0, or -1 to
read current value.
R1 = Amount of memory to claim automatically, in bytes, or -1 to read
current value.
R2 = Amount of memory to leave free, in bytes, or -1 to read current
value.
On exit:
R0 = The size of address space to allocate.
R1 = The amount of memory to claim, in bytes.
R2 = The amount of memory 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 control over how much real memory to claim, and
how much to leave free. These values are only treated as guidelines.
In particular the user may drag the bar in the Task Manager or the
specified values may lie outside the range of required or useful
memory.
Do not rely on any particular default values. They may be altered by
another application, the configuration specified by the user, or they
could change in a future release of this module.
The recommended way of using this call (if it is used at all) is to
include an option in the application configuration window for minimum
amount of memory to claim and minimum memory to leave free. When the
window is opened this call should be used to read the current
settings. When the user selects OK or Save this call should be used
to set the values. If the application saves a configuration then it
should call this SWI when it starts to set the required values. The
application should not normally set these values any more frequently
- it is likely to result in confusing behaviour for the user if more
that one application is using the virtual memory system.
It is also possible to control how much address space is allocated
for dynamic area which are created with -1 passed for the maximum
size. This allows badly written programs to be used on machines with
a large memory without using ridiculously large sections of the
logical address space. This option should not normally be used by
applications themselves - it is intended for use by the user to
control wastage of logical address space by programs which are not
aware of virtual memory.
SWI "Virtualise_Start" (&4B6C1)
Start virtual memory in an existing dynamic area.
On entry:
R0 = The number of the dynamic area to virtualise.
R1 = Maximum size of area (reserved logical address space), or -1 to
use maximum size of the dynamic area.
R2 = Pointer to name to use for swap file. If this is a null pointer
then a name is chosen automatically.
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:
After a dynamic area has been created using OS_DynamicArea 0 (as usual)
use this SWI to enable virtual memory.
The initial size of the virtual memory is the same as the actual size
of the dynamic area; any data already in the area is copied into the
virtual memory. If there is no data in the area when virtual memory is
enabled then it would be more efficient to shrink the area to 0 size
before using this SWI, and to grow the virtual memory with
OS_ChangeDynamicArea afterwards.
Normally virtual memory is restricted to being within the logical
address space of the dynamic area. However, if more contiguous
logical address space has been reserved it is possible to set R1 to
this value to allow its use. It should never be necessary to use this
option since the Virtualise module if capable of creating dynamic
areas with maximum sizes greater than the RAM size of the computer.
The swap file will normally be placed in the automatically created
directory <Virtualise$SwapDir>. This may be changed by specifying
a full pathname in R2. The variable <Virtualise$SwapDir> defaults to
<Wimp$ScrapDir>.Virtualise.
Note that the following flags must be set:
bit 4 0 - Area is bufferable
bit 5 0 - Area is cacheable
bit 6 0 - Area is singly mapped.
bit 8 0 - Area does not require specific physical pages
If the dynamic