h6. [[OS SWI Calls]] h6(. » OS_PlatformFeatures h2. OS_PlatformFeatures h5. (SWI &6D) |_<^{width:4em}. Entry | | |<^. R0 |<^. "Reason code":#reason, + Flags which are reason code specific | |\2<^. All other registers are dependent on reason code| |_<^{width:4em}. Exit | | |\2<^. All other registers dependent on reason code| h4. Use The purpose of this call is to return information relating to the hardware platform currently running the Operating System. h4. Notes The action performed depends on the reason code value in R0. h4(#reason). Reason Codes |_<^{width:4em}. #|_<^{width:4em}. Hex #|_<^. Action| |<^. 0|<^. &00|<^. [[OS_PlatformFeatures 0|Read code features]]| |<^. 1|<^. &01|<^. Read MMU features (RISC OS Select)| |<^. 32|<^. &20|<^. [[OS_PlatformFeatures 32|Read processor vectors location]]| |<^. 33|<^. &21|<^. [[OS_PlatformFeatures 33|Read cache information]]| |<^. 34|<^. &22|<^. [[OS_PlatformFeatures 34|Read CPU features]]| |<^. 35|<^. &23|<^. [[OS_PlatformFeatures 35|Read clear exclusive monitor function]]| h4(#errorbug). Detecting support for non-zero reason codes 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. * If this bit is set, then it means that the error reporting bug has been fixed, and software can safely poll for the extra reason codes or use non-zero flags in R0. This flag also acts as a hint that the extra reason codes introduced by RISC OS 5 (reason codes 32+) may be present (but their presence is not guaranteed, e.g. CallASWI may not implement all the reason codes) * If this bit is not set, then it means that the bug *may* be present. As stated, RISC OS 4 and 6 do not suffer from the bug. However because all versions of RISC OS 5 which implement additional reason codes will have the flag set, the only extra reason code which you might possibly encounter in this state is OS_PlatformFeatures 1, which was introduced in RISC OS Select.