Memory Map
RISC OS 5 uses a different memory map compared with earlier versions.
The system heap, supervisor stack, "Cursor/System/Sound" area are all
at high addresses (above &F0000000). The RMA is currently at &20000000
(512MB) in RISC OS 5.02 and is likely to move to a higher address in an
imminent release of the Operating System to allow the maximum WimpSlot
to be increased to 1GB. However, it can be assumed that the RMA will remain
below &80000000 for the forseeable future.
This may affect some applications even though they have otherwise been
converted to be 32-bit compatible. Things to look out for:
- Checking to see if a value is positive to see if it's a valid pointer.
- Clearing out the &FC000003 bits from pointers.
- Using high-order bits of pointers as flags.
- Doing signed comparisons of addresses.
Many APIs (particularly in the Wimp) are documented as accepting a number
< 0 or <= 0 to represent an invalid pointer. All such APIs should only
be passed "-1", rather than any other negative number; -1 will be checked for
specifically; other negative numbers will be assumed to be valid pointers.
Also some APIs have previously taken negative numbers to be null pointers,
although only documented as accepting 0; these are being changed to only
accept 0 as documented. This applies to all of the WIMP SWIs and some
SpriteOp SWIs (particular those that use pointers to palettes and translation
tables)..
Dynamic Areas
Since applications will now be able to claim large amounts of memory for
their application slot there is no need for them to use dynamic areas, except
where data needs to be shared between multiple applications.
Excessive use of dynamic areas by applications is now discouraged and
it is likely that you will be able to get more memory in your application
slot than you will in a dynamic area.
Applications should not create 'maximal size' dynamic areas (R5=-1) as
this will lead to rapid exhaustion of available address space on 512MB
machines. After three such claims there will be no address space left
and it will be impossible to create any additional dynamic areas. Applications
should therefore only claim what they need, or avoid using dynamic areas
altogether.