mirror of
https://github.com/golang/go
synced 2024-11-11 22:10:22 -07:00
runtime,syscall: convert syscall on openbsd/arm to libc
Convert the syscall package on openbsd/arm to use libc rather than performing direct system calls. Updates #36435 Change-Id: Iff3a91c959292cbf4e0a09c7fd34efc8e88ff83f Reviewed-on: https://go-review.googlesource.com/c/go/+/315793 Trust: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
603f43cbae
commit
bedf2c4886
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build (openbsd && 386) || (openbsd && amd64) || (openbsd && arm64)
|
||||
// +build openbsd,386 openbsd,amd64 openbsd,arm64
|
||||
//go:build (openbsd && 386) || (openbsd && amd64) || (openbsd && arm) || (openbsd && arm64)
|
||||
// +build openbsd,386 openbsd,amd64 openbsd,arm openbsd,arm64
|
||||
|
||||
package runtime
|
||||
|
||||
|
@ -465,3 +465,342 @@ TEXT runtime·sigaltstack_trampoline(SB),NOSPLIT,$0
|
||||
MOVW R8, (R8)
|
||||
MOVW R9, R13
|
||||
RET
|
||||
|
||||
// syscall calls a function in libc on behalf of the syscall package.
|
||||
// syscall takes a pointer to a struct like:
|
||||
// struct {
|
||||
// fn uintptr
|
||||
// a1 uintptr
|
||||
// a2 uintptr
|
||||
// a3 uintptr
|
||||
// r1 uintptr
|
||||
// r2 uintptr
|
||||
// err uintptr
|
||||
// }
|
||||
// syscall must be called on the g0 stack with the
|
||||
// C calling convention (use libcCall).
|
||||
//
|
||||
// syscall expects a 32-bit result and tests for 32-bit -1
|
||||
// to decide there was an error.
|
||||
TEXT runtime·syscall(SB),NOSPLIT,$0
|
||||
MOVW R13, R9
|
||||
BIC $0x7, R13 // align for ELF ABI
|
||||
|
||||
MOVW R0, R8
|
||||
|
||||
MOVW (0*4)(R8), R7 // fn
|
||||
MOVW (1*4)(R8), R0 // a1
|
||||
MOVW (2*4)(R8), R1 // a2
|
||||
MOVW (3*4)(R8), R2 // a3
|
||||
|
||||
BL (R7)
|
||||
|
||||
MOVW R0, (4*4)(R8) // r1
|
||||
MOVW R1, (5*4)(R8) // r2
|
||||
|
||||
// Standard libc functions return -1 on error and set errno.
|
||||
CMP $-1, R0
|
||||
BNE ok
|
||||
|
||||
// Get error code from libc.
|
||||
BL libc_errno(SB)
|
||||
MOVW (R0), R1
|
||||
MOVW R1, (6*4)(R8) // err
|
||||
|
||||
ok:
|
||||
MOVW $0, R0 // no error (it's ignored anyway)
|
||||
MOVW R9, R13
|
||||
RET
|
||||
|
||||
// syscallX calls a function in libc on behalf of the syscall package.
|
||||
// syscallX takes a pointer to a struct like:
|
||||
// struct {
|
||||
// fn uintptr
|
||||
// a1 uintptr
|
||||
// a2 uintptr
|
||||
// a3 uintptr
|
||||
// r1 uintptr
|
||||
// r2 uintptr
|
||||
// err uintptr
|
||||
// }
|
||||
// syscallX must be called on the g0 stack with the
|
||||
// C calling convention (use libcCall).
|
||||
//
|
||||
// syscallX is like syscall but expects a 64-bit result
|
||||
// and tests for 64-bit -1 to decide there was an error.
|
||||
TEXT runtime·syscallX(SB),NOSPLIT,$0
|
||||
MOVW R13, R9
|
||||
BIC $0x7, R13 // align for ELF ABI
|
||||
|
||||
MOVW R0, R8
|
||||
|
||||
MOVW (0*4)(R8), R7 // fn
|
||||
MOVW (1*4)(R8), R0 // a1
|
||||
MOVW (2*4)(R8), R1 // a2
|
||||
MOVW (3*4)(R8), R2 // a3
|
||||
|
||||
BL (R7)
|
||||
|
||||
MOVW R0, (4*4)(R8) // r1
|
||||
MOVW R1, (5*4)(R8) // r2
|
||||
|
||||
// Standard libc functions return -1 on error and set errno.
|
||||
CMP $-1, R0
|
||||
BNE ok
|
||||
CMP $-1, R1
|
||||
BNE ok
|
||||
|
||||
// Get error code from libc.
|
||||
BL libc_errno(SB)
|
||||
MOVW (R0), R1
|
||||
MOVW R1, (6*4)(R8) // err
|
||||
|
||||
ok:
|
||||
MOVW $0, R0 // no error (it's ignored anyway)
|
||||
MOVW R9, R13
|
||||
RET
|
||||
|
||||
// syscall6 calls a function in libc on behalf of the syscall package.
|
||||
// syscall6 takes a pointer to a struct like:
|
||||
// struct {
|
||||
// fn uintptr
|
||||
// a1 uintptr
|
||||
// a2 uintptr
|
||||
// a3 uintptr
|
||||
// a4 uintptr
|
||||
// a5 uintptr
|
||||
// a6 uintptr
|
||||
// r1 uintptr
|
||||
// r2 uintptr
|
||||
// err uintptr
|
||||
// }
|
||||
// syscall6 must be called on the g0 stack with the
|
||||
// C calling convention (use libcCall).
|
||||
//
|
||||
// syscall6 expects a 32-bit result and tests for 32-bit -1
|
||||
// to decide there was an error.
|
||||
TEXT runtime·syscall6(SB),NOSPLIT,$0
|
||||
MOVW R13, R9
|
||||
SUB $8, R13
|
||||
BIC $0x7, R13 // align for ELF ABI
|
||||
|
||||
MOVW R0, R8
|
||||
|
||||
MOVW (0*4)(R8), R7 // fn
|
||||
MOVW (1*4)(R8), R0 // a1
|
||||
MOVW (2*4)(R8), R1 // a2
|
||||
MOVW (3*4)(R8), R2 // a3
|
||||
MOVW (4*4)(R8), R3 // a4
|
||||
MOVW (5*4)(R8), R4 // a5
|
||||
MOVW R4, 0(R13)
|
||||
MOVW (6*4)(R8), R5 // a6
|
||||
MOVW R5, 4(R13)
|
||||
|
||||
BL (R7)
|
||||
|
||||
MOVW R0, (7*4)(R8) // r1
|
||||
MOVW R1, (8*4)(R8) // r2
|
||||
|
||||
// Standard libc functions return -1 on error and set errno.
|
||||
CMP $-1, R0
|
||||
BNE ok
|
||||
|
||||
// Get error code from libc.
|
||||
BL libc_errno(SB)
|
||||
MOVW (R0), R1
|
||||
MOVW R1, (9*4)(R8) // err
|
||||
|
||||
ok:
|
||||
MOVW $0, R0 // no error (it's ignored anyway)
|
||||
MOVW R9, R13
|
||||
RET
|
||||
|
||||
// syscall6X calls a function in libc on behalf of the syscall package.
|
||||
// syscall6X takes a pointer to a struct like:
|
||||
// struct {
|
||||
// fn uintptr
|
||||
// a1 uintptr
|
||||
// a2 uintptr
|
||||
// a3 uintptr
|
||||
// a4 uintptr
|
||||
// a5 uintptr
|
||||
// a6 uintptr
|
||||
// r1 uintptr
|
||||
// r2 uintptr
|
||||
// err uintptr
|
||||
// }
|
||||
// syscall6X must be called on the g0 stack with the
|
||||
// C calling convention (use libcCall).
|
||||
//
|
||||
// syscall6X is like syscall6 but expects a 64-bit result
|
||||
// and tests for 64-bit -1 to decide there was an error.
|
||||
TEXT runtime·syscall6X(SB),NOSPLIT,$0
|
||||
MOVW R13, R9
|
||||
SUB $8, R13
|
||||
BIC $0x7, R13 // align for ELF ABI
|
||||
|
||||
MOVW R0, R8
|
||||
|
||||
MOVW (0*4)(R8), R7 // fn
|
||||
MOVW (1*4)(R8), R0 // a1
|
||||
MOVW (2*4)(R8), R1 // a2
|
||||
MOVW (3*4)(R8), R2 // a3
|
||||
MOVW (4*4)(R8), R3 // a4
|
||||
MOVW (5*4)(R8), R4 // a5
|
||||
MOVW R4, 0(R13)
|
||||
MOVW (6*4)(R8), R5 // a6
|
||||
MOVW R5, 4(R13)
|
||||
|
||||
BL (R7)
|
||||
|
||||
MOVW R0, (7*4)(R8) // r1
|
||||
MOVW R1, (8*4)(R8) // r2
|
||||
|
||||
// Standard libc functions return -1 on error and set errno.
|
||||
CMP $-1, R0
|
||||
BNE ok
|
||||
CMP $-1, R1
|
||||
BNE ok
|
||||
|
||||
// Get error code from libc.
|
||||
BL libc_errno(SB)
|
||||
MOVW (R0), R1
|
||||
MOVW R1, (9*4)(R8) // err
|
||||
|
||||
ok:
|
||||
MOVW $0, R0 // no error (it's ignored anyway)
|
||||
MOVW R9, R13
|
||||
RET
|
||||
|
||||
// syscall10 calls a function in libc on behalf of the syscall package.
|
||||
// syscall10 takes a pointer to a struct like:
|
||||
// struct {
|
||||
// fn uintptr
|
||||
// a1 uintptr
|
||||
// a2 uintptr
|
||||
// a3 uintptr
|
||||
// a4 uintptr
|
||||
// a5 uintptr
|
||||
// a6 uintptr
|
||||
// a7 uintptr
|
||||
// a8 uintptr
|
||||
// a9 uintptr
|
||||
// a10 uintptr
|
||||
// r1 uintptr
|
||||
// r2 uintptr
|
||||
// err uintptr
|
||||
// }
|
||||
// syscall10 must be called on the g0 stack with the
|
||||
// C calling convention (use libcCall).
|
||||
TEXT runtime·syscall10(SB),NOSPLIT,$0
|
||||
MOVW R13, R9
|
||||
SUB $24, R13
|
||||
BIC $0x7, R13 // align for ELF ABI
|
||||
|
||||
MOVW R0, R8
|
||||
|
||||
MOVW (0*4)(R8), R7 // fn
|
||||
MOVW (1*4)(R8), R0 // a1
|
||||
MOVW (2*4)(R8), R1 // a2
|
||||
MOVW (3*4)(R8), R2 // a3
|
||||
MOVW (4*4)(R8), R3 // a4
|
||||
MOVW (5*4)(R8), R4 // a5
|
||||
MOVW R4, 0(R13)
|
||||
MOVW (6*4)(R8), R5 // a6
|
||||
MOVW R5, 4(R13)
|
||||
MOVW (7*4)(R8), R6 // a7
|
||||
MOVW R6, 8(R13)
|
||||
MOVW (8*4)(R8), R4 // a8
|
||||
MOVW R4, 12(R13)
|
||||
MOVW (9*4)(R8), R5 // a9
|
||||
MOVW R5, 16(R13)
|
||||
MOVW (10*4)(R8), R6 // a10
|
||||
MOVW R6, 20(R13)
|
||||
|
||||
BL (R7)
|
||||
|
||||
MOVW R0, (11*4)(R8) // r1
|
||||
MOVW R1, (12*4)(R8) // r2
|
||||
|
||||
// Standard libc functions return -1 on error and set errno.
|
||||
CMP $-1, R0
|
||||
BNE ok
|
||||
|
||||
// Get error code from libc.
|
||||
BL libc_errno(SB)
|
||||
MOVW (R0), R1
|
||||
MOVW R1, (13*4)(R8) // err
|
||||
|
||||
ok:
|
||||
MOVW $0, R0 // no error (it's ignored anyway)
|
||||
MOVW R9, R13
|
||||
RET
|
||||
|
||||
// syscall10X calls a function in libc on behalf of the syscall package.
|
||||
// syscall10X takes a pointer to a struct like:
|
||||
// struct {
|
||||
// fn uintptr
|
||||
// a1 uintptr
|
||||
// a2 uintptr
|
||||
// a3 uintptr
|
||||
// a4 uintptr
|
||||
// a5 uintptr
|
||||
// a6 uintptr
|
||||
// a7 uintptr
|
||||
// a8 uintptr
|
||||
// a9 uintptr
|
||||
// a10 uintptr
|
||||
// r1 uintptr
|
||||
// r2 uintptr
|
||||
// err uintptr
|
||||
// }
|
||||
// syscall10X must be called on the g0 stack with the
|
||||
// C calling convention (use libcCall).
|
||||
//
|
||||
// syscall10X is like syscall10 but expects a 64-bit result
|
||||
// and tests for 64-bit -1 to decide there was an error.
|
||||
TEXT runtime·syscall10X(SB),NOSPLIT,$0
|
||||
MOVW R13, R9
|
||||
SUB $24, R13
|
||||
BIC $0x7, R13 // align for ELF ABI
|
||||
|
||||
MOVW R0, R8
|
||||
|
||||
MOVW (0*4)(R8), R7 // fn
|
||||
MOVW (1*4)(R8), R0 // a1
|
||||
MOVW (2*4)(R8), R1 // a2
|
||||
MOVW (3*4)(R8), R2 // a3
|
||||
MOVW (4*4)(R8), R3 // a4
|
||||
MOVW (5*4)(R8), R4 // a5
|
||||
MOVW R4, 0(R13)
|
||||
MOVW (6*4)(R8), R5 // a6
|
||||
MOVW R5, 4(R13)
|
||||
MOVW (7*4)(R8), R6 // a7
|
||||
MOVW R6, 8(R13)
|
||||
MOVW (8*4)(R8), R4 // a8
|
||||
MOVW R4, 12(R13)
|
||||
MOVW (9*4)(R8), R5 // a9
|
||||
MOVW R5, 16(R13)
|
||||
MOVW (10*4)(R8), R6 // a10
|
||||
MOVW R6, 20(R13)
|
||||
|
||||
BL (R7)
|
||||
|
||||
MOVW R0, (11*4)(R8) // r1
|
||||
MOVW R1, (12*4)(R8) // r2
|
||||
|
||||
// Standard libc functions return -1 on error and set errno.
|
||||
CMP $-1, R0
|
||||
BNE ok
|
||||
CMP $-1, R1
|
||||
BNE ok
|
||||
|
||||
// Get error code from libc.
|
||||
BL libc_errno(SB)
|
||||
MOVW (R0), R1
|
||||
MOVW R1, (13*4)(R8) // err
|
||||
|
||||
ok:
|
||||
MOVW $0, R0 // no error (it's ignored anyway)
|
||||
MOVW R9, R13
|
||||
RET
|
||||
|
@ -3,137 +3,30 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
#include "textflag.h"
|
||||
#include "funcdata.h"
|
||||
|
||||
//
|
||||
// System call support for ARM, OpenBSD
|
||||
//
|
||||
|
||||
// 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 RawSyscall(trap int32, a1, a2, a3 int32) (r1, r2, err int32);
|
||||
// func RawSyscall6(trap int32, a1, a2, a3, a4, a5, a6 int32) (r1, r2, err int32);
|
||||
|
||||
// See comment in runtime/sys_openbsd_arm.s re this construction.
|
||||
#define NOOP MOVW R0, R0
|
||||
#define INVOKE_SYSCALL \
|
||||
SWI $0; \
|
||||
NOOP; \
|
||||
NOOP
|
||||
// Provide these function names via assembly so they are provided as ABI0,
|
||||
// rather than ABIInternal.
|
||||
|
||||
// func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
||||
TEXT ·Syscall(SB),NOSPLIT,$0-28
|
||||
BL runtime·entersyscall(SB)
|
||||
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
|
||||
INVOKE_SYSCALL
|
||||
MOVW $0, R2
|
||||
BCS error
|
||||
MOVW R0, r1+16(FP) // ret 1
|
||||
MOVW R1, r2+20(FP) // ret 2
|
||||
MOVW R2, err+24(FP) // err
|
||||
BL runtime·exitsyscall(SB)
|
||||
RET
|
||||
error:
|
||||
MOVW $-1, R3
|
||||
MOVW R3, r1+16(FP) // ret 1
|
||||
MOVW R2, r2+20(FP) // ret 2
|
||||
MOVW R0, err+24(FP) // err
|
||||
BL runtime·exitsyscall(SB)
|
||||
RET
|
||||
JMP ·syscallInternal(SB)
|
||||
|
||||
// func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||
TEXT ·Syscall6(SB),NOSPLIT,$0-40
|
||||
BL runtime·entersyscall(SB)
|
||||
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
|
||||
MOVW a4+16(FP), R3 // arg 4
|
||||
MOVW R13, R4
|
||||
MOVW $a5+20(FP), R13 // arg 5 to arg 6 are passed on stack
|
||||
INVOKE_SYSCALL
|
||||
MOVW R4, R13
|
||||
MOVW $0, R2
|
||||
BCS error6
|
||||
MOVW R0, r1+28(FP) // ret 1
|
||||
MOVW R1, r2+32(FP) // ret 2
|
||||
MOVW R2, err+36(FP) // err
|
||||
BL runtime·exitsyscall(SB)
|
||||
RET
|
||||
error6:
|
||||
MOVW $-1, R3
|
||||
MOVW R3, r1+28(FP) // ret 1
|
||||
MOVW R2, r2+32(FP) // ret 2
|
||||
MOVW R0, err+36(FP) // err
|
||||
BL runtime·exitsyscall(SB)
|
||||
RET
|
||||
|
||||
TEXT ·Syscall9(SB),NOSPLIT,$0-52
|
||||
BL runtime·entersyscall(SB)
|
||||
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
|
||||
MOVW a4+16(FP), R3 // arg 4
|
||||
MOVW R13, R4
|
||||
MOVW $a5+20(FP), R13 // arg 5 to arg 9 are passed on stack
|
||||
INVOKE_SYSCALL
|
||||
MOVW R4, R13
|
||||
MOVW $0, R2
|
||||
BCS error9
|
||||
MOVW R0, r1+40(FP) // ret 1
|
||||
MOVW R1, r2+44(FP) // ret 2
|
||||
MOVW R2, err+48(FP) // err
|
||||
BL runtime·exitsyscall(SB)
|
||||
RET
|
||||
error9:
|
||||
MOVW $-1, R3
|
||||
MOVW R3, r1+40(FP) // ret 1
|
||||
MOVW R2, r2+44(FP) // ret 2
|
||||
MOVW R0, err+48(FP) // err
|
||||
BL runtime·exitsyscall(SB)
|
||||
RET
|
||||
JMP ·syscall6Internal(SB)
|
||||
|
||||
// func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno)
|
||||
TEXT ·RawSyscall(SB),NOSPLIT,$0-28
|
||||
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
|
||||
INVOKE_SYSCALL
|
||||
MOVW $0, R2
|
||||
BCS errorr
|
||||
MOVW R0, r1+16(FP) // ret 1
|
||||
MOVW R1, r2+20(FP) // ret 2
|
||||
MOVW R2, err+24(FP) // err
|
||||
RET
|
||||
errorr:
|
||||
MOVW $-1, R3
|
||||
MOVW R3, r1+16(FP) // ret 1
|
||||
MOVW R2, r2+20(FP) // ret 2
|
||||
MOVW R0, err+24(FP) // err
|
||||
RET
|
||||
JMP ·rawSyscallInternal(SB)
|
||||
|
||||
// func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno)
|
||||
TEXT ·RawSyscall6(SB),NOSPLIT,$0-40
|
||||
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
|
||||
MOVW a4+16(FP), R3 // arg 4
|
||||
MOVW R13, R4
|
||||
MOVW $a5+20(FP), R13 // arg 5 to arg 6 are passed on stack
|
||||
INVOKE_SYSCALL
|
||||
MOVW R4, R13
|
||||
MOVW $0, R2
|
||||
BCS errorr6
|
||||
MOVW R0, r1+28(FP) // ret 1
|
||||
MOVW R1, r2+32(FP) // ret 2
|
||||
MOVW R2, err+36(FP) // err
|
||||
RET
|
||||
errorr6:
|
||||
MOVW $-1, R3
|
||||
MOVW R3, r1+28(FP) // ret 1
|
||||
MOVW R2, r2+32(FP) // ret 2
|
||||
MOVW R0, err+36(FP) // err
|
||||
RET
|
||||
JMP ·rawSyscall6Internal(SB)
|
||||
|
||||
// func Syscall9(trap, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err Errno)
|
||||
TEXT ·Syscall9(SB),NOSPLIT,$0-52
|
||||
JMP ·syscall9Internal(SB)
|
||||
|
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build dragonfly || freebsd || netbsd || (openbsd && !386 && !amd64 && !arm64)
|
||||
// +build dragonfly freebsd netbsd openbsd,!386,!amd64,!arm64
|
||||
//go:build dragonfly || freebsd || netbsd || (openbsd && !386 && !amd64 && !arm && !arm64)
|
||||
// +build dragonfly freebsd netbsd openbsd,!386,!amd64,!arm,!arm64
|
||||
|
||||
package syscall
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build darwin || (openbsd && 386) || (openbsd && amd64) || (openbsd && arm64)
|
||||
// +build darwin openbsd,386 openbsd,amd64 openbsd,arm64
|
||||
//go:build darwin || (openbsd && 386) || (openbsd && amd64) || (openbsd && arm) || (openbsd && arm64)
|
||||
// +build darwin openbsd,386 openbsd,amd64 openbsd,arm openbsd,arm64
|
||||
|
||||
package syscall
|
||||
|
||||
|
@ -301,7 +301,7 @@ func Exec(argv0 string, argv []string, envv []string) (err error) {
|
||||
} else if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
|
||||
// Similarly on Darwin.
|
||||
err1 = execveDarwin(argv0p, &argvp[0], &envvp[0])
|
||||
} else if runtime.GOOS == "openbsd" && (runtime.GOARCH == "386" || runtime.GOARCH == "amd64" || runtime.GOARCH == "arm64") {
|
||||
} else if runtime.GOOS == "openbsd" && (runtime.GOARCH == "386" || runtime.GOARCH == "amd64" || runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") {
|
||||
// Similarly on OpenBSD.
|
||||
err1 = execveOpenBSD(argv0p, &argvp[0], &envvp[0])
|
||||
} else {
|
||||
|
@ -303,15 +303,16 @@ openbsd_amd64)
|
||||
mkasm="go run mkasm.go"
|
||||
;;
|
||||
openbsd_arm)
|
||||
GOOSARCH_in="syscall_openbsd1.go syscall_openbsd_$GOARCH.go"
|
||||
GOOSARCH_in="syscall_openbsd_libc.go syscall_openbsd_$GOARCH.go"
|
||||
mkerrors="$mkerrors"
|
||||
mksyscall="./mksyscall.pl -l32 -openbsd -arm"
|
||||
mksyscall="./mksyscall.pl -l32 -openbsd -arm -libc"
|
||||
mksysctl="./mksysctl_openbsd.pl"
|
||||
zsysctl="zsysctl_openbsd.go"
|
||||
mksysnum="curl -s 'http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master' | ./mksysnum_openbsd.pl"
|
||||
# Let the type of C char be signed to make the bare syscall
|
||||
# API consistent between platforms.
|
||||
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
|
||||
mkasm="go run mkasm.go"
|
||||
;;
|
||||
openbsd_arm64)
|
||||
GOOSARCH_in="syscall_openbsd_libc.go syscall_openbsd_$GOARCH.go"
|
||||
|
@ -191,6 +191,10 @@ while(<>) {
|
||||
if (!$libc) {
|
||||
push @args, "0";
|
||||
}
|
||||
if($libc && $arm && @args % 2) {
|
||||
# arm abi specifies 64 bit argument must be 64 bit aligned.
|
||||
push @args, "0"
|
||||
}
|
||||
if($_32bit eq "big-endian") {
|
||||
push @args, "uintptr($name>>32)", "uintptr($name)";
|
||||
} elsif($_32bit eq "little-endian") {
|
||||
|
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build openbsd && !386 && !amd64 && !arm64
|
||||
// +build openbsd,!386,!amd64,!arm64
|
||||
//go:build openbsd && !386 && !amd64 && !arm && !arm64
|
||||
// +build openbsd,!386,!amd64,!arm,!arm64
|
||||
|
||||
package syscall
|
||||
|
||||
|
@ -2,8 +2,8 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build (openbsd && 386) || (openbsd && amd64) || (openbsd && arm64)
|
||||
// +build openbsd,386 openbsd,amd64 openbsd,arm64
|
||||
//go:build (openbsd && 386) || (openbsd && amd64) || (openbsd && arm) || (openbsd && arm64)
|
||||
// +build openbsd,386 openbsd,amd64 openbsd,arm openbsd,arm64
|
||||
|
||||
package syscall
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
233
src/syscall/zsyscall_openbsd_arm.s
Normal file
233
src/syscall/zsyscall_openbsd_arm.s
Normal file
@ -0,0 +1,233 @@
|
||||
// go run mkasm.go openbsd arm
|
||||
// Code generated by the command above; DO NOT EDIT.
|
||||
#include "textflag.h"
|
||||
TEXT ·libc_getgroups_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getgroups(SB)
|
||||
TEXT ·libc_setgroups_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setgroups(SB)
|
||||
TEXT ·libc_wait4_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_wait4(SB)
|
||||
TEXT ·libc_accept_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_accept(SB)
|
||||
TEXT ·libc_bind_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_bind(SB)
|
||||
TEXT ·libc_connect_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_connect(SB)
|
||||
TEXT ·libc_socket_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_socket(SB)
|
||||
TEXT ·libc_getsockopt_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getsockopt(SB)
|
||||
TEXT ·libc_setsockopt_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setsockopt(SB)
|
||||
TEXT ·libc_getpeername_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getpeername(SB)
|
||||
TEXT ·libc_getsockname_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getsockname(SB)
|
||||
TEXT ·libc_shutdown_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_shutdown(SB)
|
||||
TEXT ·libc_socketpair_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_socketpair(SB)
|
||||
TEXT ·libc_recvfrom_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_recvfrom(SB)
|
||||
TEXT ·libc_sendto_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_sendto(SB)
|
||||
TEXT ·libc_recvmsg_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_recvmsg(SB)
|
||||
TEXT ·libc_sendmsg_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_sendmsg(SB)
|
||||
TEXT ·libc_kevent_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_kevent(SB)
|
||||
TEXT ·libc_utimes_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_utimes(SB)
|
||||
TEXT ·libc_futimes_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_futimes(SB)
|
||||
TEXT ·libc_fcntl_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fcntl(SB)
|
||||
TEXT ·libc_pipe2_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_pipe2(SB)
|
||||
TEXT ·libc_accept4_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_accept4(SB)
|
||||
TEXT ·libc_getdents_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getdents(SB)
|
||||
TEXT ·libc_access_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_access(SB)
|
||||
TEXT ·libc_adjtime_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_adjtime(SB)
|
||||
TEXT ·libc_chdir_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_chdir(SB)
|
||||
TEXT ·libc_chflags_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_chflags(SB)
|
||||
TEXT ·libc_chmod_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_chmod(SB)
|
||||
TEXT ·libc_chown_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_chown(SB)
|
||||
TEXT ·libc_chroot_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_chroot(SB)
|
||||
TEXT ·libc_close_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_close(SB)
|
||||
TEXT ·libc_dup_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_dup(SB)
|
||||
TEXT ·libc_dup2_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_dup2(SB)
|
||||
TEXT ·libc_fchdir_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fchdir(SB)
|
||||
TEXT ·libc_fchflags_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fchflags(SB)
|
||||
TEXT ·libc_fchmod_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fchmod(SB)
|
||||
TEXT ·libc_fchown_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fchown(SB)
|
||||
TEXT ·libc_flock_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_flock(SB)
|
||||
TEXT ·libc_fpathconf_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fpathconf(SB)
|
||||
TEXT ·libc_fstat_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fstat(SB)
|
||||
TEXT ·libc_fstatfs_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fstatfs(SB)
|
||||
TEXT ·libc_fsync_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fsync(SB)
|
||||
TEXT ·libc_ftruncate_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_ftruncate(SB)
|
||||
TEXT ·libc_getegid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getegid(SB)
|
||||
TEXT ·libc_geteuid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_geteuid(SB)
|
||||
TEXT ·libc_getgid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getgid(SB)
|
||||
TEXT ·libc_getpgid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getpgid(SB)
|
||||
TEXT ·libc_getpgrp_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getpgrp(SB)
|
||||
TEXT ·libc_getpid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getpid(SB)
|
||||
TEXT ·libc_getppid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getppid(SB)
|
||||
TEXT ·libc_getpriority_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getpriority(SB)
|
||||
TEXT ·libc_getrlimit_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getrlimit(SB)
|
||||
TEXT ·libc_getrusage_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getrusage(SB)
|
||||
TEXT ·libc_getsid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getsid(SB)
|
||||
TEXT ·libc_gettimeofday_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_gettimeofday(SB)
|
||||
TEXT ·libc_getuid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getuid(SB)
|
||||
TEXT ·libc_issetugid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_issetugid(SB)
|
||||
TEXT ·libc_kill_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_kill(SB)
|
||||
TEXT ·libc_kqueue_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_kqueue(SB)
|
||||
TEXT ·libc_lchown_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_lchown(SB)
|
||||
TEXT ·libc_link_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_link(SB)
|
||||
TEXT ·libc_listen_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_listen(SB)
|
||||
TEXT ·libc_lstat_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_lstat(SB)
|
||||
TEXT ·libc_mkdir_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_mkdir(SB)
|
||||
TEXT ·libc_mkfifo_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_mkfifo(SB)
|
||||
TEXT ·libc_mknod_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_mknod(SB)
|
||||
TEXT ·libc_nanosleep_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_nanosleep(SB)
|
||||
TEXT ·libc_open_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_open(SB)
|
||||
TEXT ·libc_pathconf_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_pathconf(SB)
|
||||
TEXT ·libc_pread_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_pread(SB)
|
||||
TEXT ·libc_pwrite_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_pwrite(SB)
|
||||
TEXT ·libc_read_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_read(SB)
|
||||
TEXT ·libc_readlink_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_readlink(SB)
|
||||
TEXT ·libc_rename_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_rename(SB)
|
||||
TEXT ·libc_revoke_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_revoke(SB)
|
||||
TEXT ·libc_rmdir_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_rmdir(SB)
|
||||
TEXT ·libc_select_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_select(SB)
|
||||
TEXT ·libc_setegid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setegid(SB)
|
||||
TEXT ·libc_seteuid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_seteuid(SB)
|
||||
TEXT ·libc_setgid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setgid(SB)
|
||||
TEXT ·libc_setlogin_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setlogin(SB)
|
||||
TEXT ·libc_setpgid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setpgid(SB)
|
||||
TEXT ·libc_setpriority_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setpriority(SB)
|
||||
TEXT ·libc_setregid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setregid(SB)
|
||||
TEXT ·libc_setreuid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setreuid(SB)
|
||||
TEXT ·libc_setrlimit_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setrlimit(SB)
|
||||
TEXT ·libc_setsid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setsid(SB)
|
||||
TEXT ·libc_settimeofday_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_settimeofday(SB)
|
||||
TEXT ·libc_setuid_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_setuid(SB)
|
||||
TEXT ·libc_stat_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_stat(SB)
|
||||
TEXT ·libc_statfs_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_statfs(SB)
|
||||
TEXT ·libc_symlink_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_symlink(SB)
|
||||
TEXT ·libc_sync_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_sync(SB)
|
||||
TEXT ·libc_truncate_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_truncate(SB)
|
||||
TEXT ·libc_umask_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_umask(SB)
|
||||
TEXT ·libc_unlink_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_unlink(SB)
|
||||
TEXT ·libc_unmount_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_unmount(SB)
|
||||
TEXT ·libc_write_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_write(SB)
|
||||
TEXT ·libc_mmap_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_mmap(SB)
|
||||
TEXT ·libc_munmap_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_munmap(SB)
|
||||
TEXT ·libc_utimensat_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_utimensat(SB)
|
||||
TEXT ·libc_syscall_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_syscall(SB)
|
||||
TEXT ·libc_lseek_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_lseek(SB)
|
||||
TEXT ·libc_getcwd_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getcwd(SB)
|
||||
TEXT ·libc_sysctl_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_sysctl(SB)
|
||||
TEXT ·libc_fork_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fork(SB)
|
||||
TEXT ·libc_ioctl_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_ioctl(SB)
|
||||
TEXT ·libc_execve_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_execve(SB)
|
||||
TEXT ·libc_exit_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_exit(SB)
|
||||
TEXT ·libc_ptrace_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_ptrace(SB)
|
||||
TEXT ·libc_getentropy_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_getentropy(SB)
|
||||
TEXT ·libc_fstatat_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_fstatat(SB)
|
||||
TEXT ·libc_unlinkat_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_unlinkat(SB)
|
||||
TEXT ·libc_openat_trampoline(SB),NOSPLIT,$0-0
|
||||
JMP libc_openat(SB)
|
Loading…
Reference in New Issue
Block a user