Commit 33f95ec4 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

syscall: superficial cleanup of amd64 unix assembly

This is preliminary work to unifying them.

Updates #11041

Change-Id: Ibe83da3d626f1da9e8888e26cedd3af2152b42e6
Reviewed-on: https://go-review.googlesource.com/25114
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 856342d8
......@@ -14,23 +14,23 @@
// 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 Syscall9(trap int64, a1, a2, a3, a4, a5, a6, a7, a8, a9 int64) (r1, r2, err int64)
// func Syscall9(trap int64, a1, a2, a3, a4, a5, a6, a7, a8, a9 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 $0, R10
MOVQ $0, R8
MOVQ $0, R9
MOVQ 8(SP), AX // syscall entry
SYSCALL
JCC ok
MOVQ $-1, 40(SP) // r1
MOVQ $0, 48(SP) // r2
MOVQ AX, 56(SP) // errno
MOVQ AX, 56(SP) // errno
CALL runtime·exitsyscall(SB)
RET
ok:
......@@ -42,18 +42,18 @@ ok:
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 8(SP), AX // syscall entry
SYSCALL
JCC ok6
MOVQ $-1, 64(SP) // r1
MOVQ $0, 72(SP) // r2
MOVQ AX, 80(SP) // errno
MOVQ AX, 80(SP) // errno
CALL runtime·exitsyscall(SB)
RET
ok6:
......@@ -65,11 +65,11 @@ ok6:
TEXT ·Syscall9(SB),NOSPLIT,$0-104
CALL runtime·entersyscall(SB)
MOVQ 8(SP), AX
MOVQ 8(SP), AX // syscall entry
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
MOVQ 40(SP), R10
MOVQ 40(SP), R10
MOVQ 48(SP), R8
MOVQ 56(SP), R9
......@@ -86,7 +86,7 @@ TEXT ·Syscall9(SB),NOSPLIT,$0-104
JCC ok9
MOVQ $-1, 88(SP) // r1
MOVQ $0, 96(SP) // r2
MOVQ AX, 104(SP) // errno
MOVQ AX, 104(SP) // errno
CALL runtime·exitsyscall(SB)
RET
ok9:
......@@ -96,7 +96,7 @@ ok9:
CALL runtime·exitsyscall(SB)
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
......@@ -108,7 +108,7 @@ TEXT ·RawSyscall(SB),NOSPLIT,$0-56
JCC ok1
MOVQ $-1, 40(SP) // r1
MOVQ $0, 48(SP) // r2
MOVQ AX, 56(SP) // errno
MOVQ AX, 56(SP) // errno
RET
ok1:
MOVQ AX, 40(SP) // r1
......@@ -128,7 +128,7 @@ TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
JCC ok2
MOVQ $-1, 64(SP) // r1
MOVQ $0, 72(SP) // r2
MOVQ AX, 80(SP) // errno
MOVQ AX, 80(SP) // errno
RET
ok2:
MOVQ AX, 64(SP) // r1
......
......@@ -14,23 +14,23 @@
// 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 Syscall9(trap int64, a1, a2, a3, a4, a5, a6, a7, a8, a9 int64) (r1, r2, err int64)
// func Syscall9(trap int64, a1, a2, a3, a4, a5, a6, a7, a8, a9 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 $0, R10
MOVQ $0, R8
MOVQ $0, R9
MOVQ 8(SP), AX // syscall entry
SYSCALL
JCC ok
MOVQ $-1, 40(SP) // r1
MOVQ $0, 48(SP) // r2
MOVQ AX, 56(SP) // errno
MOVQ AX, 56(SP) // errno
CALL runtime·exitsyscall(SB)
RET
ok:
......@@ -42,18 +42,18 @@ ok:
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 8(SP), AX // syscall entry
SYSCALL
JCC ok6
MOVQ $-1, 64(SP) // r1
MOVQ $0, 72(SP) // r2
MOVQ AX, 80(SP) // errno
MOVQ AX, 80(SP) // errno
CALL runtime·exitsyscall(SB)
RET
ok6:
......@@ -65,11 +65,11 @@ ok6:
TEXT ·Syscall9(SB),NOSPLIT,$0-104
CALL runtime·entersyscall(SB)
MOVQ 8(SP), AX
MOVQ 8(SP), AX // syscall entry
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
MOVQ 40(SP), R10
MOVQ 40(SP), R10
MOVQ 48(SP), R8
MOVQ 56(SP), R9
......@@ -86,7 +86,7 @@ TEXT ·Syscall9(SB),NOSPLIT,$0-104
JCC ok9
MOVQ $-1, 88(SP) // r1
MOVQ $0, 96(SP) // r2
MOVQ AX, 104(SP) // errno
MOVQ AX, 104(SP) // errno
CALL runtime·exitsyscall(SB)
RET
ok9:
......@@ -96,7 +96,7 @@ ok9:
CALL runtime·exitsyscall(SB)
RET
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
TEXT ·RawSyscall(SB),NOSPLIT,$0-56
MOVQ 16(SP), DI
MOVQ 24(SP), SI
MOVQ 32(SP), DX
......@@ -108,7 +108,7 @@ TEXT ·RawSyscall(SB),NOSPLIT,$0-56
JCC ok1
MOVQ $-1, 40(SP) // r1
MOVQ $0, 48(SP) // r2
MOVQ AX, 56(SP) // errno
MOVQ AX, 56(SP) // errno
RET
ok1:
MOVQ AX, 40(SP) // r1
......@@ -128,7 +128,7 @@ TEXT ·RawSyscall6(SB),NOSPLIT,$0-80
JCC ok2
MOVQ $-1, 64(SP) // r1
MOVQ $0, 72(SP) // r2
MOVQ AX, 80(SP) // errno
MOVQ AX, 80(SP) // errno
RET
ok2:
MOVQ AX, 64(SP) // r1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment