1
0
mirror of https://github.com/golang/go synced 2024-11-25 00:07:56 -07:00

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
This commit is contained in:
Kai Backman 2009-11-05 22:53:08 -08:00
parent 054354ebd4
commit 52c549fc9b
3 changed files with 22 additions and 10 deletions

View File

@ -25,7 +25,7 @@ esac
# TODO(kaib): proper emulator strategy # TODO(kaib): proper emulator strategy
case x"$GOARCH" in case x"$GOARCH" in
xarm) xarm)
E="qemu-arm -cpu cortex-a8" export E=${EMU_arm:-qemu-arm -cpu cortex-a8}
esac esac
# Allow overrides # Allow overrides

View File

@ -8,7 +8,12 @@
#include "arm/asm.h" #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_exit (SYS_BASE + 1)
#define SYS_write (SYS_BASE + 4) #define SYS_write (SYS_BASE + 4)
#define SYS_clone (SYS_BASE + 120) #define SYS_clone (SYS_BASE + 120)
@ -21,19 +26,22 @@ TEXT write(SB),7,$0
MOVW 0(FP), R0 MOVW 0(FP), R0
MOVW 4(FP), R1 MOVW 4(FP), R1
MOVW 8(FP), R2 MOVW 8(FP), R2
SWI $SYS_write MOVW $SYS_write, R7
SWI $0
RET RET
TEXT exit(SB),7,$-4 TEXT exit(SB),7,$-4
MOVW 0(FP), R0 MOVW 0(FP), R0
SWI $SYS_exit_group MOVW $SYS_exit_group, R7
SWI $0
MOVW $1234, R0 MOVW $1234, R0
MOVW $1002, R1 MOVW $1002, R1
MOVW R0, (R1) // fail hard MOVW R0, (R1) // fail hard
TEXT exit1(SB),7,$-4 TEXT exit1(SB),7,$-4
MOVW 0(FP), R0 MOVW 0(FP), R0
SWI $SYS_exit MOVW $SYS_exit, R7
SWI $0
MOVW $1234, R0 MOVW $1234, R0
MOVW $1003, R1 MOVW $1003, R1
MOVW R0, (R1) // fail hard MOVW R0, (R1) // fail hard
@ -45,7 +53,8 @@ TEXT runtime·mmap(SB),7,$0
MOVW 12(FP), R3 MOVW 12(FP), R3
MOVW 16(FP), R4 MOVW 16(FP), R4
MOVW 20(FP), R5 MOVW 20(FP), R5
SWI $SYS_mmap2 MOVW $SYS_mmap2, R7
SWI $0
RET RET
// int32 futex(int32 *uaddr, int32 op, int32 val, // int32 futex(int32 *uaddr, int32 op, int32 val,
@ -57,7 +66,8 @@ TEXT futex(SB),7,$0
MOVW 16(SP), R3 MOVW 16(SP), R3
MOVW 20(SP), R4 MOVW 20(SP), R4
MOVW 24(SP), R5 MOVW 24(SP), R5
SWI $SYS_futex MOVW $SYS_futex, R7
SWI $0
RET RET
@ -82,7 +92,8 @@ TEXT clone(SB),7,$0
MOVW $1234, R6 MOVW $1234, R6
MOVW R6, 12(R1) MOVW R6, 12(R1)
SWI $SYS_clone MOVW $SYS_clone, R7
SWI $0
// In parent, return. // In parent, return.
CMP $0, R0 CMP $0, R0
@ -106,7 +117,8 @@ TEXT clone(SB),7,$0
BL emptyfunc(SB) // fault if stack check is wrong BL emptyfunc(SB) // fault if stack check is wrong
// Initialize m->procid to Linux tid // Initialize m->procid to Linux tid
SWI $SYS_gettid MOVW $SYS_gettid, R7
SWI $0
MOVW R0, m_procid(m) MOVW R0, m_procid(m)
// Call fn // Call fn

View File

@ -13,7 +13,7 @@ X386)
;; ;;
Xarm) Xarm)
export A=5 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' echo 1>&2 run: unsupported '$GOARCH'