Entry | |
---|---|
R0 | Reason code, + Flags which are reason code specific |
All other registers are dependent on reason code |
Exit | |
---|---|
All other registers dependent on reason code |
The purpose of this call is to return information relating to the hardware platform currently running the Operating System.
The action performed depends on the reason code value in R0.
# | Hex # | Action |
---|---|---|
0 | &00 | Read code features |
1 | &01 | Read MMU features (RISC OS Select) |
32 | &20 | Read processor vectors location |
33 | &21 | Read cache information |
34 | &22 | Read CPU features |
The original OS_PlatformFeatures implementation contained a bug whereby requesting an unknown reason code would always result in the error handler being called, even when the X form of the SWI was used. This bug makes it difficult for software to determine the availability of reason codes by calling the X form of the SWI and checking to see if an error is returned – instead of returning to your code, the error handler will be invoked. Note that this bug also affected the handling of any flags in R0 – with RISC OS 3.7, the only valid value for R0 when calling OS_PlatformFeatures was zero, any other value would trigger the bug.
This bug was fixed for RISC OS 3.8 (and by extension RISC OS 4 and 6), but unfortunately the fix was not merged back into the branch of the kernel that RISC OS 5 is based around. Consequently the bug remained unfixed in RISC OS 5 until it was re-discovered and fixed in RISC OS 5.23. Additionally the buggy code was used as the basis for the OS_PlatformFeatures implementation provided by the CallASWI module, and so there are several versions of CallASWI which provide buggy OS_PlatformFeatures implementations for OS versions prior to RISC OS 3.7.
OS_PlatformFeatures 0 bit 31 has now been allocated for the purpose of providing software an easy means to check if the bug has been fixed.