aboutsummaryrefslogtreecommitdiff
path: root/src/syscall
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2016-07-11 16:05:57 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2016-08-25 18:52:31 +0000
commit71ab9fa312f8266379dbb358b9ee9303cde7bd6b (patch)
treee7d1a1343a70fb7bf3c26b5d2b5df99623b66515 /src/syscall
parent6af7639ae147689cbabd06287bf4ff15a4dfd896 (diff)
downloadgo-71ab9fa312f8266379dbb358b9ee9303cde7bd6b.tar.xz
all: fix assembly vet issues
Add missing function prototypes. Fix function prototypes. Use FP references instead of SP references. Fix variable names. Update comments. Clean up whitespace. (Not for vet.) All fairly minor fixes to make vet happy. Updates #11041 Change-Id: Ifab2cdf235ff61cdc226ab1d84b8467b5ac9446c Reviewed-on: https://go-review.googlesource.com/27713 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/syscall')
-rw-r--r--src/syscall/asm9_unix1_amd64.s23
-rw-r--r--src/syscall/asm9_unix2_amd64.s35
-rw-r--r--src/syscall/asm_darwin_arm64.s30
-rw-r--r--src/syscall/asm_openbsd_arm.s10
-rw-r--r--src/syscall/asm_plan9_386.s28
-rw-r--r--src/syscall/asm_plan9_amd64.s20
-rw-r--r--src/syscall/asm_unix_386.s73
-rw-r--r--src/syscall/asm_unix_amd64.s99
-rw-r--r--src/syscall/syscall_netbsd.go2
-rw-r--r--src/syscall/syscall_openbsd.go2
10 files changed, 155 insertions, 167 deletions
diff --git a/src/syscall/asm9_unix1_amd64.s b/src/syscall/asm9_unix1_amd64.s
index 67433aa763..29af78c801 100644
--- a/src/syscall/asm9_unix1_amd64.s
+++ b/src/syscall/asm9_unix1_amd64.s
@@ -4,9 +4,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// TODO(rsc): Rewrite all nn(SP) references into name+(nn-8)(FP)
-// so that go vet can check that they are correct.
-
#include "textflag.h"
#include "funcdata.h"
@@ -17,16 +14,16 @@
// func Syscall9(trap int64, a1, a2, a3, a4, a5, a6, a7, a8, a9 int64) (r1, r2, err int64);
TEXT ·Syscall9(SB),NOSPLIT,$0-104
CALL runtime·entersyscall(SB)
- MOVQ 8(SP), AX // syscall entry
- MOVQ 16(SP), DI
- MOVQ 24(SP), SI
- MOVQ 32(SP), DX
- MOVQ 40(SP), R10
- MOVQ 48(SP), R8
- MOVQ 56(SP), R9
- MOVQ 64(SP), R11
- MOVQ 72(SP), R12
- MOVQ 80(SP), R13
+ MOVQ num+0(FP), AX // syscall entry
+ MOVQ a1+8(FP), DI
+ MOVQ a2+16(FP), SI
+ MOVQ a3+24(FP), DX
+ MOVQ a4+32(FP), R10
+ MOVQ a5+40(FP), R8
+ MOVQ a6+48(FP), R9
+ MOVQ a7+56(FP), R11
+ MOVQ a8+64(FP), R12
+ MOVQ a9+72(FP), R13
SUBQ $32, SP
MOVQ R11, 8(SP) // arg 7
MOVQ R12, 16(SP) // arg 8
diff --git a/src/syscall/asm9_unix2_amd64.s b/src/syscall/asm9_unix2_amd64.s
index ee95fa7ed0..11a6c1f485 100644
--- a/src/syscall/asm9_unix2_amd64.s
+++ b/src/syscall/asm9_unix2_amd64.s
@@ -4,9 +4,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// TODO(rsc): Rewrite all nn(SP) references into name+(nn-8)(FP)
-// so that go vet can check that they are correct.
-
#include "textflag.h"
#include "funcdata.h"
@@ -17,33 +14,33 @@
// func Syscall9(trap int64, a1, a2, a3, a4, a5, a6, a7, a8, a9 int64) (r1, r2, err int64);
TEXT ·Syscall9(SB),NOSPLIT,$0-104
CALL runtime·entersyscall(SB)
- MOVQ 8(SP), AX // syscall entry
- MOVQ 16(SP), DI
- MOVQ 24(SP), SI
- MOVQ 32(SP), DX
- MOVQ 40(SP), R10
- MOVQ 48(SP), R8
- MOVQ 56(SP), R9
+ MOVQ num+0(FP), AX // syscall entry
+ MOVQ a1+8(FP), DI
+ MOVQ a2+16(FP), SI
+ MOVQ a3+24(FP), DX
+ MOVQ a4+32(FP), R10
+ MOVQ a5+40(FP), R8
+ MOVQ a6+48(FP), R9
// shift around the last three arguments so they're at the
// top of the stack when the syscall is called.
- MOVQ 64(SP), R11 // arg 7
+ MOVQ a7+56(FP), R11 // arg 7
MOVQ R11, 8(SP)
- MOVQ 72(SP), R11 // arg 8
+ MOVQ a8+64(FP), R11 // arg 8
MOVQ R11, 16(SP)
- MOVQ 80(SP), R11 // arg 9
+ MOVQ a9+72(FP), R11 // arg 9
MOVQ R11, 24(SP)
SYSCALL
JCC ok9
- MOVQ $-1, 88(SP) // r1
- MOVQ $0, 96(SP) // r2
- MOVQ AX, 104(SP) // errno
+ MOVQ $-1, r1+80(FP) // r1
+ MOVQ $0, r2+88(FP) // r2
+ MOVQ AX, err+96(FP) // errno
CALL runtime·exitsyscall(SB)
RET
ok9:
- MOVQ AX, 88(SP) // r1
- MOVQ DX, 96(SP) // r2
- MOVQ $0, 104(SP) // errno
+ MOVQ AX, r1+80(FP) // r1
+ MOVQ DX, r2+88(FP) // r2
+ MOVQ $0, err+96(FP) // errno
CALL runtime·exitsyscall(SB)
RET
diff --git a/src/syscall/asm_darwin_arm64.s b/src/syscall/asm_darwin_arm64.s
index e18ff6a124..95b6dc0db5 100644
--- a/src/syscall/asm_darwin_arm64.s
+++ b/src/syscall/asm_darwin_arm64.s
@@ -8,10 +8,10 @@
// System call support for ARM64, Darwin
//
-// func Syscall(syscall uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr)
+// func Syscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr)
TEXT ·Syscall(SB),NOSPLIT,$0-56
BL runtime·entersyscall(SB)
- MOVD syscall+0(FP), R16
+ MOVD trap+0(FP), R16
MOVD a1+8(FP), R0
MOVD a2+16(FP), R1
MOVD a3+24(FP), R2
@@ -20,19 +20,19 @@ TEXT ·Syscall(SB),NOSPLIT,$0-56
MOVD $-1, R1
MOVD R1, r1+32(FP) // r1
MOVD ZR, r2+40(FP) // r2
- MOVD R0, errno+48(FP) // errno
+ MOVD R0, err+48(FP) // err
BL runtime·exitsyscall(SB)
RET
ok:
MOVD R0, r1+32(FP) // r1
MOVD R1, r2+40(FP) // r2
- MOVD ZR, errno+48(FP) // errno
+ MOVD ZR, err+48(FP) // err
BL runtime·exitsyscall(SB)
RET
// func RawSyscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr)
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- MOVD syscall+0(FP), R16 // syscall entry
+ MOVD trap+0(FP), R16 // syscall entry
MOVD a1+8(FP), R0
MOVD a2+16(FP), R1
MOVD a3+24(FP), R2
@@ -41,18 +41,18 @@ TEXT ·RawSyscall(SB),NOSPLIT,$0-56
MOVD $-1, R1
MOVD R1, r1+32(FP) // r1
MOVD ZR, r2+40(FP) // r2
- MOVD R0, errno+48(FP) // errno
+ MOVD R0, err+48(FP) // err
RET
ok:
MOVD R0, r1+32(FP) // r1
MOVD R1, r2+40(FP) // r2
- MOVD ZR, errno+48(FP) // errno
+ MOVD ZR, err+48(FP) // err
RET
// func Syscall6(trap uintptr, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
TEXT ·Syscall6(SB),NOSPLIT,$0-80
BL runtime·entersyscall(SB)
- MOVD syscall+0(FP), R16 // syscall entry
+ MOVD trap+0(FP), R16 // syscall entry
MOVD a1+8(FP), R0
MOVD a2+16(FP), R1
MOVD a3+24(FP), R2
@@ -64,13 +64,13 @@ TEXT ·Syscall6(SB),NOSPLIT,$0-80
MOVD $-1, R1
MOVD R1, r1+56(FP) // r1
MOVD ZR, r2+64(FP) // r2
- MOVD R0, errno+72(FP) // errno
+ MOVD R0, err+72(FP) // err
BL runtime·exitsyscall(SB)
RET
ok:
MOVD R0, r1+56(FP) // r1
MOVD R1, r2+64(FP) // r2
- MOVD ZR, errno+72(FP) // errno
+ MOVD ZR, err+72(FP) // err
BL runtime·exitsyscall(SB)
RET
@@ -88,19 +88,19 @@ TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
MOVD $-1, R1
MOVD R1, r1+56(FP) // r1
MOVD ZR, r2+64(FP) // r2
- MOVD R0, errno+72(FP) // errno
+ MOVD R0, err+72(FP) // err
RET
ok:
MOVD R0, r1+56(FP) // r1
MOVD R1, r2+64(FP) // r2
MOVD ZR, R0
- MOVD R0, errno+72(FP) // errno
+ MOVD R0, err+72(FP) // err
RET
// Actually Syscall7
TEXT ·Syscall9(SB),NOSPLIT,$0-104
BL runtime·entersyscall(SB)
- MOVD syscall+0(FP), R16 // syscall entry
+ MOVD num+0(FP), R16 // syscall entry
MOVD a1+8(FP), R0
MOVD a2+16(FP), R1
MOVD a3+24(FP), R2
@@ -115,13 +115,13 @@ TEXT ·Syscall9(SB),NOSPLIT,$0-104
MOVD $-1, R1
MOVD R1, r1+80(FP) // r1
MOVD ZR, r2+88(FP) // r2
- MOVD R0, errno+96(FP) // errno
+ MOVD R0, err+96(FP) // err
BL runtime·exitsyscall(SB)
RET
ok:
MOVD R0, r1+80(FP) // r1
MOVD R1, r2+88(FP) // r2
- MOVD ZR, errno+96(FP) // errno
+ MOVD ZR, err+96(FP) // err
BL runtime·exitsyscall(SB)
RET
diff --git a/src/syscall/asm_openbsd_arm.s b/src/syscall/asm_openbsd_arm.s
index 4f034a0898..9279ed960f 100644
--- a/src/syscall/asm_openbsd_arm.s
+++ b/src/syscall/asm_openbsd_arm.s
@@ -17,7 +17,7 @@
TEXT ·Syscall(SB),NOSPLIT,$0-28
BL runtime·entersyscall(SB)
- MOVW syscall+0(FP), R12 // syscall number
+ MOVW trap+0(FP), R12 // syscall number
MOVW a1+4(FP), R0 // arg 1
MOVW a2+8(FP), R1 // arg 2
MOVW a3+12(FP), R2 // arg 3
@@ -39,7 +39,7 @@ error:
TEXT ·Syscall6(SB),NOSPLIT,$0-40
BL runtime·entersyscall(SB)
- MOVW syscall+0(FP), R12 // syscall number
+ MOVW trap+0(FP), R12 // syscall number
MOVW a1+4(FP), R0 // arg 1
MOVW a2+8(FP), R1 // arg 2
MOVW a3+12(FP), R2 // arg 3
@@ -65,7 +65,7 @@ error6:
TEXT ·Syscall9(SB),NOSPLIT,$0-52
BL runtime·entersyscall(SB)
- MOVW syscall+0(FP), R12 // syscall number
+ MOVW num+0(FP), R12 // syscall number
MOVW a1+4(FP), R0 // arg 1
MOVW a2+8(FP), R1 // arg 2
MOVW a3+12(FP), R2 // arg 3
@@ -90,7 +90,7 @@ error9:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- MOVW syscall+0(FP), R12 // syscall number
+ MOVW trap+0(FP), R12 // syscall number
MOVW a1+4(FP), R0 // arg 1
MOVW a2+8(FP), R1 // arg 2
MOVW a3+12(FP), R2 // arg 3
@@ -109,7 +109,7 @@ errorr:
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- MOVW syscall+0(FP), R12 // syscall number
+ MOVW trap+0(FP), R12 // syscall number
MOVW a1+4(FP), R0 // arg 1
MOVW a2+8(FP), R1 // arg 2
MOVW a3+12(FP), R2 // arg 3
diff --git a/src/syscall/asm_plan9_386.s b/src/syscall/asm_plan9_386.s
index fc13640b93..59764a7b66 100644
--- a/src/syscall/asm_plan9_386.s
+++ b/src/syscall/asm_plan9_386.s
@@ -20,10 +20,10 @@
// Trap # in AX, args on stack above caller pc.
TEXT ·Syscall(SB),NOSPLIT,$0-32
CALL runtime·entersyscall(SB)
- MOVL 4(SP), AX // syscall entry
+ MOVL trap+0(FP), AX // syscall entry
// slide args down on top of system call number
- LEAL 8(SP), SI
- LEAL 4(SP), DI
+ LEAL 8(SP), SI
+ LEAL 4(SP), DI
CLD
MOVSL
MOVSL
@@ -55,10 +55,10 @@ copyresult3:
TEXT ·Syscall6(SB),NOSPLIT,$0-44
CALL runtime·entersyscall(SB)
- MOVL 4(SP), AX // syscall entry
+ MOVL trap+0(FP), AX // syscall entry
// slide args down on top of system call number
- LEAL 8(SP), SI
- LEAL 4(SP), DI
+ LEAL 8(SP), SI
+ LEAL 4(SP), DI
CLD
MOVSL
MOVSL
@@ -92,10 +92,10 @@ copyresult4:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- MOVL 4(SP), AX // syscall entry
+ MOVL trap+0(FP), AX // syscall entry
// slide args down on top of system call number
- LEAL 8(SP), SI
- LEAL 4(SP), DI
+ LEAL 8(SP), SI
+ LEAL 4(SP), DI
CLD
MOVSL
MOVSL
@@ -107,10 +107,10 @@ TEXT ·RawSyscall(SB),NOSPLIT,$0-28
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- MOVL 4(SP), AX // syscall entry
+ MOVL trap+0(SP), AX // syscall entry
// slide args down on top of system call number
- LEAL 8(SP), SI
- LEAL 4(SP), DI
+ LEAL 8(SP), SI
+ LEAL 4(SP), DI
CLD
MOVSL
MOVSL
@@ -136,8 +136,8 @@ TEXT ·seek(SB),NOSPLIT,$0-36
CMPL AX, $-1
JNE ok6
- MOVL AX, 24(SP) // newoffset low
- MOVL AX, 28(SP) // newoffset high
+ MOVL AX, newoffset_lo+20(FP)
+ MOVL AX, newoffset_hi+24(FP)
SUBL $8, SP
CALL syscall·errstr(SB)
diff --git a/src/syscall/asm_plan9_amd64.s b/src/syscall/asm_plan9_amd64.s
index 92419b7172..cb1d104b7b 100644
--- a/src/syscall/asm_plan9_amd64.s
+++ b/src/syscall/asm_plan9_amd64.s
@@ -19,7 +19,7 @@
TEXT ·Syscall(SB),NOSPLIT,$0-64
CALL runtime·entersyscall(SB)
- MOVQ 8(SP), BP // syscall entry
+ MOVQ trap+0(FP), BP // syscall entry
// slide args down on top of system call number
LEAQ 16(SP), SI
LEAQ 8(SP), DI
@@ -54,10 +54,10 @@ copyresult3:
TEXT ·Syscall6(SB),NOSPLIT,$0-88
CALL runtime·entersyscall(SB)
- MOVQ 8(SP), BP // syscall entry
+ MOVQ trap+0(FP), BP // syscall entry
// slide args down on top of system call number
- LEAQ 16(SP), SI
- LEAQ 8(SP), DI
+ LEAQ 16(SP), SI
+ LEAQ 8(SP), DI
CLD
MOVSQ
MOVSQ
@@ -91,10 +91,10 @@ copyresult4:
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- MOVQ 8(SP), BP // syscall entry
+ MOVQ trap+0(FP), BP // syscall entry
// slide args down on top of system call number
- LEAQ 16(SP), SI
- LEAQ 8(SP), DI
+ LEAQ 16(SP), SI
+ LEAQ 8(SP), DI
CLD
MOVSQ
MOVSQ
@@ -106,10 +106,10 @@ TEXT ·RawSyscall(SB),NOSPLIT,$0-56
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- MOVQ 8(SP), BP // syscall entry
+ MOVQ trap+0(FP), BP // syscall entry
// slide args down on top of system call number
- LEAQ 16(SP), SI
- LEAQ 8(SP), DI
+ LEAQ 16(SP), SI
+ LEAQ 8(SP), DI
CLD
MOVSQ
MOVSQ
diff --git a/src/syscall/asm_unix_386.s b/src/syscall/asm_unix_386.s
index df7a07d732..263355c493 100644
--- a/src/syscall/asm_unix_386.s
+++ b/src/syscall/asm_unix_386.s
@@ -4,9 +4,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// TODO(rsc): Rewrite all nn(SP) references into name+(nn-8)(FP)
-// so that go vet can check that they are correct.
-
#include "textflag.h"
#include "funcdata.h"
@@ -20,7 +17,7 @@
TEXT ·Syscall(SB),NOSPLIT,$0-28
CALL runtime·entersyscall(SB)
- MOVL 4(SP), AX // syscall entry
+ MOVL trap+0(FP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
LEAL 4(SP), DI
@@ -30,21 +27,21 @@ TEXT ·Syscall(SB),NOSPLIT,$0-28
MOVSL
INT $0x80
JAE ok
- MOVL $-1, 20(SP) // r1
- MOVL $-1, 24(SP) // r2
- MOVL AX, 28(SP) // errno
+ MOVL $-1, r1+16(FP) // r1
+ MOVL $-1, r2+20(FP) // r2
+ MOVL AX, err+24(FP) // errno
CALL runtime·exitsyscall(SB)
RET
ok:
- MOVL AX, 20(SP) // r1
- MOVL DX, 24(SP) // r2
- MOVL $0, 28(SP) // errno
+ MOVL AX, r1+16(FP) // r1
+ MOVL DX, r2+20(FP) // r2
+ MOVL $0, err+24(FP) // errno
CALL runtime·exitsyscall(SB)
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-40
CALL runtime·entersyscall(SB)
- MOVL 4(SP), AX // syscall entry
+ MOVL trap+0(FP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
LEAL 4(SP), DI
@@ -57,21 +54,21 @@ TEXT ·Syscall6(SB),NOSPLIT,$0-40
MOVSL
INT $0x80
JAE ok6
- MOVL $-1, 32(SP) // r1
- MOVL $-1, 36(SP) // r2
- MOVL AX, 40(SP) // errno
+ MOVL $-1, r1+28(FP) // r1
+ MOVL $-1, r2+32(FP) // r2
+ MOVL AX, err+36(FP) // errno
CALL runtime·exitsyscall(SB)
RET
ok6:
- MOVL AX, 32(SP) // r1
- MOVL DX, 36(SP) // r2
- MOVL $0, 40(SP) // errno
+ MOVL AX, r1+28(FP) // r1
+ MOVL DX, r2+32(FP) // r2
+ MOVL $0, err+36(FP) // errno
CALL runtime·exitsyscall(SB)
RET
TEXT ·Syscall9(SB),NOSPLIT,$0-52
CALL runtime·entersyscall(SB)
- MOVL 4(SP), AX // syscall entry
+ MOVL num+0(FP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
LEAL 4(SP), DI
@@ -87,20 +84,20 @@ TEXT ·Syscall9(SB),NOSPLIT,$0-52
MOVSL
INT $0x80
JAE ok9
- MOVL $-1, 44(SP) // r1
- MOVL $-1, 48(SP) // r2
- MOVL AX, 52(SP) // errno
+ MOVL $-1, r1+40(FP) // r1
+ MOVL $-1, r2+44(FP) // r2
+ MOVL AX, err+48(FP) // errno
CALL runtime·exitsyscall(SB)
RET
ok9:
- MOVL AX, 44(SP) // r1
- MOVL DX, 48(SP) // r2
- MOVL $0, 52(SP) // errno
+ MOVL AX, r1+40(FP) // r1
+ MOVL DX, r2+44(FP) // r2
+ MOVL $0, err+48(FP) // errno
CALL runtime·exitsyscall(SB)
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
- MOVL 4(SP), AX // syscall entry
+ MOVL trap+0(FP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
LEAL 4(SP), DI
@@ -110,18 +107,18 @@ TEXT ·RawSyscall(SB),NOSPLIT,$0-28
MOVSL
INT $0x80
JAE ok1
- MOVL $-1, 20(SP) // r1
- MOVL $-1, 24(SP) // r2
- MOVL AX, 28(SP) // errno
+ MOVL $-1, r1+16(FP) // r1
+ MOVL $-1, r2+20(FP) // r2
+ MOVL AX, err+24(FP) // errno
RET
ok1:
- MOVL AX, 20(SP) // r1
- MOVL DX, 24(SP) // r2
- MOVL $0, 28(SP) // errno
+ MOVL AX, r1+16(FP) // r1
+ MOVL DX, r2+20(FP) // r2
+ MOVL $0, err+24(FP) // errno
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
- MOVL 4(SP), AX // syscall entry
+ MOVL trap+0(FP), AX // syscall entry
// slide args down on top of system call number
LEAL 8(SP), SI
LEAL 4(SP), DI
@@ -134,12 +131,12 @@ TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
MOVSL
INT $0x80
JAE ok2
- MOVL $-1, 32(SP) // r1
- MOVL $-1, 36(SP) // r2
- MOVL AX, 40(SP) // errno
+ MOVL $-1, r1+28(FP) // r1
+ MOVL $-1, r2+32(FP) // r2
+ MOVL AX, err+36(FP) // errno
RET
ok2:
- MOVL AX, 32(SP) // r1
- MOVL DX, 36(SP) // r2
- MOVL $0, 40(SP) // errno
+ MOVL AX, r1+28(FP) // r1
+ MOVL DX, r2+32(FP) // r2
+ MOVL $0, err+36(FP) // errno
RET
diff --git a/src/syscall/asm_unix_amd64.s b/src/syscall/asm_unix_amd64.s
index cba80159d0..025408f9e1 100644
--- a/src/syscall/asm_unix_amd64.s
+++ b/src/syscall/asm_unix_amd64.s
@@ -4,9 +4,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// TODO(rsc): Rewrite all nn(SP) references into name+(nn-8)(FP)
-// so that go vet can check that they are correct.
-
#include "textflag.h"
#include "funcdata.h"
@@ -14,92 +11,92 @@
// System call support for AMD64 unixes
//
-// func Syscall(trap int64, a1, a2, a3 int64) (r1, r2, err int64);
-// func Syscall6(trap int64, a1, a2, a3, a4, a5, a6 int64) (r1, r2, err int64);
+// func Syscall(trap int64, a1, a2, a3 int64) (r1, r2, err int64)
+// func Syscall6(trap int64, a1, a2, a3, a4, a5, a6 int64) (r1, r2, err int64)
// Trap # in AX, args in DI SI DX, return in AX DX
TEXT ·Syscall(SB),NOSPLIT,$0-56
CALL runtime·entersyscall(SB)
- MOVQ 8(SP), AX // syscall entry
- MOVQ 16(SP), DI
- MOVQ 24(SP), SI
- MOVQ 32(SP), DX
+ MOVQ trap+0(FP), AX // syscall entry
+ MOVQ a1+8(FP), DI
+ MOVQ a2+16(FP), SI
+ MOVQ a3+24(FP), DX
MOVQ $0, R10
MOVQ $0, R8
MOVQ $0, R9
SYSCALL
JCC ok
- MOVQ $-1, 40(SP) // r1
- MOVQ $0, 48(SP) // r2
- MOVQ AX, 56(SP) // errno
+ MOVQ $-1, r1+32(FP) // r1
+ MOVQ $0, r2+40(FP) // r2
+ MOVQ AX, err+48(FP) // errno
CALL runtime·exitsyscall(SB)
RET
ok:
- MOVQ AX, 40(SP) // r1
- MOVQ DX, 48(SP) // r2
- MOVQ $0, 56(SP) // errno
+ MOVQ AX, r1+32(FP) // r1
+ MOVQ DX, r2+40(FP) // r2
+ MOVQ $0, err+48(FP) // errno
CALL runtime·exitsyscall(SB)
RET
TEXT ·Syscall6(SB),NOSPLIT,$0-80
CALL runtime·entersyscall(SB)
- MOVQ 8(SP), AX // syscall entry
- MOVQ 16(SP), DI
- MOVQ 24(SP), SI
- MOVQ 32(SP), DX
- MOVQ 40(SP), R10
- MOVQ 48(SP), R8
- MOVQ 56(SP), R9
+ MOVQ trap+0(FP), AX // syscall entry
+ MOVQ a1+8(FP), DI
+ MOVQ a2+16(FP), SI
+ MOVQ a3+24(FP), DX
+ MOVQ a4+32(FP), R10
+ MOVQ a5+40(FP), R8
+ MOVQ a6+48(FP), R9
SYSCALL
JCC ok6
- MOVQ $-1, 64(SP) // r1
- MOVQ $0, 72(SP) // r2
- MOVQ AX, 80(SP) // errno
+ MOVQ $-1, r1+56(FP) // r1
+ MOVQ $0, r2+64(FP) // r2
+ MOVQ AX, err+72(FP) // errno
CALL runtime·exitsyscall(SB)
RET
ok6:
- MOVQ AX, 64(SP) // r1
- MOVQ DX, 72(SP) // r2
- MOVQ $0, 80(SP) // errno
+ MOVQ AX, r1+56(FP) // r1
+ MOVQ DX, r2+64(FP) // r2
+ MOVQ $0, err+72(FP) // errno
CALL runtime·exitsyscall(SB)
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
- MOVQ 16(SP), DI
- MOVQ 24(SP), SI
- MOVQ 32(SP), DX
+ MOVQ a1+8(FP), DI
+ MOVQ a2+16(FP), SI
+ MOVQ a3+24(FP), DX
MOVQ $0, R10
MOVQ $0, R8
MOVQ $0, R9
- MOVQ 8(SP), AX // syscall entry
+ MOVQ trap+0(FP), AX // syscall entry
SYSCALL
JCC ok1
- MOVQ $-1, 40(SP) // r1
- MOVQ $0, 48(SP) // r2
- MOVQ AX, 56(SP) // errno
+ MOVQ $-1, r1+32(FP) // r1
+ MOVQ $0, r2+40(FP) // r2
+ MOVQ AX, err+48(FP) // errno
RET
ok1:
- MOVQ AX, 40(SP) // r1
- MOVQ DX, 48(SP) // r2
- MOVQ $0, 56(SP) // errno
+ MOVQ AX, r1+32(FP) // r1
+ MOVQ DX, r2+40(FP) // r2
+ MOVQ $0, err+48(FP) // errno
RET
TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
- MOVQ 16(SP), DI
- MOVQ 24(SP), SI
- MOVQ 32(SP), DX
- MOVQ 40(SP), R10
- MOVQ 48(SP), R8
- MOVQ 56(SP), R9
- MOVQ 8(SP), AX // syscall entry
+ MOVQ a1+8(FP), DI
+ MOVQ a2+16(FP), SI
+ MOVQ a3+24(FP), DX
+ MOVQ a4+32(FP), R10
+ MOVQ a5+40(FP), R8
+ MOVQ a6+48(FP), R9
+ MOVQ trap+0(FP), AX // syscall entry
SYSCALL
JCC ok2
- MOVQ $-1, 64(SP) // r1
- MOVQ $0, 72(SP) // r2
- MOVQ AX, 80(SP) // errno
+ MOVQ $-1, r1+56(FP) // r1
+ MOVQ $0, r2+64(FP) // r2
+ MOVQ AX, err+72(FP) // errno
RET
ok2:
- MOVQ AX, 64(SP) // r1
- MOVQ DX, 72(SP) // r2
- MOVQ $0, 80(SP) // errno
+ MOVQ AX, r1+56(FP) // r1
+ MOVQ DX, r2+64(FP) // r2
+ MOVQ $0, err+72(FP) // errno
RET
diff --git a/src/syscall/syscall_netbsd.go b/src/syscall/syscall_netbsd.go
index 7fd6e2bf46..081af62cc5 100644
--- a/src/syscall/syscall_netbsd.go
+++ b/src/syscall/syscall_netbsd.go
@@ -26,7 +26,7 @@ type SockaddrDatalink struct {
raw RawSockaddrDatalink
}
-func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno)
+func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno)
func sysctlNodes(mib []_C_int) (nodes []Sysctlnode, err error) {
var olen uintptr
diff --git a/src/syscall/syscall_openbsd.go b/src/syscall/syscall_openbsd.go
index e196e5966c..68218cf93b 100644
--- a/src/syscall/syscall_openbsd.go
+++ b/src/syscall/syscall_openbsd.go
@@ -26,7 +26,7 @@ type SockaddrDatalink struct {
raw RawSockaddrDatalink
}
-func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno)
+func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno)
func nametomib(name string) (mib []_C_int, err error) {