#include "go_tls.h"
#include "textflag.h"
+#ifdef shared
+#define INVOKE_SYSINFO CALL 0x10(GS)
+#else
+#define INVOKE_SYSINFO CALL *runtime·_vdso(SB)
+#endif
+
TEXT runtime·exit(SB),NOSPLIT,$0
MOVL $252, AX // syscall number
MOVL code+0(FP), BX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
INT $3 // not reached
RET
TEXT runtime·exit1(SB),NOSPLIT,$0
MOVL $1, AX // exit - exit the current os thread
MOVL code+0(FP), BX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
INT $3 // not reached
RET
MOVL name+0(FP), BX
MOVL mode+4(FP), CX
MOVL perm+8(FP), DX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
CMPL AX, $0xfffff001
JLS 2(PC)
MOVL $-1, AX
TEXT runtime·closefd(SB),NOSPLIT,$0
MOVL $6, AX // syscall - close
MOVL fd+0(FP), BX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
CMPL AX, $0xfffff001
JLS 2(PC)
MOVL $-1, AX
MOVL fd+0(FP), BX
MOVL p+4(FP), CX
MOVL n+8(FP), DX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
CMPL AX, $0xfffff001
JLS 2(PC)
MOVL $-1, AX
MOVL fd+0(FP), BX
MOVL p+4(FP), CX
MOVL n+8(FP), DX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
CMPL AX, $0xfffff001
JLS 2(PC)
MOVL $-1, AX
MOVL $191, AX // syscall - ugetrlimit
MOVL kind+0(FP), BX
MOVL limit+4(FP), CX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
MOVL AX, ret+8(FP)
RET
MOVL $0, DX
MOVL $0, SI
LEAL 0(SP), DI
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
RET
TEXT runtime·gettid(SB),NOSPLIT,$0-4
MOVL $224, AX // syscall - gettid
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
MOVL AX, ret+0(FP)
RET
TEXT runtime·raise(SB),NOSPLIT,$12
MOVL $224, AX // syscall - gettid
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
MOVL AX, BX // arg 1 tid
MOVL sig+0(FP), CX // arg 2 signal
MOVL $238, AX // syscall - tkill
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
RET
TEXT runtime·raiseproc(SB),NOSPLIT,$12
MOVL $20, AX // syscall - getpid
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
MOVL AX, BX // arg 1 pid
MOVL sig+0(FP), CX // arg 2 signal
MOVL $37, AX // syscall - kill
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
RET
TEXT runtime·setitimer(SB),NOSPLIT,$0-12
MOVL mode+0(FP), BX
MOVL new+4(FP), CX
MOVL old+8(FP), DX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
RET
TEXT runtime·mincore(SB),NOSPLIT,$0-16
MOVL addr+0(FP), BX
MOVL n+4(FP), CX
MOVL dst+8(FP), DX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
MOVL AX, ret+12(FP)
RET
MOVL $0, BX // CLOCK_REALTIME
LEAL 8(SP), CX
MOVL $0, DX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
MOVL 8(SP), AX // sec
MOVL 12(SP), BX // nsec
MOVL $1, BX // CLOCK_MONOTONIC
LEAL 8(SP), CX
MOVL $0, DX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
MOVL 8(SP), AX // sec
MOVL 12(SP), BX // nsec
MOVL new+4(FP), CX
MOVL old+8(FP), DX
MOVL size+12(FP), SI
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
CMPL AX, $0xfffff001
JLS 2(PC)
INT $3
MOVL new+4(FP), CX
MOVL old+8(FP), DX
MOVL size+12(FP), SI
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
MOVL AX, ret+16(FP)
RET
MOVL fd+16(FP), DI
MOVL off+20(FP), BP
SHRL $12, BP
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
CMPL AX, $0xfffff001
JLS 3(PC)
NOTL AX
MOVL $91, AX // munmap
MOVL addr+0(FP), BX
MOVL n+4(FP), CX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
CMPL AX, $0xfffff001
JLS 2(PC)
INT $3
MOVL addr+0(FP), BX
MOVL n+4(FP), CX
MOVL flags+8(FP), DX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
// ignore failure - maybe pages are locked
RET
MOVL ts+12(FP), SI
MOVL addr2+16(FP), DI
MOVL val3+20(FP), BP
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
MOVL AX, ret+24(FP)
RET
// Initialize AX to Linux tid
MOVL $224, AX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
MOVL 0(SP), BX // m
MOVL 4(SP), DX // g
MOVL $186, AX // sigaltstack
MOVL new+4(SP), BX
MOVL old+8(SP), CX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
CMPL AX, $0xfffff001
JLS 2(PC)
INT $3
MOVL AX, CX // user_desc
MOVL $16, DX // sizeof(user_desc)
MOVL $123, AX // syscall - modify_ldt
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
// breakpoint on error
CMPL AX, $0xfffff001
TEXT runtime·osyield(SB),NOSPLIT,$0
MOVL $158, AX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
RET
TEXT runtime·sched_getaffinity(SB),NOSPLIT,$0
MOVL pid+0(FP), BX
MOVL len+4(FP), CX
MOVL buf+8(FP), DX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
MOVL AX, ret+12(FP)
RET
TEXT runtime·epollcreate(SB),NOSPLIT,$0
MOVL $254, AX
MOVL size+0(FP), BX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
MOVL AX, ret+4(FP)
RET
TEXT runtime·epollcreate1(SB),NOSPLIT,$0
MOVL $329, AX
MOVL flags+0(FP), BX
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
MOVL AX, ret+4(FP)
RET
MOVL op+4(FP), CX
MOVL fd+8(FP), DX
MOVL ev+12(FP), SI
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
MOVL AX, ret+16(FP)
RET
MOVL ev+4(FP), CX
MOVL nev+8(FP), DX
MOVL timeout+12(FP), SI
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
MOVL AX, ret+16(FP)
RET
MOVL fd+0(FP), BX // fd
MOVL $2, CX // F_SETFD
MOVL $1, DX // FD_CLOEXEC
- CALL *runtime·_vdso(SB)
+ INVOKE_SYSINFO
RET