summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMikio Hara <mikioh.mikioh@gmail.com>2014-02-14 12:22:13 +0900
committerMikio Hara <mikioh.mikioh@gmail.com>2014-02-14 12:22:13 +0900
commit8ae075e6d9308b1c8c85e27be9be0aa9bf092eaf (patch)
tree4fbf1319b28807d98f777f541a52504b35703805 /src
parentee47818e95f3dc9bb421e46a1a0332bbdb6aa4ca (diff)
downloadgo-8ae075e6d9308b1c8c85e27be9be0aa9bf092eaf.tar.gz
syscall: fix system calls with misaligned arguments on freebsd/arm
This CL enables the current tree to work with FreeBSD 10-STABLE on ARM EABI platforms, though there are still a few test fails. Also updates documentation. LGTM=iant R=iant, dave CC=golang-codereviews https://codereview.appspot.com/61060044
Diffstat (limited to 'src')
-rw-r--r--src/pkg/syscall/asm_freebsd_arm.s51
1 files changed, 27 insertions, 24 deletions
diff --git a/src/pkg/syscall/asm_freebsd_arm.s b/src/pkg/syscall/asm_freebsd_arm.s
index 9283d079b..c01ce6feb 100644
--- a/src/pkg/syscall/asm_freebsd_arm.s
+++ b/src/pkg/syscall/asm_freebsd_arm.s
@@ -8,13 +8,13 @@
// System call support for ARM, FreeBSD
//
-// func Syscall(trap int32, a1, a2, a3 int32) (r1, r2, err int32);
-// func Syscall6(trap int32, a1, a2, a3, a4, a5, a6 int32) (r1, r2, err int32);
-// func Syscall9(trap int32, a1, a2, a3, a4, a5, a6, a7, a8, a9 int64) (r1, r2, err int32)
+// func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, errno uintptr);
+// func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, errno uintptr);
+// func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2, errno uintptr)
TEXT ·Syscall(SB),NOSPLIT,$0-28
BL runtime·entersyscall(SB)
- MOVW 0(FP), R7 // sigcall num
+ MOVW 0(FP), R7 // syscall number
MOVW 4(FP), R0 // a1
MOVW 8(FP), R1 // a2
MOVW 12(FP), R2 // a3
@@ -23,69 +23,71 @@ TEXT ·Syscall(SB),NOSPLIT,$0-28
BCS error
MOVW R0, 16(FP) // r1
MOVW R1, 20(FP) // r2
- MOVW R2, 24(FP) // err
+ MOVW R2, 24(FP) // errno
BL runtime·exitsyscall(SB)
RET
error:
MOVW $-1, R3
MOVW R3, 16(FP) // r1
MOVW R2, 20(FP) // r2
- MOVW R0, 24(FP) // err
+ MOVW R0, 24(FP) // errno
BL runtime·exitsyscall(SB)
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-40
BL runtime·entersyscall(SB)
- MOVW 0(FP), R7 // sigcall num
+ MOVW 0(FP), R7 // syscall number
MOVW 4(FP), R0 // a1
MOVW 8(FP), R1 // a2
MOVW 12(FP), R2 // a3
MOVW 16(FP), R3 // a4
- ADD $24, R13 // a5 to a6 are passed on stack
+ MOVW R13, R4
+ MOVW $20(FP), R13 // a5 to a6 are passed on stack
SWI $0 // syscall
- SUB $24, R13
+ MOVW R4, R13
MOVW $0, R2
BCS error6
MOVW R0, 28(FP) // r1
MOVW R1, 32(FP) // r2
- MOVW R2, 36(FP) // err
+ MOVW R2, 36(FP) // errno
BL runtime·exitsyscall(SB)
RET
error6:
MOVW $-1, R3
MOVW R3, 28(FP) // r1
MOVW R2, 32(FP) // r2
- MOVW R0, 36(FP) // err
+ MOVW R0, 36(FP) // errno
BL runtime·exitsyscall(SB)
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-52
BL runtime·entersyscall(SB)
- MOVW 0(FP), R7 // sigcall num
+ MOVW 0(FP), R7 // syscall number
MOVW 4(FP), R0 // a1
MOVW 8(FP), R1 // a2
MOVW 12(FP), R2 // a3
MOVW 16(FP), R3 // a4
- ADD $24, R13 // a5 to a9 are passed on stack
+ MOVW R13, R4
+ MOVW $20(FP), R13 // a5 to a9 are passed on stack
SWI $0 // syscall
- SUB $24, R13
+ MOVW R4, R13
MOVW $0, R2
BCS error9
MOVW R0, 40(FP) // r1
MOVW R1, 44(FP) // r2
- MOVW R2, 48(FP) // err
+ MOVW R2, 48(FP) // errno
BL runtime·exitsyscall(SB)
RET
error9:
MOVW $-1, R3
MOVW R3, 40(FP) // r1
MOVW R2, 44(FP) // r2
- MOVW R0, 48(FP) // err
+ MOVW R0, 48(FP) // errno
BL runtime·exitsyscall(SB)
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- MOVW 0(FP), R7 // sigcall num
+ MOVW 0(FP), R7 // syscall number
MOVW 4(FP), R0 // a1
MOVW 8(FP), R1 // a2
MOVW 12(FP), R2 // a3
@@ -94,33 +96,34 @@ TEXT ·RawSyscall(SB),NOSPLIT,$0-28
BCS errorr
MOVW R0, 16(FP) // r1
MOVW R1, 20(FP) // r2
- MOVW R2, 24(FP) // err
+ MOVW R2, 24(FP) // errno
RET
errorr:
MOVW $-1, R3
MOVW R3, 16(FP) // r1
MOVW R2, 20(FP) // r2
- MOVW R0, 24(FP) // err
+ MOVW R0, 24(FP) // errno
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- MOVW 0(FP), R7 // sigcall num
+ MOVW 0(FP), R7 // syscall number
MOVW 4(FP), R0 // a1
MOVW 8(FP), R1 // a2
MOVW 12(FP), R2 // a3
MOVW 16(FP), R3 // a4
- ADD $24, R13 // a5 to a6 are passed on stack
+ MOVW R13, R4
+ MOVW $20(FP), R13 // a5 to a6 are passed on stack
SWI $0 // syscall
- SUB $24, R13
+ MOVW R4, R13
MOVW $0, R2
BCS errorr6
MOVW R0, 28(FP) // r1
MOVW R1, 32(FP) // r2
- MOVW R2, 36(FP) // err
+ MOVW R2, 36(FP) // errno
RET
errorr6:
MOVW $-1, R3
MOVW R3, 28(FP) // r1
MOVW R2, 32(FP) // r2
- MOVW R0, 36(FP) // err
+ MOVW R0, 36(FP) // errno
RET