diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 19:25:22 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 19:25:22 +0000 |
commit | f6ad4dcef54c5ce997a4bad5a6d86de229015700 (patch) | |
tree | 7cfa4e31ace5c2bd95c72b154d15af494b2bcbef /src/syscall/asm_unix_386.s | |
parent | Initial commit. (diff) | |
download | golang-1.22-f6ad4dcef54c5ce997a4bad5a6d86de229015700.tar.xz golang-1.22-f6ad4dcef54c5ce997a4bad5a6d86de229015700.zip |
Adding upstream version 1.22.1.upstream/1.22.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/syscall/asm_unix_386.s')
-rw-r--r-- | src/syscall/asm_unix_386.s | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/src/syscall/asm_unix_386.s b/src/syscall/asm_unix_386.s new file mode 100644 index 0000000..2270019 --- /dev/null +++ b/src/syscall/asm_unix_386.s @@ -0,0 +1,142 @@ +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build freebsd || netbsd + +#include "textflag.h" +#include "funcdata.h" + +// +// System call support for some 386 unixes +// + +// 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); +// Trap # in AX, args on stack above caller pc. + +TEXT ·Syscall(SB),NOSPLIT,$0-28 + CALL runtime·entersyscall(SB) + MOVL trap+0(FP), AX // syscall entry + // slide args down on top of system call number + LEAL a1+4(FP), SI + LEAL trap+0(FP), DI + CLD + MOVSL + MOVSL + MOVSL + INT $0x80 + JAE ok + 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, 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 trap+0(FP), AX // syscall entry + // slide args down on top of system call number + LEAL a1+4(FP), SI + LEAL trap+0(FP), DI + CLD + MOVSL + MOVSL + MOVSL + MOVSL + MOVSL + MOVSL + INT $0x80 + JAE ok6 + 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, 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 num+0(FP), AX // syscall entry + // slide args down on top of system call number + LEAL a1+4(FP), SI + LEAL num+0(FP), DI + CLD + MOVSL + MOVSL + MOVSL + MOVSL + MOVSL + MOVSL + MOVSL + MOVSL + MOVSL + INT $0x80 + JAE ok9 + 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, 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 trap+0(FP), AX // syscall entry + // slide args down on top of system call number + LEAL a1+4(FP), SI + LEAL trap+0(FP), DI + CLD + MOVSL + MOVSL + MOVSL + INT $0x80 + JAE ok1 + MOVL $-1, r1+16(FP) // r1 + MOVL $-1, r2+20(FP) // r2 + MOVL AX, err+24(FP) // errno + RET +ok1: + 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 trap+0(FP), AX // syscall entry + // slide args down on top of system call number + LEAL a1+4(FP), SI + LEAL trap+0(FP), DI + CLD + MOVSL + MOVSL + MOVSL + MOVSL + MOVSL + MOVSL + INT $0x80 + JAE ok2 + MOVL $-1, r1+28(FP) // r1 + MOVL $-1, r2+32(FP) // r2 + MOVL AX, err+36(FP) // errno + RET +ok2: + MOVL AX, r1+28(FP) // r1 + MOVL DX, r2+32(FP) // r2 + MOVL $0, err+36(FP) // errno + RET |