summaryrefslogtreecommitdiff
path: root/sys/src/ape/lib/ap/sparc/main9.s
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2016-05-04 00:23:48 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2016-05-04 00:23:48 +0200
commit14685d65958bed4d68b9c60564fa8d09aa746462 (patch)
treef2480af19061f27c67a36a2bb8fd7f41d047732a /sys/src/ape/lib/ap/sparc/main9.s
parent7657312dcf5b9435ff848b20dfc3a0546ab8a500 (diff)
ape: return plan9 error strings from strerror()
when _syserrno() fails to map a plan9 error string to a unix error number, we copy the plan9 error string to the per process error buffer "plan9err" and set errno = EPLAN9. when strerror() is called with EPLAN9, it returns a pointer to the plan9err buffer.
Diffstat (limited to 'sys/src/ape/lib/ap/sparc/main9.s')
-rw-r--r--sys/src/ape/lib/ap/sparc/main9.s20
1 files changed, 13 insertions, 7 deletions
diff --git a/sys/src/ape/lib/ap/sparc/main9.s b/sys/src/ape/lib/ap/sparc/main9.s
index 72a828da8..6907fd869 100644
--- a/sys/src/ape/lib/ap/sparc/main9.s
+++ b/sys/src/ape/lib/ap/sparc/main9.s
@@ -2,10 +2,11 @@
GLOBL _tos(SB), $4
GLOBL _errnoloc(SB), $4
+GLOBL _plan9err(SB), $4
GLOBL _privates(SB), $4
GLOBL _nprivates(SB), $4
-TEXT _main(SB), 1, $(16+NPRIVATES*4)
+TEXT _main(SB), 1, $(12+4+128+NPRIVATES*4)
MOVW $setSB(SB), R2
/* _tos = arg */
@@ -17,18 +18,23 @@ TEXT _main(SB), 1, $(16+NPRIVATES*4)
FADDD F26, F26, F28
FADDD F28, F28, F30
*/
- MOVW $12(SP), R1
- MOVW R1, _errnoloc(SB)
- MOVW $16(SP), R1
- MOVW R1, _privates(SB)
- MOVW $NPRIVATES, R1
- MOVW R1, _nprivates(SB)
+ MOVW $12(R1), R7
+ MOVW R7, _errnoloc(SB)
+ ADD $4, R7
+ MOVW R7, _plan9err(SB)
+ ADD $128, R7
+ MOVW R7, _privates(SB)
+ MOVW $NPRIVATES, R7
+ MOVW R7, _nprivates(SB)
JMPL _envsetup(SB)
+
MOVW inargc-4(FP), R7
MOVW $inargv+0(FP), R8
+ MOVW environ(SB), R9
MOVW R7, 4(R1)
MOVW R8, 8(R1)
+ MOVW R9, 12(R1)
JMPL main(SB)
loop: