summaryrefslogtreecommitdiff
path: root/sys/src/ape/lib/ap/68020
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-03-11 18:57:22 +0100
committercinap_lenrek <cinap_lenrek@gmx.de>2013-03-11 18:57:22 +0100
commit25f04a68a168a948783618910e115316eb0ed3fc (patch)
treeb3cb88e49ef21b5855569918634937bdbf78b19e /sys/src/ape/lib/ap/68020
parent34ec2056041a193a471701dd50e2032dc300fb0e (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/68020')
-rw-r--r--sys/src/ape/lib/ap/68020/main9.s6
-rw-r--r--sys/src/ape/lib/ap/68020/main9p.s6
2 files changed, 8 insertions, 4 deletions
diff --git a/sys/src/ape/lib/ap/68020/main9.s b/sys/src/ape/lib/ap/68020/main9.s
index 715331ff4..6b80251b6 100644
--- a/sys/src/ape/lib/ap/68020/main9.s
+++ b/sys/src/ape/lib/ap/68020/main9.s
@@ -1,15 +1,17 @@
#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)
MOVL $a6base(SB), A6
/* _tos = arg */
MOVL R0, _tos(SB) /* return value of sys exec!! */
- LEA private+8(SP), _privates(SB)
+ LEA errno+12(SB), _errnoloc(SB)
+ LEA private+16(SP), _privates(SB)
MOVL $NPRIVATES, _nprivates(SB)
PEA inargv+0(FP)
diff --git a/sys/src/ape/lib/ap/68020/main9p.s b/sys/src/ape/lib/ap/68020/main9p.s
index 171355c5f..e24faeddc 100644
--- a/sys/src/ape/lib/ap/68020/main9p.s
+++ b/sys/src/ape/lib/ap/68020/main9p.s
@@ -1,15 +1,17 @@
#define NPRIVATES 16
GLOBL _tos(SB), $4
+GLOBL _errnoloc(SB), $4
GLOBL _privates(SB), $4
GLOBL _nprivates(SB), $4
-TEXT _mainp(SB), 1, $(3*4+NPRIVATES*4)
+TEXT _mainp(SB), 1, $(16+NPRIVATES*4)
MOVL $a6base(SB), A6
/* _tos = arg */
MOVL R0, _tos(SB) /* return value of sys exec!! */
- LEA private+8(SP), _privates(SB)
+ LEA errno+12(SP), _errnoloc(SB)
+ LEA private+16(SP), _privates(SB)
MOVL $NPRIVATES, _nprivates(SB)
/* _profmain(); */