github.com/epfl-dcsl/gotee@v0.0.0-20200909122901-014b35f5e5e9/src/syscall/asm_unix_amd64.s (about) 1 // +build netbsd freebsd openbsd dragonfly 2 3 // Copyright 2009 The Go Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 7 #include "textflag.h" 8 #include "funcdata.h" 9 10 // 11 // System call support for AMD64 unixes 12 // 13 14 // func Syscall(trap int64, a1, a2, a3 int64) (r1, r2, err int64) 15 // func Syscall6(trap int64, a1, a2, a3, a4, a5, a6 int64) (r1, r2, err int64) 16 // Trap # in AX, args in DI SI DX, return in AX DX 17 18 TEXT ·Syscall(SB),NOSPLIT,$0-56 19 CALL runtime·entersyscall(SB) 20 MOVQ trap+0(FP), AX // syscall entry 21 MOVQ a1+8(FP), DI 22 MOVQ a2+16(FP), SI 23 MOVQ a3+24(FP), DX 24 MOVQ $0, R10 25 MOVQ $0, R8 26 MOVQ $0, R9 27 SYSCALL 28 JCC ok 29 MOVQ $-1, r1+32(FP) // r1 30 MOVQ $0, r2+40(FP) // r2 31 MOVQ AX, err+48(FP) // errno 32 CALL runtime·exitsyscall(SB) 33 RET 34 ok: 35 MOVQ AX, r1+32(FP) // r1 36 MOVQ DX, r2+40(FP) // r2 37 MOVQ $0, err+48(FP) // errno 38 CALL runtime·exitsyscall(SB) 39 RET 40 41 TEXT ·Syscall6(SB),NOSPLIT,$0-80 42 CALL runtime·entersyscall(SB) 43 MOVQ trap+0(FP), AX // syscall entry 44 MOVQ a1+8(FP), DI 45 MOVQ a2+16(FP), SI 46 MOVQ a3+24(FP), DX 47 MOVQ a4+32(FP), R10 48 MOVQ a5+40(FP), R8 49 MOVQ a6+48(FP), R9 50 SYSCALL 51 JCC ok6 52 MOVQ $-1, r1+56(FP) // r1 53 MOVQ $0, r2+64(FP) // r2 54 MOVQ AX, err+72(FP) // errno 55 CALL runtime·exitsyscall(SB) 56 RET 57 ok6: 58 MOVQ AX, r1+56(FP) // r1 59 MOVQ DX, r2+64(FP) // r2 60 MOVQ $0, err+72(FP) // errno 61 CALL runtime·exitsyscall(SB) 62 RET 63 64 TEXT ·RawSyscall(SB),NOSPLIT,$0-56 65 MOVQ a1+8(FP), DI 66 MOVQ a2+16(FP), SI 67 MOVQ a3+24(FP), DX 68 MOVQ $0, R10 69 MOVQ $0, R8 70 MOVQ $0, R9 71 MOVQ trap+0(FP), AX // syscall entry 72 SYSCALL 73 JCC ok1 74 MOVQ $-1, r1+32(FP) // r1 75 MOVQ $0, r2+40(FP) // r2 76 MOVQ AX, err+48(FP) // errno 77 RET 78 ok1: 79 MOVQ AX, r1+32(FP) // r1 80 MOVQ DX, r2+40(FP) // r2 81 MOVQ $0, err+48(FP) // errno 82 RET 83 84 TEXT ·RawSyscall6(SB),NOSPLIT,$0-80 85 MOVQ a1+8(FP), DI 86 MOVQ a2+16(FP), SI 87 MOVQ a3+24(FP), DX 88 MOVQ a4+32(FP), R10 89 MOVQ a5+40(FP), R8 90 MOVQ a6+48(FP), R9 91 MOVQ trap+0(FP), AX // syscall entry 92 SYSCALL 93 JCC ok2 94 MOVQ $-1, r1+56(FP) // r1 95 MOVQ $0, r2+64(FP) // r2 96 MOVQ AX, err+72(FP) // errno 97 RET 98 ok2: 99 MOVQ AX, r1+56(FP) // r1 100 MOVQ DX, r2+64(FP) // r2 101 MOVQ $0, err+72(FP) // errno 102 RET