diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-03-11 18:57:22 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-03-11 18:57:22 +0100 |
commit | 25f04a68a168a948783618910e115316eb0ed3fc (patch) | |
tree | b3cb88e49ef21b5855569918634937bdbf78b19e /sys/src/ape/lib/ap/sparc/main9.s | |
parent | 34ec2056041a193a471701dd50e2032dc300fb0e (diff) |
ape: threadsafe errno
store errno on the private process stack so its always per process
and not just per memory space. errno itself becomes a macro
dereferencing int *_errnoloc; which is initialized from main9.s
pointing to the private stack location.
various fixes in programs that just imported errno variable with
"extern int errno;" instead of including <errno.h>.
Diffstat (limited to 'sys/src/ape/lib/ap/sparc/main9.s')
-rw-r--r-- | sys/src/ape/lib/ap/sparc/main9.s | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/src/ape/lib/ap/sparc/main9.s b/sys/src/ape/lib/ap/sparc/main9.s index 1284fb267..72a828da8 100644 --- a/sys/src/ape/lib/ap/sparc/main9.s +++ b/sys/src/ape/lib/ap/sparc/main9.s @@ -1,10 +1,11 @@ #define NPRIVATES 16 GLOBL _tos(SB), $4 +GLOBL _errnoloc(SB), $4 GLOBL _privates(SB), $4 GLOBL _nprivates(SB), $4 -TEXT _main(SB), 1, $(3*4+NPRIVATES*4) +TEXT _main(SB), 1, $(16+NPRIVATES*4) MOVW $setSB(SB), R2 /* _tos = arg */ @@ -16,7 +17,9 @@ TEXT _main(SB), 1, $(3*4+NPRIVATES*4) FADDD F26, F26, F28 FADDD F28, F28, F30 */ - MOVW $8(SP), R1 + MOVW $12(SP), R1 + MOVW R1, _errnoloc(SB) + MOVW $16(SP), R1 MOVW R1, _privates(SB) MOVW $NPRIVATES, R1 MOVW R1, _nprivates(SB) |