• Jeffrey Lee's avatar
    Fix register corruption in OS_Exit · b1300179
    Jeffrey Lee authored
    Although it's never been officially documented, RISC OS has historically
    used the following values for R0-R2 when calling the exit environment
    handler:
    
    R0 = 0 (or some other "safe" value)
    R1 = R1 from OS_Exit
    R2 = Return code
    
    Some exit handlers were relying on this (e.g. Shared C Library /
    ANSILib). Changing OS_Exit to use TaskControl_ResetStacks was causing R1
    & R2 to be corrupt, with the result that non-zero, non-error-generating
    return codes from C programs were being lost and reset to zero.
    
    Document things more clearly and ensure R0-R2 have acceptable values so
    that software which relies on the old behaviour will work again.
    b1300179
OSExitArgs,fd1 12.3 KB