ref: b38d1979951bb048b254983a0fdf694aa7dcb48a
parent: 4e81aab690a17910e221af2a7eeaf6f2309524ac
author: cinap_lenrek <[email protected]>
date: Sat Jun 8 19:53:28 EDT 2013
ape: fix _main stack setup for arm (_privates and _errnoloc was inside argv)
--- a/sys/src/ape/lib/ap/arm/main9.s
+++ b/sys/src/ape/lib/ap/arm/main9.s
@@ -15,14 +15,18 @@
/* _tos = arg */
MOVW R(arg), _tos(SB)
- MOVW $errno+12(SP), R1
+ MOVW $errno-68(SP), R1
MOVW R1, _errnoloc(SB)
- MOVW $private+16(SP), R1
+ MOVW $private-64(SP), R1
MOVW R1, _privates(SB)
MOVW $NPRIVATES, R1
MOVW R1, _nprivates(SB)
BL _envsetup(SB)
+
+ /* main(argc, argv, environ); */
+ MOVW environ(SB), R(arg)
+ MOVW R(arg), 12(R(sp))
MOVW $inargv+0(FP), R(arg)
MOVW R(arg), 8(R(sp))
MOVW inargc-4(FP), R(arg)
--- a/sys/src/ape/lib/ap/arm/main9p.s
+++ b/sys/src/ape/lib/ap/arm/main9p.s
@@ -15,9 +15,9 @@
/* _tos = arg */
MOVW R(arg), _tos(SB)
- MOVW $errno+12(SP), R1
+ MOVW $errno-68(SP), R1
MOVW R1, _errnoloc(SB)
- MOVW $private+16(SP), R1
+ MOVW $private-64(SP), R1
MOVW R1, _privates(SB)
MOVW $NPRIVATES, R1
MOVW R1, _nprivates(SB)
@@ -33,12 +33,12 @@
BL _envsetup(SB)
/* main(argc, argv, environ); */
+ MOVW environ(SB), R(arg)
+ MOVW R(arg), 12(R(sp))
MOVW $inargv+0(FP), R(arg)
MOVW R(arg), 8(R(sp))
MOVW inargc-4(FP), R(arg)
MOVW R(arg), 4(R(sp))
- MOVW environ(SB), R(arg)
- MOVW R(arg), 8(R(sp))
BL main(SB)
loop:
MOVW R(arg), 4(R(sp))