summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Backman <kaib@golang.org>2009-11-05 22:53:08 -0800
committerKai Backman <kaib@golang.org>2009-11-05 22:53:08 -0800
commit415dda6697bf2e5f8ea9e44e91bd77b9734835c0 (patch)
tree55e9491110d8ffcd325ff6ff32f5621df5ab1b80
parentf1a193048012fb96ae68bad0bf107d03351979ce (diff)
downloadgolang-415dda6697bf2e5f8ea9e44e91bd77b9734835c0.tar.gz
make 5g executables run on android/arm hardware. change OABI
usage to EABI. go/test: passes 85% (296/347) on random android phone. R=rsc http://go/go-review/1024003
-rwxr-xr-xsrc/cmd/gotest/gotest2
-rw-r--r--src/pkg/runtime/linux/arm/sys.s28
-rwxr-xr-xtest/run2
3 files changed, 22 insertions, 10 deletions
diff --git a/src/cmd/gotest/gotest b/src/cmd/gotest/gotest
index e274ef9b8..4f6c6c278 100755
--- a/src/cmd/gotest/gotest
+++ b/src/cmd/gotest/gotest
@@ -25,7 +25,7 @@ esac
# TODO(kaib): proper emulator strategy
case x"$GOARCH" in
xarm)
- E="qemu-arm -cpu cortex-a8"
+ export E=${EMU_arm:-qemu-arm -cpu cortex-a8}
esac
# Allow overrides
diff --git a/src/pkg/runtime/linux/arm/sys.s b/src/pkg/runtime/linux/arm/sys.s
index 2d70adf82..00472ef79 100644
--- a/src/pkg/runtime/linux/arm/sys.s
+++ b/src/pkg/runtime/linux/arm/sys.s
@@ -8,7 +8,12 @@
#include "arm/asm.h"
-#define SYS_BASE 0x00900000
+// OABI
+//#define SYS_BASE 0x00900000
+
+// EABI
+#define SYS_BASE 0x0
+
#define SYS_exit (SYS_BASE + 1)
#define SYS_write (SYS_BASE + 4)
#define SYS_clone (SYS_BASE + 120)
@@ -21,19 +26,22 @@ TEXT write(SB),7,$0
MOVW 0(FP), R0
MOVW 4(FP), R1
MOVW 8(FP), R2
- SWI $SYS_write
+ MOVW $SYS_write, R7
+ SWI $0
RET
TEXT exit(SB),7,$-4
MOVW 0(FP), R0
- SWI $SYS_exit_group
+ MOVW $SYS_exit_group, R7
+ SWI $0
MOVW $1234, R0
MOVW $1002, R1
MOVW R0, (R1) // fail hard
TEXT exit1(SB),7,$-4
MOVW 0(FP), R0
- SWI $SYS_exit
+ MOVW $SYS_exit, R7
+ SWI $0
MOVW $1234, R0
MOVW $1003, R1
MOVW R0, (R1) // fail hard
@@ -45,7 +53,8 @@ TEXT runtime·mmap(SB),7,$0
MOVW 12(FP), R3
MOVW 16(FP), R4
MOVW 20(FP), R5
- SWI $SYS_mmap2
+ MOVW $SYS_mmap2, R7
+ SWI $0
RET
// int32 futex(int32 *uaddr, int32 op, int32 val,
@@ -57,7 +66,8 @@ TEXT futex(SB),7,$0
MOVW 16(SP), R3
MOVW 20(SP), R4
MOVW 24(SP), R5
- SWI $SYS_futex
+ MOVW $SYS_futex, R7
+ SWI $0
RET
@@ -82,7 +92,8 @@ TEXT clone(SB),7,$0
MOVW $1234, R6
MOVW R6, 12(R1)
- SWI $SYS_clone
+ MOVW $SYS_clone, R7
+ SWI $0
// In parent, return.
CMP $0, R0
@@ -106,7 +117,8 @@ TEXT clone(SB),7,$0
BL emptyfunc(SB) // fault if stack check is wrong
// Initialize m->procid to Linux tid
- SWI $SYS_gettid
+ MOVW $SYS_gettid, R7
+ SWI $0
MOVW R0, m_procid(m)
// Call fn
diff --git a/test/run b/test/run
index 37981d067..431034881 100755
--- a/test/run
+++ b/test/run
@@ -13,7 +13,7 @@ X386)
;;
Xarm)
export A=5
- export E="qemu-arm -cpu cortex-a8 "
+ export E=${EMU_arm:-qemu-arm -cpu cortex-a8}
;;
*)
echo 1>&2 run: unsupported '$GOARCH'