mirror of
https://github.com/golang/go
synced 2024-11-02 11:50:30 +00:00
runtime: add symbolic constants for freebsd/386 syscalls
Brings freebsd/386 on par with other OSes/archs. Updates #53479 Change-Id: I16a7d051233e06e589b19919e68f07b6bf92f73c Reviewed-on: https://go-review.googlesource.com/c/go/+/413365 TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com>
This commit is contained in:
parent
e1b62efaf3
commit
848febdcec
1 changed files with 71 additions and 35 deletions
|
@ -10,8 +10,44 @@
|
|||
#include "go_tls.h"
|
||||
#include "textflag.h"
|
||||
|
||||
#define CLOCK_REALTIME 0
|
||||
#define CLOCK_MONOTONIC 4
|
||||
#define FD_CLOEXEC 1
|
||||
#define F_SETFD 2
|
||||
|
||||
#define SYS_exit 1
|
||||
#define SYS_read 3
|
||||
#define SYS_write 4
|
||||
#define SYS_open 5
|
||||
#define SYS_close 6
|
||||
#define SYS_getpid 20
|
||||
#define SYS_kill 37
|
||||
#define SYS_sigaltstack 53
|
||||
#define SYS_munmap 73
|
||||
#define SYS_madvise 75
|
||||
#define SYS_setitimer 83
|
||||
#define SYS_fcntl 92
|
||||
#define SYS_sysarch 165
|
||||
#define SYS___sysctl 202
|
||||
#define SYS_clock_gettime 232
|
||||
#define SYS_nanosleep 240
|
||||
#define SYS_sched_yield 331
|
||||
#define SYS_sigprocmask 340
|
||||
#define SYS_kqueue 362
|
||||
#define SYS_kevent 363
|
||||
#define SYS_sigaction 416
|
||||
#define SYS_sigreturn 417
|
||||
#define SYS_thr_exit 431
|
||||
#define SYS_thr_self 432
|
||||
#define SYS_thr_kill 433
|
||||
#define SYS__umtx_op 454
|
||||
#define SYS_thr_new 455
|
||||
#define SYS_mmap 477
|
||||
#define SYS_cpuset_getaffinity 487
|
||||
#define SYS_pipe2 542
|
||||
|
||||
TEXT runtime·sys_umtx_op(SB),NOSPLIT,$-4
|
||||
MOVL $454, AX
|
||||
MOVL $SYS__umtx_op, AX
|
||||
INT $0x80
|
||||
JAE 2(PC)
|
||||
NEGL AX
|
||||
|
@ -19,7 +55,7 @@ TEXT runtime·sys_umtx_op(SB),NOSPLIT,$-4
|
|||
RET
|
||||
|
||||
TEXT runtime·thr_new(SB),NOSPLIT,$-4
|
||||
MOVL $455, AX
|
||||
MOVL $SYS_thr_new, AX
|
||||
INT $0x80
|
||||
JAE 2(PC)
|
||||
NEGL AX
|
||||
|
@ -54,7 +90,7 @@ TEXT runtime·thr_start(SB),NOSPLIT,$0
|
|||
|
||||
// Exit the entire program (like C exit)
|
||||
TEXT runtime·exit(SB),NOSPLIT,$-4
|
||||
MOVL $1, AX
|
||||
MOVL $SYS_exit, AX
|
||||
INT $0x80
|
||||
MOVL $0xf1, 0xf1 // crash
|
||||
RET
|
||||
|
@ -72,13 +108,13 @@ TEXT runtime·exitThread(SB),NOSPLIT,$0-4
|
|||
// on the stack. We want to pass 0, so switch over to a fake
|
||||
// stack of 0s. It won't write to the stack.
|
||||
MOVL $exitStack<>(SB), SP
|
||||
MOVL $431, AX // thr_exit
|
||||
MOVL $SYS_thr_exit, AX
|
||||
INT $0x80
|
||||
MOVL $0xf1, 0xf1 // crash
|
||||
JMP 0(PC)
|
||||
|
||||
TEXT runtime·open(SB),NOSPLIT,$-4
|
||||
MOVL $5, AX
|
||||
MOVL $SYS_open, AX
|
||||
INT $0x80
|
||||
JAE 2(PC)
|
||||
MOVL $-1, AX
|
||||
|
@ -86,7 +122,7 @@ TEXT runtime·open(SB),NOSPLIT,$-4
|
|||
RET
|
||||
|
||||
TEXT runtime·closefd(SB),NOSPLIT,$-4
|
||||
MOVL $6, AX
|
||||
MOVL $SYS_close, AX
|
||||
INT $0x80
|
||||
JAE 2(PC)
|
||||
MOVL $-1, AX
|
||||
|
@ -94,7 +130,7 @@ TEXT runtime·closefd(SB),NOSPLIT,$-4
|
|||
RET
|
||||
|
||||
TEXT runtime·read(SB),NOSPLIT,$-4
|
||||
MOVL $3, AX
|
||||
MOVL $SYS_read, AX
|
||||
INT $0x80
|
||||
JAE 2(PC)
|
||||
NEGL AX // caller expects negative errno
|
||||
|
@ -103,7 +139,7 @@ TEXT runtime·read(SB),NOSPLIT,$-4
|
|||
|
||||
// func pipe2(flags int32) (r, w int32, errno int32)
|
||||
TEXT runtime·pipe2(SB),NOSPLIT,$12-16
|
||||
MOVL $542, AX
|
||||
MOVL $SYS_pipe2, AX
|
||||
LEAL r+4(FP), BX
|
||||
MOVL BX, 4(SP)
|
||||
MOVL flags+0(FP), BX
|
||||
|
@ -115,7 +151,7 @@ TEXT runtime·pipe2(SB),NOSPLIT,$12-16
|
|||
RET
|
||||
|
||||
TEXT runtime·write1(SB),NOSPLIT,$-4
|
||||
MOVL $4, AX
|
||||
MOVL $SYS_write, AX
|
||||
INT $0x80
|
||||
JAE 2(PC)
|
||||
NEGL AX // caller expects negative errno
|
||||
|
@ -126,25 +162,25 @@ TEXT runtime·thr_self(SB),NOSPLIT,$8-4
|
|||
// thr_self(&0(FP))
|
||||
LEAL ret+0(FP), AX
|
||||
MOVL AX, 4(SP)
|
||||
MOVL $432, AX
|
||||
MOVL $SYS_thr_self, AX
|
||||
INT $0x80
|
||||
RET
|
||||
|
||||
TEXT runtime·thr_kill(SB),NOSPLIT,$-4
|
||||
// thr_kill(tid, sig)
|
||||
MOVL $433, AX
|
||||
MOVL $SYS_thr_kill, AX
|
||||
INT $0x80
|
||||
RET
|
||||
|
||||
TEXT runtime·raiseproc(SB),NOSPLIT,$16
|
||||
// getpid
|
||||
MOVL $20, AX
|
||||
MOVL $SYS_getpid, AX
|
||||
INT $0x80
|
||||
// kill(self, sig)
|
||||
MOVL AX, 4(SP)
|
||||
MOVL sig+0(FP), AX
|
||||
MOVL AX, 8(SP)
|
||||
MOVL $37, AX
|
||||
MOVL $SYS_kill, AX
|
||||
INT $0x80
|
||||
RET
|
||||
|
||||
|
@ -160,7 +196,7 @@ TEXT runtime·mmap(SB),NOSPLIT,$32
|
|||
MOVSL
|
||||
MOVL $0, AX // top 32 bits of file offset
|
||||
STOSL
|
||||
MOVL $477, AX
|
||||
MOVL $SYS_mmap, AX
|
||||
INT $0x80
|
||||
JAE ok
|
||||
MOVL $0, p+24(FP)
|
||||
|
@ -172,14 +208,14 @@ ok:
|
|||
RET
|
||||
|
||||
TEXT runtime·munmap(SB),NOSPLIT,$-4
|
||||
MOVL $73, AX
|
||||
MOVL $SYS_munmap, AX
|
||||
INT $0x80
|
||||
JAE 2(PC)
|
||||
MOVL $0xf1, 0xf1 // crash
|
||||
RET
|
||||
|
||||
TEXT runtime·madvise(SB),NOSPLIT,$-4
|
||||
MOVL $75, AX // madvise
|
||||
MOVL $SYS_madvise, AX
|
||||
INT $0x80
|
||||
JAE 2(PC)
|
||||
MOVL $-1, AX
|
||||
|
@ -187,15 +223,15 @@ TEXT runtime·madvise(SB),NOSPLIT,$-4
|
|||
RET
|
||||
|
||||
TEXT runtime·setitimer(SB), NOSPLIT, $-4
|
||||
MOVL $83, AX
|
||||
MOVL $SYS_setitimer, AX
|
||||
INT $0x80
|
||||
RET
|
||||
|
||||
// func fallback_walltime() (sec int64, nsec int32)
|
||||
TEXT runtime·fallback_walltime(SB), NOSPLIT, $32-12
|
||||
MOVL $232, AX // clock_gettime
|
||||
MOVL $SYS_clock_gettime, AX
|
||||
LEAL 12(SP), BX
|
||||
MOVL $0, 4(SP) // CLOCK_REALTIME
|
||||
MOVL $CLOCK_REALTIME, 4(SP)
|
||||
MOVL BX, 8(SP)
|
||||
INT $0x80
|
||||
MOVL 12(SP), AX // sec
|
||||
|
@ -209,9 +245,9 @@ TEXT runtime·fallback_walltime(SB), NOSPLIT, $32-12
|
|||
|
||||
// func fallback_nanotime() int64
|
||||
TEXT runtime·fallback_nanotime(SB), NOSPLIT, $32-8
|
||||
MOVL $232, AX
|
||||
MOVL $SYS_clock_gettime, AX
|
||||
LEAL 12(SP), BX
|
||||
MOVL $4, 4(SP) // CLOCK_MONOTONIC
|
||||
MOVL $CLOCK_MONOTONIC, 4(SP)
|
||||
MOVL BX, 8(SP)
|
||||
INT $0x80
|
||||
MOVL 12(SP), AX // sec
|
||||
|
@ -230,7 +266,7 @@ TEXT runtime·fallback_nanotime(SB), NOSPLIT, $32-8
|
|||
|
||||
|
||||
TEXT runtime·asmSigaction(SB),NOSPLIT,$-4
|
||||
MOVL $416, AX
|
||||
MOVL $SYS_sigaction, AX
|
||||
INT $0x80
|
||||
MOVL AX, ret+12(FP)
|
||||
RET
|
||||
|
@ -267,13 +303,13 @@ TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$12
|
|||
MOVL 24(SP), AX // context
|
||||
MOVL $0, 0(SP) // syscall gap
|
||||
MOVL AX, 4(SP)
|
||||
MOVL $417, AX // sigreturn(ucontext)
|
||||
MOVL $SYS_sigreturn, AX
|
||||
INT $0x80
|
||||
MOVL $0xf1, 0xf1 // crash
|
||||
RET
|
||||
|
||||
TEXT runtime·sigaltstack(SB),NOSPLIT,$0
|
||||
MOVL $53, AX
|
||||
MOVL $SYS_sigaltstack, AX
|
||||
INT $0x80
|
||||
JAE 2(PC)
|
||||
MOVL $0xf1, 0xf1 // crash
|
||||
|
@ -293,7 +329,7 @@ TEXT runtime·usleep(SB),NOSPLIT,$20
|
|||
LEAL 12(SP), AX
|
||||
MOVL AX, 4(SP) // arg 1 - rqtp
|
||||
MOVL $0, 8(SP) // arg 2 - rmtp
|
||||
MOVL $240, AX // sys_nanosleep
|
||||
MOVL $SYS_nanosleep, AX
|
||||
INT $0x80
|
||||
RET
|
||||
|
||||
|
@ -352,7 +388,7 @@ TEXT i386_set_ldt<>(SB),NOSPLIT,$16
|
|||
MOVL $0, 0(SP) // syscall gap
|
||||
MOVL $1, 4(SP)
|
||||
MOVL AX, 8(SP)
|
||||
MOVL $165, AX
|
||||
MOVL $SYS_sysarch, AX
|
||||
INT $0x80
|
||||
JAE 2(PC)
|
||||
INT $3
|
||||
|
@ -368,7 +404,7 @@ TEXT runtime·sysctl(SB),NOSPLIT,$28
|
|||
MOVSL // arg 4 - oldlenp
|
||||
MOVSL // arg 5 - newp
|
||||
MOVSL // arg 6 - newlen
|
||||
MOVL $202, AX // sys___sysctl
|
||||
MOVL $SYS___sysctl, AX
|
||||
INT $0x80
|
||||
JAE 4(PC)
|
||||
NEGL AX
|
||||
|
@ -379,7 +415,7 @@ TEXT runtime·sysctl(SB),NOSPLIT,$28
|
|||
RET
|
||||
|
||||
TEXT runtime·osyield(SB),NOSPLIT,$-4
|
||||
MOVL $331, AX // sys_sched_yield
|
||||
MOVL $SYS_sched_yield, AX
|
||||
INT $0x80
|
||||
RET
|
||||
|
||||
|
@ -391,7 +427,7 @@ TEXT runtime·sigprocmask(SB),NOSPLIT,$16
|
|||
MOVL AX, 8(SP) // arg 2 - set
|
||||
MOVL old+8(FP), AX
|
||||
MOVL AX, 12(SP) // arg 3 - oset
|
||||
MOVL $340, AX // sys_sigprocmask
|
||||
MOVL $SYS_sigprocmask, AX
|
||||
INT $0x80
|
||||
JAE 2(PC)
|
||||
MOVL $0xf1, 0xf1 // crash
|
||||
|
@ -399,7 +435,7 @@ TEXT runtime·sigprocmask(SB),NOSPLIT,$16
|
|||
|
||||
// int32 runtime·kqueue(void);
|
||||
TEXT runtime·kqueue(SB),NOSPLIT,$0
|
||||
MOVL $362, AX
|
||||
MOVL $SYS_kqueue, AX
|
||||
INT $0x80
|
||||
JAE 2(PC)
|
||||
NEGL AX
|
||||
|
@ -408,7 +444,7 @@ TEXT runtime·kqueue(SB),NOSPLIT,$0
|
|||
|
||||
// int32 runtime·kevent(int kq, Kevent *changelist, int nchanges, Kevent *eventlist, int nevents, Timespec *timeout);
|
||||
TEXT runtime·kevent(SB),NOSPLIT,$0
|
||||
MOVL $363, AX
|
||||
MOVL $SYS_kevent, AX
|
||||
INT $0x80
|
||||
JAE 2(PC)
|
||||
NEGL AX
|
||||
|
@ -417,12 +453,12 @@ TEXT runtime·kevent(SB),NOSPLIT,$0
|
|||
|
||||
// int32 runtime·closeonexec(int32 fd);
|
||||
TEXT runtime·closeonexec(SB),NOSPLIT,$32
|
||||
MOVL $92, AX // fcntl
|
||||
MOVL $SYS_fcntl, AX
|
||||
// 0(SP) is where the caller PC would be; kernel skips it
|
||||
MOVL fd+0(FP), BX
|
||||
MOVL BX, 4(SP) // fd
|
||||
MOVL $2, 8(SP) // F_SETFD
|
||||
MOVL $1, 12(SP) // FD_CLOEXEC
|
||||
MOVL $F_SETFD, 8(SP)
|
||||
MOVL $FD_CLOEXEC, 12(SP)
|
||||
INT $0x80
|
||||
JAE 2(PC)
|
||||
NEGL AX
|
||||
|
@ -430,7 +466,7 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$32
|
|||
|
||||
// func cpuset_getaffinity(level int, which int, id int64, size int, mask *byte) int32
|
||||
TEXT runtime·cpuset_getaffinity(SB), NOSPLIT, $0-28
|
||||
MOVL $487, AX
|
||||
MOVL $SYS_cpuset_getaffinity, AX
|
||||
INT $0x80
|
||||
JAE 2(PC)
|
||||
NEGL AX
|
||||
|
|
Loading…
Reference in a new issue