"RISC OS Error"

Peter Naulls peter at chocky.org
Sun Jun 9 03:21:36 PDT 2002


The comments in _signal.s about sys_errlist already being up to
date for __seterr are untrue - in fact this only occurs for errors
which raise a signal.  This is why you see "RISC OS Error" as the result
from sterror() or perror() in many instances where Unixlib sets the
error based upon a SWI error return.

And given that the code in question only adds 3 instructions, it seems
quite reasonable to explictly set it.

Peter


Index: unixlib/source/signal/_signal.s
===================================================================
RCS file: /usr/local/cvsroot/gccsdk/unixlib/source/signal/_signal.s,v
retrieving revision 1.4.2.9
diff -u -r1.4.2.9 _signal.s
--- unixlib/source/signal/_signal.s     2 Oct 2001 10:16:45 -0000       1.4.2.9
+++ unixlib/source/signal/_signal.s     9 Jun 2002 10:19:33 -0000
@@ -65,8 +65,7 @@
 ;      APCS compliant. a1-a4, ip corrupted.
 ;
 ; Set UnixLib's errno to EOPSYS and copy the error from err to UnixLib's
-; error buffer. UnixLib's sys_errlist[EOPSYS] already points to this
-; buffer, so there is no need to update sys_errlist.
+; error buffer.
 ;
        EXPORT  |__seterr|
 |__seterr|
@@ -78,8 +77,12 @@
        MOV     a3, #EOPSYS
        STR     a3, [a2, #0]
 
+       LDR     a4, =sys_errlist
+       LDR     a2, =|__ul_errbuf_errblock|
+       ADD     a3, a2, #4
+       STR     a3, [a4, #(EOPSYS:SHL:2)]
+
        ; Copy the error to UnixLib's buffer.
-       LDR     a2, =|__ul_errbuf_errblock|
        MOV     a3, #|__ul_errbuf__size|
 |__seterr.00|
        LDMIA   a1!, {a4, v1-v5, ip, lr}


-- 
------------------------------------------------------------------------
 Peter Naulls - peter at chocky.org
 Homepage                     -  http://www.chocky.org/
 RISC OS Projects Initiative  -  http://initiative.chocky.org/
 RISC OS C Programming        -  http://www.riscos.info/
------------------------------------------------------------------------



More information about the gcc mailing list