mirror of
https://github.com/golang/go
synced 2024-11-19 13:04:45 -07:00
runtime: add symbols for Linux syscall numbers on 386/amd64
Matches other architectures by using names for syscalls instead of numbers directly. Fixes #20499. Change-Id: I63d606b0b1fe6fb517fd994a7542a3f38d80dd54 Reviewed-on: https://go-review.googlesource.com/44213 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
4641d78a59
commit
4d269ad175
@ -24,22 +24,58 @@
|
||||
//#define INVOKE_SYSCALL CALL 0x10(GS) // non-portable
|
||||
#define INVOKE_SYSCALL INT $0x80
|
||||
|
||||
#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_access 33
|
||||
#define SYS_kill 37
|
||||
#define SYS_brk 45
|
||||
#define SYS_fcntl 55
|
||||
#define SYS_munmap 91
|
||||
#define SYS_socketcall 102
|
||||
#define SYS_setittimer 104
|
||||
#define SYS_clone 120
|
||||
#define SYS_sched_yield 158
|
||||
#define SYS_rt_sigreturn 173
|
||||
#define SYS_rt_sigaction 174
|
||||
#define SYS_rt_sigprocmask 175
|
||||
#define SYS_sigaltstack 186
|
||||
#define SYS_ugetrlimit 191
|
||||
#define SYS_mmap2 192
|
||||
#define SYS_mincore 218
|
||||
#define SYS_madvise 219
|
||||
#define SYS_gettid 224
|
||||
#define SYS_tkill 238
|
||||
#define SYS_futex 240
|
||||
#define SYS_sched_getaffinity 242
|
||||
#define SYS_set_thread_area 243
|
||||
#define SYS_exit_group 252
|
||||
#define SYS_epoll_create 254
|
||||
#define SYS_epoll_ctl 255
|
||||
#define SYS_epoll_wait 256
|
||||
#define SYS_clock_gettime 265
|
||||
#define SYS_pselect6 308
|
||||
#define SYS_epoll_create1 329
|
||||
|
||||
TEXT runtime·exit(SB),NOSPLIT,$0
|
||||
MOVL $252, AX // syscall number
|
||||
MOVL $SYS_exit_group, AX
|
||||
MOVL code+0(FP), BX
|
||||
INVOKE_SYSCALL
|
||||
INT $3 // not reached
|
||||
RET
|
||||
|
||||
TEXT runtime·exit1(SB),NOSPLIT,$0
|
||||
MOVL $1, AX // exit - exit the current os thread
|
||||
MOVL $SYS_exit, AX
|
||||
MOVL code+0(FP), BX
|
||||
INVOKE_SYSCALL
|
||||
INT $3 // not reached
|
||||
RET
|
||||
|
||||
TEXT runtime·open(SB),NOSPLIT,$0
|
||||
MOVL $5, AX // syscall - open
|
||||
MOVL $SYS_open, AX
|
||||
MOVL name+0(FP), BX
|
||||
MOVL mode+4(FP), CX
|
||||
MOVL perm+8(FP), DX
|
||||
@ -51,7 +87,7 @@ TEXT runtime·open(SB),NOSPLIT,$0
|
||||
RET
|
||||
|
||||
TEXT runtime·closefd(SB),NOSPLIT,$0
|
||||
MOVL $6, AX // syscall - close
|
||||
MOVL $SYS_close, AX
|
||||
MOVL fd+0(FP), BX
|
||||
INVOKE_SYSCALL
|
||||
CMPL AX, $0xfffff001
|
||||
@ -61,7 +97,7 @@ TEXT runtime·closefd(SB),NOSPLIT,$0
|
||||
RET
|
||||
|
||||
TEXT runtime·write(SB),NOSPLIT,$0
|
||||
MOVL $4, AX // syscall - write
|
||||
MOVL $SYS_write, AX
|
||||
MOVL fd+0(FP), BX
|
||||
MOVL p+4(FP), CX
|
||||
MOVL n+8(FP), DX
|
||||
@ -73,7 +109,7 @@ TEXT runtime·write(SB),NOSPLIT,$0
|
||||
RET
|
||||
|
||||
TEXT runtime·read(SB),NOSPLIT,$0
|
||||
MOVL $3, AX // syscall - read
|
||||
MOVL $SYS_read, AX
|
||||
MOVL fd+0(FP), BX
|
||||
MOVL p+4(FP), CX
|
||||
MOVL n+8(FP), DX
|
||||
@ -85,7 +121,7 @@ TEXT runtime·read(SB),NOSPLIT,$0
|
||||
RET
|
||||
|
||||
TEXT runtime·getrlimit(SB),NOSPLIT,$0
|
||||
MOVL $191, AX // syscall - ugetrlimit
|
||||
MOVL $SYS_ugetrlimit, AX
|
||||
MOVL kind+0(FP), BX
|
||||
MOVL limit+4(FP), CX
|
||||
INVOKE_SYSCALL
|
||||
@ -103,7 +139,7 @@ TEXT runtime·usleep(SB),NOSPLIT,$8
|
||||
MOVL AX, 4(SP)
|
||||
|
||||
// pselect6(0, 0, 0, 0, &ts, 0)
|
||||
MOVL $308, AX
|
||||
MOVL $SYS_pselect6, AX
|
||||
MOVL $0, BX
|
||||
MOVL $0, CX
|
||||
MOVL $0, DX
|
||||
@ -114,31 +150,31 @@ TEXT runtime·usleep(SB),NOSPLIT,$8
|
||||
RET
|
||||
|
||||
TEXT runtime·gettid(SB),NOSPLIT,$0-4
|
||||
MOVL $224, AX // syscall - gettid
|
||||
MOVL $SYS_gettid, AX
|
||||
INVOKE_SYSCALL
|
||||
MOVL AX, ret+0(FP)
|
||||
RET
|
||||
|
||||
TEXT runtime·raise(SB),NOSPLIT,$12
|
||||
MOVL $224, AX // syscall - gettid
|
||||
MOVL $SYS_gettid, AX
|
||||
INVOKE_SYSCALL
|
||||
MOVL AX, BX // arg 1 tid
|
||||
MOVL sig+0(FP), CX // arg 2 signal
|
||||
MOVL $238, AX // syscall - tkill
|
||||
MOVL $SYS_tkill, AX
|
||||
INVOKE_SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·raiseproc(SB),NOSPLIT,$12
|
||||
MOVL $20, AX // syscall - getpid
|
||||
MOVL $SYS_getpid, AX
|
||||
INVOKE_SYSCALL
|
||||
MOVL AX, BX // arg 1 pid
|
||||
MOVL sig+0(FP), CX // arg 2 signal
|
||||
MOVL $37, AX // syscall - kill
|
||||
MOVL $SYS_kill, AX
|
||||
INVOKE_SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·setitimer(SB),NOSPLIT,$0-12
|
||||
MOVL $104, AX // syscall - setitimer
|
||||
MOVL $SYS_setittimer, AX
|
||||
MOVL mode+0(FP), BX
|
||||
MOVL new+4(FP), CX
|
||||
MOVL old+8(FP), DX
|
||||
@ -146,7 +182,7 @@ TEXT runtime·setitimer(SB),NOSPLIT,$0-12
|
||||
RET
|
||||
|
||||
TEXT runtime·mincore(SB),NOSPLIT,$0-16
|
||||
MOVL $218, AX // syscall - mincore
|
||||
MOVL $SYS_mincore, AX
|
||||
MOVL addr+0(FP), BX
|
||||
MOVL n+4(FP), CX
|
||||
MOVL dst+8(FP), DX
|
||||
@ -156,7 +192,7 @@ TEXT runtime·mincore(SB),NOSPLIT,$0-16
|
||||
|
||||
// func walltime() (sec int64, nsec int32)
|
||||
TEXT runtime·walltime(SB), NOSPLIT, $32
|
||||
MOVL $265, AX // syscall - clock_gettime
|
||||
MOVL $SYS_clock_gettime, AX
|
||||
MOVL $0, BX // CLOCK_REALTIME
|
||||
LEAL 8(SP), CX
|
||||
MOVL $0, DX
|
||||
@ -173,7 +209,7 @@ TEXT runtime·walltime(SB), NOSPLIT, $32
|
||||
// int64 nanotime(void) so really
|
||||
// void nanotime(int64 *nsec)
|
||||
TEXT runtime·nanotime(SB), NOSPLIT, $32
|
||||
MOVL $265, AX // syscall - clock_gettime
|
||||
MOVL $SYS_clock_gettime, AX
|
||||
MOVL $1, BX // CLOCK_MONOTONIC
|
||||
LEAL 8(SP), CX
|
||||
MOVL $0, DX
|
||||
@ -193,7 +229,7 @@ TEXT runtime·nanotime(SB), NOSPLIT, $32
|
||||
RET
|
||||
|
||||
TEXT runtime·rtsigprocmask(SB),NOSPLIT,$0
|
||||
MOVL $175, AX // syscall entry
|
||||
MOVL $SYS_rt_sigprocmask, AX
|
||||
MOVL how+0(FP), BX
|
||||
MOVL new+4(FP), CX
|
||||
MOVL old+8(FP), DX
|
||||
@ -205,7 +241,7 @@ TEXT runtime·rtsigprocmask(SB),NOSPLIT,$0
|
||||
RET
|
||||
|
||||
TEXT runtime·rt_sigaction(SB),NOSPLIT,$0
|
||||
MOVL $174, AX // syscall - rt_sigaction
|
||||
MOVL $SYS_rt_sigaction, AX
|
||||
MOVL sig+0(FP), BX
|
||||
MOVL new+4(FP), CX
|
||||
MOVL old+8(FP), DX
|
||||
@ -258,7 +294,7 @@ TEXT runtime·cgoSigtramp(SB),NOSPLIT,$0
|
||||
JMP runtime·sigtramp(SB)
|
||||
|
||||
TEXT runtime·sigreturn(SB),NOSPLIT,$0
|
||||
MOVL $173, AX // rt_sigreturn
|
||||
MOVL $SYS_rt_sigreturn, AX
|
||||
// Sigreturn expects same SP as signal handler,
|
||||
// so cannot CALL 0x10(GS) here.
|
||||
INT $0x80
|
||||
@ -266,7 +302,7 @@ TEXT runtime·sigreturn(SB),NOSPLIT,$0
|
||||
RET
|
||||
|
||||
TEXT runtime·mmap(SB),NOSPLIT,$0
|
||||
MOVL $192, AX // mmap2
|
||||
MOVL $SYS_mmap2, AX
|
||||
MOVL addr+0(FP), BX
|
||||
MOVL n+4(FP), CX
|
||||
MOVL prot+8(FP), DX
|
||||
@ -283,7 +319,7 @@ TEXT runtime·mmap(SB),NOSPLIT,$0
|
||||
RET
|
||||
|
||||
TEXT runtime·munmap(SB),NOSPLIT,$0
|
||||
MOVL $91, AX // munmap
|
||||
MOVL $SYS_munmap, AX
|
||||
MOVL addr+0(FP), BX
|
||||
MOVL n+4(FP), CX
|
||||
INVOKE_SYSCALL
|
||||
@ -293,7 +329,7 @@ TEXT runtime·munmap(SB),NOSPLIT,$0
|
||||
RET
|
||||
|
||||
TEXT runtime·madvise(SB),NOSPLIT,$0
|
||||
MOVL $219, AX // madvise
|
||||
MOVL $SYS_madvise, AX
|
||||
MOVL addr+0(FP), BX
|
||||
MOVL n+4(FP), CX
|
||||
MOVL flags+8(FP), DX
|
||||
@ -304,7 +340,7 @@ TEXT runtime·madvise(SB),NOSPLIT,$0
|
||||
// int32 futex(int32 *uaddr, int32 op, int32 val,
|
||||
// struct timespec *timeout, int32 *uaddr2, int32 val2);
|
||||
TEXT runtime·futex(SB),NOSPLIT,$0
|
||||
MOVL $240, AX // futex
|
||||
MOVL $SYS_futex, AX
|
||||
MOVL addr+0(FP), BX
|
||||
MOVL op+4(FP), CX
|
||||
MOVL val+8(FP), DX
|
||||
@ -317,7 +353,7 @@ TEXT runtime·futex(SB),NOSPLIT,$0
|
||||
|
||||
// int32 clone(int32 flags, void *stack, M *mp, G *gp, void (*fn)(void));
|
||||
TEXT runtime·clone(SB),NOSPLIT,$0
|
||||
MOVL $120, AX // clone
|
||||
MOVL $SYS_clone, AX
|
||||
MOVL flags+0(FP), BX
|
||||
MOVL stk+4(FP), CX
|
||||
MOVL $0, DX // parent tid ptr
|
||||
@ -351,7 +387,7 @@ TEXT runtime·clone(SB),NOSPLIT,$0
|
||||
INT $3
|
||||
|
||||
// Initialize AX to Linux tid
|
||||
MOVL $224, AX
|
||||
MOVL $SYS_gettid, AX
|
||||
INVOKE_SYSCALL
|
||||
|
||||
MOVL 0(SP), BX // m
|
||||
@ -400,7 +436,7 @@ nog:
|
||||
MOVL $0x1234, 0x1005
|
||||
|
||||
TEXT runtime·sigaltstack(SB),NOSPLIT,$-8
|
||||
MOVL $186, AX // sigaltstack
|
||||
MOVL $SYS_sigaltstack, AX
|
||||
MOVL new+0(FP), BX
|
||||
MOVL old+4(FP), CX
|
||||
INVOKE_SYSCALL
|
||||
@ -483,7 +519,7 @@ TEXT runtime·setldt(SB),NOSPLIT,$32
|
||||
|
||||
// call set_thread_area
|
||||
MOVL AX, BX // user_desc
|
||||
MOVL $243, AX // syscall - set_thread_area
|
||||
MOVL $SYS_set_thread_area, AX
|
||||
// We can't call this via 0x10(GS) because this is called from setldt0 to set that up.
|
||||
INT $0x80
|
||||
|
||||
@ -509,12 +545,12 @@ TEXT runtime·setldt(SB),NOSPLIT,$32
|
||||
RET
|
||||
|
||||
TEXT runtime·osyield(SB),NOSPLIT,$0
|
||||
MOVL $158, AX
|
||||
MOVL $SYS_sched_yield, AX
|
||||
INVOKE_SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·sched_getaffinity(SB),NOSPLIT,$0
|
||||
MOVL $242, AX // syscall - sched_getaffinity
|
||||
MOVL $SYS_sched_getaffinity, AX
|
||||
MOVL pid+0(FP), BX
|
||||
MOVL len+4(FP), CX
|
||||
MOVL buf+8(FP), DX
|
||||
@ -524,7 +560,7 @@ TEXT runtime·sched_getaffinity(SB),NOSPLIT,$0
|
||||
|
||||
// int32 runtime·epollcreate(int32 size);
|
||||
TEXT runtime·epollcreate(SB),NOSPLIT,$0
|
||||
MOVL $254, AX
|
||||
MOVL $SYS_epoll_create, AX
|
||||
MOVL size+0(FP), BX
|
||||
INVOKE_SYSCALL
|
||||
MOVL AX, ret+4(FP)
|
||||
@ -532,7 +568,7 @@ TEXT runtime·epollcreate(SB),NOSPLIT,$0
|
||||
|
||||
// int32 runtime·epollcreate1(int32 flags);
|
||||
TEXT runtime·epollcreate1(SB),NOSPLIT,$0
|
||||
MOVL $329, AX
|
||||
MOVL $SYS_epoll_create1, AX
|
||||
MOVL flags+0(FP), BX
|
||||
INVOKE_SYSCALL
|
||||
MOVL AX, ret+4(FP)
|
||||
@ -540,7 +576,7 @@ TEXT runtime·epollcreate1(SB),NOSPLIT,$0
|
||||
|
||||
// func epollctl(epfd, op, fd int32, ev *epollEvent) int
|
||||
TEXT runtime·epollctl(SB),NOSPLIT,$0
|
||||
MOVL $255, AX
|
||||
MOVL $SYS_epoll_ctl, AX
|
||||
MOVL epfd+0(FP), BX
|
||||
MOVL op+4(FP), CX
|
||||
MOVL fd+8(FP), DX
|
||||
@ -551,7 +587,7 @@ TEXT runtime·epollctl(SB),NOSPLIT,$0
|
||||
|
||||
// int32 runtime·epollwait(int32 epfd, EpollEvent *ev, int32 nev, int32 timeout);
|
||||
TEXT runtime·epollwait(SB),NOSPLIT,$0
|
||||
MOVL $256, AX
|
||||
MOVL $SYS_epoll_wait, AX
|
||||
MOVL epfd+0(FP), BX
|
||||
MOVL ev+4(FP), CX
|
||||
MOVL nev+8(FP), DX
|
||||
@ -562,7 +598,7 @@ TEXT runtime·epollwait(SB),NOSPLIT,$0
|
||||
|
||||
// void runtime·closeonexec(int32 fd);
|
||||
TEXT runtime·closeonexec(SB),NOSPLIT,$0
|
||||
MOVL $55, AX // fcntl
|
||||
MOVL $SYS_fcntl, AX
|
||||
MOVL fd+0(FP), BX // fd
|
||||
MOVL $2, CX // F_SETFD
|
||||
MOVL $1, DX // FD_CLOEXEC
|
||||
@ -571,7 +607,7 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0
|
||||
|
||||
// int access(const char *name, int mode)
|
||||
TEXT runtime·access(SB),NOSPLIT,$0
|
||||
MOVL $33, AX // syscall - access
|
||||
MOVL $SYS_access, AX
|
||||
MOVL name+0(FP), BX
|
||||
MOVL mode+4(FP), CX
|
||||
INVOKE_SYSCALL
|
||||
@ -582,7 +618,7 @@ TEXT runtime·access(SB),NOSPLIT,$0
|
||||
TEXT runtime·connect(SB),NOSPLIT,$0-16
|
||||
// connect is implemented as socketcall(NR_socket, 3, *(rest of args))
|
||||
// stack already should have fd, addr, addrlen.
|
||||
MOVL $102, AX // syscall - socketcall
|
||||
MOVL $SYS_socketcall, AX
|
||||
MOVL $3, BX // connect
|
||||
LEAL fd+0(FP), CX
|
||||
INVOKE_SYSCALL
|
||||
@ -593,7 +629,7 @@ TEXT runtime·connect(SB),NOSPLIT,$0-16
|
||||
TEXT runtime·socket(SB),NOSPLIT,$0-16
|
||||
// socket is implemented as socketcall(NR_socket, 1, *(rest of args))
|
||||
// stack already should have domain, type, protocol.
|
||||
MOVL $102, AX // syscall - socketcall
|
||||
MOVL $SYS_socketcall, AX
|
||||
MOVL $1, BX // socket
|
||||
LEAL domain+0(FP), CX
|
||||
INVOKE_SYSCALL
|
||||
@ -603,7 +639,7 @@ TEXT runtime·socket(SB),NOSPLIT,$0-16
|
||||
// func sbrk0() uintptr
|
||||
TEXT runtime·sbrk0(SB),NOSPLIT,$0-4
|
||||
// Implemented as brk(NULL).
|
||||
MOVL $45, AX // syscall - brk
|
||||
MOVL $SYS_brk, AX
|
||||
MOVL $0, BX // NULL
|
||||
INVOKE_SYSCALL
|
||||
MOVL AX, ret+0(FP)
|
||||
|
@ -10,15 +10,51 @@
|
||||
#include "go_tls.h"
|
||||
#include "textflag.h"
|
||||
|
||||
#define SYS_read 0
|
||||
#define SYS_write 1
|
||||
#define SYS_open 2
|
||||
#define SYS_close 3
|
||||
#define SYS_mmap 9
|
||||
#define SYS_munmap 11
|
||||
#define SYS_brk 12
|
||||
#define SYS_rt_sigaction 13
|
||||
#define SYS_rt_sigprocmask 14
|
||||
#define SYS_rt_sigreturn 15
|
||||
#define SYS_access 21
|
||||
#define SYS_sched_yield 24
|
||||
#define SYS_mincore 27
|
||||
#define SYS_madvise 28
|
||||
#define SYS_setittimer 38
|
||||
#define SYS_getpid 39
|
||||
#define SYS_socket 41
|
||||
#define SYS_connect 42
|
||||
#define SYS_clone 56
|
||||
#define SYS_exit 60
|
||||
#define SYS_kill 62
|
||||
#define SYS_fcntl 72
|
||||
#define SYS_getrlimit 97
|
||||
#define SYS_sigaltstack 131
|
||||
#define SYS_arch_prctl 158
|
||||
#define SYS_gettid 186
|
||||
#define SYS_tkill 200
|
||||
#define SYS_futex 202
|
||||
#define SYS_sched_getaffinity 204
|
||||
#define SYS_epoll_create 213
|
||||
#define SYS_exit_group 231
|
||||
#define SYS_epoll_wait 232
|
||||
#define SYS_epoll_ctl 233
|
||||
#define SYS_pselect6 270
|
||||
#define SYS_epoll_create1 291
|
||||
|
||||
TEXT runtime·exit(SB),NOSPLIT,$0-4
|
||||
MOVL code+0(FP), DI
|
||||
MOVL $231, AX // exitgroup - force all os threads to exit
|
||||
MOVL $SYS_exit_group, AX
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·exit1(SB),NOSPLIT,$0-4
|
||||
MOVL code+0(FP), DI
|
||||
MOVL $60, AX // exit - exit the current os thread
|
||||
MOVL $SYS_exit, AX
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
@ -26,7 +62,7 @@ TEXT runtime·open(SB),NOSPLIT,$0-20
|
||||
MOVQ name+0(FP), DI
|
||||
MOVL mode+8(FP), SI
|
||||
MOVL perm+12(FP), DX
|
||||
MOVL $2, AX // syscall entry
|
||||
MOVL $SYS_open, AX
|
||||
SYSCALL
|
||||
CMPQ AX, $0xfffffffffffff001
|
||||
JLS 2(PC)
|
||||
@ -36,7 +72,7 @@ TEXT runtime·open(SB),NOSPLIT,$0-20
|
||||
|
||||
TEXT runtime·closefd(SB),NOSPLIT,$0-12
|
||||
MOVL fd+0(FP), DI
|
||||
MOVL $3, AX // syscall entry
|
||||
MOVL $SYS_close, AX
|
||||
SYSCALL
|
||||
CMPQ AX, $0xfffffffffffff001
|
||||
JLS 2(PC)
|
||||
@ -48,7 +84,7 @@ TEXT runtime·write(SB),NOSPLIT,$0-28
|
||||
MOVQ fd+0(FP), DI
|
||||
MOVQ p+8(FP), SI
|
||||
MOVL n+16(FP), DX
|
||||
MOVL $1, AX // syscall entry
|
||||
MOVL $SYS_write, AX
|
||||
SYSCALL
|
||||
CMPQ AX, $0xfffffffffffff001
|
||||
JLS 2(PC)
|
||||
@ -60,7 +96,7 @@ TEXT runtime·read(SB),NOSPLIT,$0-28
|
||||
MOVL fd+0(FP), DI
|
||||
MOVQ p+8(FP), SI
|
||||
MOVL n+16(FP), DX
|
||||
MOVL $0, AX // syscall entry
|
||||
MOVL $SYS_read, AX
|
||||
SYSCALL
|
||||
CMPQ AX, $0xfffffffffffff001
|
||||
JLS 2(PC)
|
||||
@ -71,7 +107,7 @@ TEXT runtime·read(SB),NOSPLIT,$0-28
|
||||
TEXT runtime·getrlimit(SB),NOSPLIT,$0-20
|
||||
MOVL kind+0(FP), DI
|
||||
MOVQ limit+8(FP), SI
|
||||
MOVL $97, AX // syscall entry
|
||||
MOVL $SYS_getrlimit, AX
|
||||
SYSCALL
|
||||
MOVL AX, ret+16(FP)
|
||||
RET
|
||||
@ -93,31 +129,31 @@ TEXT runtime·usleep(SB),NOSPLIT,$16
|
||||
MOVL $0, R10
|
||||
MOVQ SP, R8
|
||||
MOVL $0, R9
|
||||
MOVL $270, AX
|
||||
MOVL $SYS_pselect6, AX
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·gettid(SB),NOSPLIT,$0-4
|
||||
MOVL $186, AX // syscall - gettid
|
||||
MOVL $SYS_gettid, AX
|
||||
SYSCALL
|
||||
MOVL AX, ret+0(FP)
|
||||
RET
|
||||
|
||||
TEXT runtime·raise(SB),NOSPLIT,$0
|
||||
MOVL $186, AX // syscall - gettid
|
||||
MOVL $SYS_gettid, AX
|
||||
SYSCALL
|
||||
MOVL AX, DI // arg 1 tid
|
||||
MOVL sig+0(FP), SI // arg 2
|
||||
MOVL $200, AX // syscall - tkill
|
||||
MOVL $SYS_tkill, AX
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
TEXT runtime·raiseproc(SB),NOSPLIT,$0
|
||||
MOVL $39, AX // syscall - getpid
|
||||
MOVL $SYS_getpid, AX
|
||||
SYSCALL
|
||||
MOVL AX, DI // arg 1 pid
|
||||
MOVL sig+0(FP), SI // arg 2
|
||||
MOVL $62, AX // syscall - kill
|
||||
MOVL $SYS_kill, AX
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
@ -125,7 +161,7 @@ TEXT runtime·setitimer(SB),NOSPLIT,$0-24
|
||||
MOVL mode+0(FP), DI
|
||||
MOVQ new+8(FP), SI
|
||||
MOVQ old+16(FP), DX
|
||||
MOVL $38, AX // syscall entry
|
||||
MOVL $SYS_setittimer, AX
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
@ -133,7 +169,7 @@ TEXT runtime·mincore(SB),NOSPLIT,$0-28
|
||||
MOVQ addr+0(FP), DI
|
||||
MOVQ n+8(FP), SI
|
||||
MOVQ dst+16(FP), DX
|
||||
MOVL $27, AX // syscall entry
|
||||
MOVL $SYS_mincore, AX
|
||||
SYSCALL
|
||||
MOVL AX, ret+24(FP)
|
||||
RET
|
||||
@ -204,7 +240,7 @@ TEXT runtime·rtsigprocmask(SB),NOSPLIT,$0-28
|
||||
MOVQ new+8(FP), SI
|
||||
MOVQ old+16(FP), DX
|
||||
MOVL size+24(FP), R10
|
||||
MOVL $14, AX // syscall entry
|
||||
MOVL $SYS_rt_sigprocmask, AX
|
||||
SYSCALL
|
||||
CMPQ AX, $0xfffffffffffff001
|
||||
JLS 2(PC)
|
||||
@ -216,7 +252,7 @@ TEXT runtime·sysSigaction(SB),NOSPLIT,$0-36
|
||||
MOVQ new+8(FP), SI
|
||||
MOVQ old+16(FP), DX
|
||||
MOVQ size+24(FP), R10
|
||||
MOVL $13, AX // syscall entry
|
||||
MOVL $SYS_rt_sigaction, AX
|
||||
SYSCALL
|
||||
MOVL AX, ret+32(FP)
|
||||
RET
|
||||
@ -354,7 +390,7 @@ sigtrampnog:
|
||||
// The code that cares about the precise instructions used is:
|
||||
// https://gcc.gnu.org/viewcvs/gcc/trunk/libgcc/config/i386/linux-unwind.h?revision=219188&view=markup
|
||||
TEXT runtime·sigreturn(SB),NOSPLIT,$0
|
||||
MOVQ $15, AX // rt_sigreturn
|
||||
MOVQ $SYS_rt_sigreturn, AX
|
||||
SYSCALL
|
||||
INT $3 // not reached
|
||||
|
||||
@ -366,7 +402,7 @@ TEXT runtime·sysMmap(SB),NOSPLIT,$0
|
||||
MOVL fd+24(FP), R8
|
||||
MOVL off+28(FP), R9
|
||||
|
||||
MOVL $9, AX // mmap
|
||||
MOVL $SYS_mmap, AX
|
||||
SYSCALL
|
||||
CMPQ AX, $0xfffffffffffff001
|
||||
JLS 3(PC)
|
||||
@ -396,7 +432,7 @@ TEXT runtime·callCgoMmap(SB),NOSPLIT,$16
|
||||
TEXT runtime·sysMunmap(SB),NOSPLIT,$0
|
||||
MOVQ addr+0(FP), DI
|
||||
MOVQ n+8(FP), SI
|
||||
MOVQ $11, AX // munmap
|
||||
MOVQ $SYS_munmap, AX
|
||||
SYSCALL
|
||||
CMPQ AX, $0xfffffffffffff001
|
||||
JLS 2(PC)
|
||||
@ -420,7 +456,7 @@ TEXT runtime·madvise(SB),NOSPLIT,$0
|
||||
MOVQ addr+0(FP), DI
|
||||
MOVQ n+8(FP), SI
|
||||
MOVL flags+16(FP), DX
|
||||
MOVQ $28, AX // madvise
|
||||
MOVQ $SYS_madvise, AX
|
||||
SYSCALL
|
||||
// ignore failure - maybe pages are locked
|
||||
RET
|
||||
@ -434,7 +470,7 @@ TEXT runtime·futex(SB),NOSPLIT,$0
|
||||
MOVQ ts+16(FP), R10
|
||||
MOVQ addr2+24(FP), R8
|
||||
MOVL val3+32(FP), R9
|
||||
MOVL $202, AX
|
||||
MOVL $SYS_futex, AX
|
||||
SYSCALL
|
||||
MOVL AX, ret+40(FP)
|
||||
RET
|
||||
@ -452,7 +488,7 @@ TEXT runtime·clone(SB),NOSPLIT,$0
|
||||
MOVQ gp+24(FP), R9
|
||||
MOVQ fn+32(FP), R12
|
||||
|
||||
MOVL $56, AX
|
||||
MOVL $SYS_clone, AX
|
||||
SYSCALL
|
||||
|
||||
// In parent, return.
|
||||
@ -471,7 +507,7 @@ TEXT runtime·clone(SB),NOSPLIT,$0
|
||||
JEQ nog
|
||||
|
||||
// Initialize m->procid to Linux tid
|
||||
MOVL $186, AX // gettid
|
||||
MOVL $SYS_gettid, AX
|
||||
SYSCALL
|
||||
MOVQ AX, m_procid(R8)
|
||||
|
||||
@ -491,14 +527,14 @@ nog:
|
||||
|
||||
// It shouldn't return. If it does, exit that thread.
|
||||
MOVL $111, DI
|
||||
MOVL $60, AX
|
||||
MOVL $SYS_exit, AX
|
||||
SYSCALL
|
||||
JMP -3(PC) // keep exiting
|
||||
|
||||
TEXT runtime·sigaltstack(SB),NOSPLIT,$-8
|
||||
MOVQ new+0(FP), DI
|
||||
MOVQ old+8(FP), SI
|
||||
MOVQ $131, AX
|
||||
MOVQ $SYS_sigaltstack, AX
|
||||
SYSCALL
|
||||
CMPQ AX, $0xfffffffffffff001
|
||||
JLS 2(PC)
|
||||
@ -517,7 +553,7 @@ TEXT runtime·settls(SB),NOSPLIT,$32
|
||||
#endif
|
||||
MOVQ DI, SI
|
||||
MOVQ $0x1002, DI // ARCH_SET_FS
|
||||
MOVQ $158, AX // arch_prctl
|
||||
MOVQ $SYS_arch_prctl, AX
|
||||
SYSCALL
|
||||
CMPQ AX, $0xfffffffffffff001
|
||||
JLS 2(PC)
|
||||
@ -525,7 +561,7 @@ TEXT runtime·settls(SB),NOSPLIT,$32
|
||||
RET
|
||||
|
||||
TEXT runtime·osyield(SB),NOSPLIT,$0
|
||||
MOVL $24, AX
|
||||
MOVL $SYS_sched_yield, AX
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
@ -533,7 +569,7 @@ TEXT runtime·sched_getaffinity(SB),NOSPLIT,$0
|
||||
MOVQ pid+0(FP), DI
|
||||
MOVQ len+8(FP), SI
|
||||
MOVQ buf+16(FP), DX
|
||||
MOVL $204, AX // syscall entry
|
||||
MOVL $SYS_sched_getaffinity, AX
|
||||
SYSCALL
|
||||
MOVL AX, ret+24(FP)
|
||||
RET
|
||||
@ -541,7 +577,7 @@ TEXT runtime·sched_getaffinity(SB),NOSPLIT,$0
|
||||
// int32 runtime·epollcreate(int32 size);
|
||||
TEXT runtime·epollcreate(SB),NOSPLIT,$0
|
||||
MOVL size+0(FP), DI
|
||||
MOVL $213, AX // syscall entry
|
||||
MOVL $SYS_epoll_create, AX
|
||||
SYSCALL
|
||||
MOVL AX, ret+8(FP)
|
||||
RET
|
||||
@ -549,7 +585,7 @@ TEXT runtime·epollcreate(SB),NOSPLIT,$0
|
||||
// int32 runtime·epollcreate1(int32 flags);
|
||||
TEXT runtime·epollcreate1(SB),NOSPLIT,$0
|
||||
MOVL flags+0(FP), DI
|
||||
MOVL $291, AX // syscall entry
|
||||
MOVL $SYS_epoll_create1, AX
|
||||
SYSCALL
|
||||
MOVL AX, ret+8(FP)
|
||||
RET
|
||||
@ -560,7 +596,7 @@ TEXT runtime·epollctl(SB),NOSPLIT,$0
|
||||
MOVL op+4(FP), SI
|
||||
MOVL fd+8(FP), DX
|
||||
MOVQ ev+16(FP), R10
|
||||
MOVL $233, AX // syscall entry
|
||||
MOVL $SYS_epoll_ctl, AX
|
||||
SYSCALL
|
||||
MOVL AX, ret+24(FP)
|
||||
RET
|
||||
@ -571,7 +607,7 @@ TEXT runtime·epollwait(SB),NOSPLIT,$0
|
||||
MOVQ ev+8(FP), SI
|
||||
MOVL nev+16(FP), DX
|
||||
MOVL timeout+20(FP), R10
|
||||
MOVL $232, AX // syscall entry
|
||||
MOVL $SYS_epoll_wait, AX
|
||||
SYSCALL
|
||||
MOVL AX, ret+24(FP)
|
||||
RET
|
||||
@ -581,7 +617,7 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0
|
||||
MOVL fd+0(FP), DI // fd
|
||||
MOVQ $2, SI // F_SETFD
|
||||
MOVQ $1, DX // FD_CLOEXEC
|
||||
MOVL $72, AX // fcntl
|
||||
MOVL $SYS_fcntl, AX
|
||||
SYSCALL
|
||||
RET
|
||||
|
||||
@ -590,7 +626,7 @@ TEXT runtime·closeonexec(SB),NOSPLIT,$0
|
||||
TEXT runtime·access(SB),NOSPLIT,$0
|
||||
MOVQ name+0(FP), DI
|
||||
MOVL mode+8(FP), SI
|
||||
MOVL $21, AX // syscall entry
|
||||
MOVL $SYS_access, AX
|
||||
SYSCALL
|
||||
MOVL AX, ret+16(FP)
|
||||
RET
|
||||
@ -600,7 +636,7 @@ TEXT runtime·connect(SB),NOSPLIT,$0-28
|
||||
MOVL fd+0(FP), DI
|
||||
MOVQ addr+8(FP), SI
|
||||
MOVL len+16(FP), DX
|
||||
MOVL $42, AX // syscall entry
|
||||
MOVL $SYS_connect, AX
|
||||
SYSCALL
|
||||
MOVL AX, ret+24(FP)
|
||||
RET
|
||||
@ -610,7 +646,7 @@ TEXT runtime·socket(SB),NOSPLIT,$0-20
|
||||
MOVL domain+0(FP), DI
|
||||
MOVL typ+4(FP), SI
|
||||
MOVL prot+8(FP), DX
|
||||
MOVL $41, AX // syscall entry
|
||||
MOVL $SYS_socket, AX
|
||||
SYSCALL
|
||||
MOVL AX, ret+16(FP)
|
||||
RET
|
||||
@ -619,7 +655,7 @@ TEXT runtime·socket(SB),NOSPLIT,$0-20
|
||||
TEXT runtime·sbrk0(SB),NOSPLIT,$0-8
|
||||
// Implemented as brk(NULL).
|
||||
MOVQ $0, DI
|
||||
MOVL $12, AX // syscall entry
|
||||
MOVL $SYS_brk, AX
|
||||
SYSCALL
|
||||
MOVQ AX, ret+0(FP)
|
||||
RET
|
||||
|
Loading…
Reference in New Issue
Block a user