Latest News
!System updates

Development tools
C/C++ Tools

Writing 32-bit code
32-bit introduction
32-bit overview
32-bit technical
Memory issues
Developer tools
Paul Skirrow's Guide (PDF)
Download area

32-bit APIs
API changes
CallASWI
FileCore

RISC OS 5
Overview
BBC BASIC
CDFS driver
OS_ClaimDeviceVector behaviour
CDFS
Draw clipping
GraphicsV
HAL
Internet
UTF8 & Japanese support
International IME support
MIMEMap
Module PostInit/Final
PCI Manager
PDumper
Podules
Resource allocation
SCSI
Service Calls
UCS fonts
USB
WIMP API Changes
WIMP Flags

IYONIX pc
DDR memory
Help system
Keyboard layout
Miscellaneous
PCI slots

Opportunities

Iyonix Ltd
IYONIX home page
Contact details

   

Memory Issues

Memory Protection

Some memory areas that were previously unprotected are protected in RISC OS 5.00. In particular applications can no longer write to memory 0 - &7FFF which is protected against writes in user mode. Attempting to write there will generate an Abort on data transfer error.

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:

  1. Checking to see if a value is positive to see if it's a valid pointer.
  2. Clearing out the &FC000003 bits from pointers.
  3. Using high-order bits of pointers as flags.
  4. 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.

© 2006 IYONIX Ltd 32-bit RISC OS