From 52c549fc9be7baef252448b3f6c18070d445cebf Mon Sep 17 00:00:00 2001 From: Kai Backman Date: Thu, 5 Nov 2009 22:53:08 -0800 Subject: [PATCH] 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 --- src/cmd/gotest/gotest | 2 +- src/pkg/runtime/linux/arm/sys.s | 28 ++++++++++++++++++++-------- test/run | 2 +- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/cmd/gotest/gotest b/src/cmd/gotest/gotest index e274ef9b813..4f6c6c2783b 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 2d70adf8273..00472ef79cb 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 37981d067ba..43103488146 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'