Text file src/runtime/sys_linux_s390x.s

     1  // Copyright 2016 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // System calls and other system stuff for Linux s390x; see
     6  // /usr/include/asm/unistd.h for the syscall number definitions.
     7  
     8  #include "go_asm.h"
     9  #include "go_tls.h"
    10  #include "textflag.h"
    11  
    12  #define SYS_exit                  1
    13  #define SYS_read                  3
    14  #define SYS_write                 4
    15  #define SYS_open                  5
    16  #define SYS_close                 6
    17  #define SYS_getpid               20
    18  #define SYS_kill                 37
    19  #define SYS_brk			 45
    20  #define SYS_fcntl                55
    21  #define SYS_mmap                 90
    22  #define SYS_munmap               91
    23  #define SYS_setitimer           104
    24  #define SYS_clone               120
    25  #define SYS_sched_yield         158
    26  #define SYS_nanosleep           162
    27  #define SYS_rt_sigreturn        173
    28  #define SYS_rt_sigaction        174
    29  #define SYS_rt_sigprocmask      175
    30  #define SYS_sigaltstack         186
    31  #define SYS_madvise             219
    32  #define SYS_mincore             218
    33  #define SYS_gettid              236
    34  #define SYS_futex               238
    35  #define SYS_sched_getaffinity   240
    36  #define SYS_tgkill              241
    37  #define SYS_exit_group          248
    38  #define SYS_epoll_create        249
    39  #define SYS_epoll_ctl           250
    40  #define SYS_epoll_wait          251
    41  #define SYS_timer_create        254
    42  #define SYS_timer_settime       255
    43  #define SYS_timer_delete        258
    44  #define SYS_clock_gettime       260
    45  #define SYS_pipe2		325
    46  #define SYS_epoll_create1       327
    47  
    48  TEXT runtime·exit(SB),NOSPLIT|NOFRAME,$0-4
    49  	MOVW	code+0(FP), R2
    50  	MOVW	$SYS_exit_group, R1
    51  	SYSCALL
    52  	RET
    53  
    54  // func exitThread(wait *uint32)
    55  TEXT runtime·exitThread(SB),NOSPLIT|NOFRAME,$0-8
    56  	MOVD	wait+0(FP), R1
    57  	// We're done using the stack.
    58  	MOVW	$0, R2
    59  	MOVW	R2, (R1)
    60  	MOVW	$0, R2	// exit code
    61  	MOVW	$SYS_exit, R1
    62  	SYSCALL
    63  	JMP	0(PC)
    64  
    65  TEXT runtime·open(SB),NOSPLIT|NOFRAME,$0-20
    66  	MOVD	name+0(FP), R2
    67  	MOVW	mode+8(FP), R3
    68  	MOVW	perm+12(FP), R4
    69  	MOVW	$SYS_open, R1
    70  	SYSCALL
    71  	MOVD	$-4095, R3
    72  	CMPUBLT	R2, R3, 2(PC)
    73  	MOVW	$-1, R2
    74  	MOVW	R2, ret+16(FP)
    75  	RET
    76  
    77  TEXT runtime·closefd(SB),NOSPLIT|NOFRAME,$0-12
    78  	MOVW	fd+0(FP), R2
    79  	MOVW	$SYS_close, R1
    80  	SYSCALL
    81  	MOVD	$-4095, R3
    82  	CMPUBLT	R2, R3, 2(PC)
    83  	MOVW	$-1, R2
    84  	MOVW	R2, ret+8(FP)
    85  	RET
    86  
    87  TEXT runtime·write1(SB),NOSPLIT|NOFRAME,$0-28
    88  	MOVD	fd+0(FP), R2
    89  	MOVD	p+8(FP), R3
    90  	MOVW	n+16(FP), R4
    91  	MOVW	$SYS_write, R1
    92  	SYSCALL
    93  	MOVW	R2, ret+24(FP)
    94  	RET
    95  
    96  TEXT runtime·read(SB),NOSPLIT|NOFRAME,$0-28
    97  	MOVW	fd+0(FP), R2
    98  	MOVD	p+8(FP), R3
    99  	MOVW	n+16(FP), R4
   100  	MOVW	$SYS_read, R1
   101  	SYSCALL
   102  	MOVW	R2, ret+24(FP)
   103  	RET
   104  
   105  // func pipe2() (r, w int32, errno int32)
   106  TEXT runtime·pipe2(SB),NOSPLIT|NOFRAME,$0-20
   107  	MOVD	$r+8(FP), R2
   108  	MOVW	flags+0(FP), R3
   109  	MOVW	$SYS_pipe2, R1
   110  	SYSCALL
   111  	MOVW	R2, errno+16(FP)
   112  	RET
   113  
   114  TEXT runtime·usleep(SB),NOSPLIT,$16-4
   115  	MOVW	usec+0(FP), R2
   116  	MOVD	R2, R4
   117  	MOVW	$1000000, R3
   118  	DIVD	R3, R2
   119  	MOVD	R2, 8(R15)
   120  	MOVW	$1000, R3
   121  	MULLD	R2, R3
   122  	SUB	R3, R4
   123  	MOVD	R4, 16(R15)
   124  
   125  	// nanosleep(&ts, 0)
   126  	ADD	$8, R15, R2
   127  	MOVW	$0, R3
   128  	MOVW	$SYS_nanosleep, R1
   129  	SYSCALL
   130  	RET
   131  
   132  TEXT runtime·gettid(SB),NOSPLIT,$0-4
   133  	MOVW	$SYS_gettid, R1
   134  	SYSCALL
   135  	MOVW	R2, ret+0(FP)
   136  	RET
   137  
   138  TEXT runtime·raise(SB),NOSPLIT|NOFRAME,$0
   139  	MOVW	$SYS_getpid, R1
   140  	SYSCALL
   141  	MOVW	R2, R10
   142  	MOVW	$SYS_gettid, R1
   143  	SYSCALL
   144  	MOVW	R2, R3	// arg 2 tid
   145  	MOVW	R10, R2	// arg 1 pid
   146  	MOVW	sig+0(FP), R4	// arg 2
   147  	MOVW	$SYS_tgkill, R1
   148  	SYSCALL
   149  	RET
   150  
   151  TEXT runtime·raiseproc(SB),NOSPLIT|NOFRAME,$0
   152  	MOVW	$SYS_getpid, R1
   153  	SYSCALL
   154  	MOVW	R2, R2	// arg 1 pid
   155  	MOVW	sig+0(FP), R3	// arg 2
   156  	MOVW	$SYS_kill, R1
   157  	SYSCALL
   158  	RET
   159  
   160  TEXT ·getpid(SB),NOSPLIT|NOFRAME,$0-8
   161  	MOVW	$SYS_getpid, R1
   162  	SYSCALL
   163  	MOVD	R2, ret+0(FP)
   164  	RET
   165  
   166  TEXT ·tgkill(SB),NOSPLIT|NOFRAME,$0-24
   167  	MOVD	tgid+0(FP), R2
   168  	MOVD	tid+8(FP), R3
   169  	MOVD	sig+16(FP), R4
   170  	MOVW	$SYS_tgkill, R1
   171  	SYSCALL
   172  	RET
   173  
   174  TEXT runtime·setitimer(SB),NOSPLIT|NOFRAME,$0-24
   175  	MOVW	mode+0(FP), R2
   176  	MOVD	new+8(FP), R3
   177  	MOVD	old+16(FP), R4
   178  	MOVW	$SYS_setitimer, R1
   179  	SYSCALL
   180  	RET
   181  
   182  TEXT runtime·timer_create(SB),NOSPLIT|NOFRAME,$0-28
   183  	MOVW	clockid+0(FP), R2
   184  	MOVD	sevp+8(FP), R3
   185  	MOVD	timerid+16(FP), R4
   186  	MOVW	$SYS_timer_create, R1
   187  	SYSCALL
   188  	MOVW	R2, ret+24(FP)
   189  	RET
   190  
   191  TEXT runtime·timer_settime(SB),NOSPLIT|NOFRAME,$0-28
   192  	MOVW	timerid+0(FP), R2
   193  	MOVW	flags+4(FP), R3
   194  	MOVD	new+8(FP), R4
   195  	MOVD	old+16(FP), R5
   196  	MOVW	$SYS_timer_settime, R1
   197  	SYSCALL
   198  	MOVW	R2, ret+24(FP)
   199  	RET
   200  
   201  TEXT runtime·timer_delete(SB),NOSPLIT|NOFRAME,$0-12
   202  	MOVW	timerid+0(FP), R2
   203  	MOVW	$SYS_timer_delete, R1
   204  	SYSCALL
   205  	MOVW	R2, ret+8(FP)
   206  	RET
   207  
   208  TEXT runtime·mincore(SB),NOSPLIT|NOFRAME,$0-28
   209  	MOVD	addr+0(FP), R2
   210  	MOVD	n+8(FP), R3
   211  	MOVD	dst+16(FP), R4
   212  	MOVW	$SYS_mincore, R1
   213  	SYSCALL
   214  	MOVW	R2, ret+24(FP)
   215  	RET
   216  
   217  // func walltime() (sec int64, nsec int32)
   218  TEXT runtime·walltime(SB),NOSPLIT,$32-12
   219  	MOVW	$0, R2			// CLOCK_REALTIME
   220  	MOVD	R15, R7			// Backup stack pointer
   221  
   222  	MOVD	g_m(g), R6		//m
   223  
   224  	MOVD	runtime·vdsoClockgettimeSym(SB), R9	// Check for VDSO availability
   225  	CMPBEQ	R9, $0, fallback
   226  
   227  	MOVD	m_vdsoPC(R6), R4
   228  	MOVD	R4, 16(R15)
   229  	MOVD	m_vdsoSP(R6), R4
   230  	MOVD	R4, 24(R15)
   231  
   232  	MOVD	R14, R8 		// Backup return address
   233  	MOVD	$sec+0(FP), R4 	// return parameter caller
   234  
   235  	MOVD	R8, m_vdsoPC(R6)
   236  	MOVD	R4, m_vdsoSP(R6)
   237  
   238  	MOVD	m_curg(R6), R5
   239  	CMP		g, R5
   240  	BNE		noswitch
   241  
   242  	MOVD	m_g0(R6), R4
   243  	MOVD	(g_sched+gobuf_sp)(R4), R15	// Set SP to g0 stack
   244  
   245  noswitch:
   246  	SUB		$16, R15		// reserve 2x 8 bytes for parameters
   247  	MOVD	$~7, R4			// align to 8 bytes because of gcc ABI
   248  	AND		R4, R15
   249  	MOVD	R15, R3			// R15 needs to be in R3 as expected by kernel_clock_gettime
   250  
   251  	MOVB	runtime·iscgo(SB),R12
   252  	CMPBNE	R12, $0, nosaveg
   253  
   254  	MOVD	m_gsignal(R6), R12	// g.m.gsignal
   255  	CMPBEQ	R12, $0, nosaveg
   256  
   257  	CMPBEQ	g, R12, nosaveg
   258  	MOVD	(g_stack+stack_lo)(R12), R12 // g.m.gsignal.stack.lo
   259  	MOVD	g, (R12)
   260  
   261  	BL	R9 // to vdso lookup
   262  
   263  	MOVD	$0, (R12)
   264  
   265  	JMP	finish
   266  
   267  nosaveg:
   268  	BL	R9					// to vdso lookup
   269  
   270  finish:
   271  	MOVD	0(R15), R3		// sec
   272  	MOVD	8(R15), R5		// nsec
   273  	MOVD	R7, R15			// Restore SP
   274  
   275  	// Restore vdsoPC, vdsoSP
   276  	// We don't worry about being signaled between the two stores.
   277  	// If we are not in a signal handler, we'll restore vdsoSP to 0,
   278  	// and no one will care about vdsoPC. If we are in a signal handler,
   279  	// we cannot receive another signal.
   280  	MOVD	24(R15), R12
   281  	MOVD	R12, m_vdsoSP(R6)
   282  	MOVD	16(R15), R12
   283  	MOVD	R12, m_vdsoPC(R6)
   284  
   285  return:
   286  	// sec is in R3, nsec in R5
   287  	// return nsec in R3
   288  	MOVD	R3, sec+0(FP)
   289  	MOVW	R5, nsec+8(FP)
   290  	RET
   291  
   292  	// Syscall fallback
   293  fallback:
   294  	MOVD	$tp-16(SP), R3
   295  	MOVW	$SYS_clock_gettime, R1
   296  	SYSCALL
   297  	LMG		tp-16(SP), R2, R3
   298  	// sec is in R2, nsec in R3
   299  	MOVD	R2, sec+0(FP)
   300  	MOVW	R3, nsec+8(FP)
   301  	RET
   302  
   303  TEXT runtime·nanotime1(SB),NOSPLIT,$32-8
   304  	MOVW	$1, R2			// CLOCK_MONOTONIC
   305  
   306  	MOVD	R15, R7			// Backup stack pointer
   307  
   308  	MOVD	g_m(g), R6		//m
   309  
   310  	MOVD	runtime·vdsoClockgettimeSym(SB), R9	// Check for VDSO availability
   311  	CMPBEQ	R9, $0, fallback
   312  
   313  	MOVD	m_vdsoPC(R6), R4
   314  	MOVD	R4, 16(R15)
   315  	MOVD	m_vdsoSP(R6), R4
   316  	MOVD	R4, 24(R15)
   317  
   318  	MOVD	R14, R8			// Backup return address
   319  	MOVD	$ret+0(FP), R4	// caller's SP
   320  
   321  	MOVD	R8, m_vdsoPC(R6)
   322  	MOVD	R4, m_vdsoSP(R6)
   323  
   324  	MOVD	m_curg(R6), R5
   325  	CMP		g, R5
   326  	BNE		noswitch
   327  
   328  	MOVD	m_g0(R6), R4
   329  	MOVD	(g_sched+gobuf_sp)(R4), R15	// Set SP to g0 stack
   330  
   331  noswitch:
   332  	SUB		$16, R15		// reserve 2x 8 bytes for parameters
   333  	MOVD	$~7, R4			// align to 8 bytes because of gcc ABI
   334  	AND		R4, R15
   335  	MOVD	R15, R3			// R15 needs to be in R3 as expected by kernel_clock_gettime
   336  
   337  	MOVB	runtime·iscgo(SB),R12
   338  	CMPBNE	R12, $0, nosaveg
   339  
   340  	MOVD	m_gsignal(R6), R12	// g.m.gsignal
   341  	CMPBEQ	R12, $0, nosaveg
   342  
   343  	CMPBEQ	g, R12, nosaveg
   344  	MOVD	(g_stack+stack_lo)(R12), R12	// g.m.gsignal.stack.lo
   345  	MOVD	g, (R12)
   346  
   347  	BL	R9 					// to vdso lookup
   348  
   349  	MOVD $0, (R12)
   350  
   351  	JMP	finish
   352  
   353  nosaveg:
   354  	BL	R9					// to vdso lookup
   355  
   356  finish:
   357  	MOVD	0(R15), R3		// sec
   358  	MOVD	8(R15), R5		// nsec
   359  	MOVD	R7, R15			// Restore SP
   360  
   361  	// Restore vdsoPC, vdsoSP
   362  	// We don't worry about being signaled between the two stores.
   363  	// If we are not in a signal handler, we'll restore vdsoSP to 0,
   364  	// and no one will care about vdsoPC. If we are in a signal handler,
   365  	// we cannot receive another signal.
   366  
   367  	MOVD	24(R15), R12
   368  	MOVD	R12, m_vdsoSP(R6)
   369  	MOVD	16(R15), R12
   370  	MOVD	R12, m_vdsoPC(R6)
   371  
   372  return:
   373  	// sec is in R3, nsec in R5
   374  	// return nsec in R3
   375  	MULLD	$1000000000, R3
   376  	ADD		R5, R3
   377  	MOVD	R3, ret+0(FP)
   378  	RET
   379  
   380  	// Syscall fallback
   381  fallback:
   382  	MOVD	$tp-16(SP), R3
   383  	MOVD	$SYS_clock_gettime, R1
   384  	SYSCALL
   385  	LMG		tp-16(SP), R2, R3
   386  	MOVD	R3, R5
   387  	MOVD	R2, R3
   388  	JMP	return
   389  
   390  TEXT runtime·rtsigprocmask(SB),NOSPLIT|NOFRAME,$0-28
   391  	MOVW	how+0(FP), R2
   392  	MOVD	new+8(FP), R3
   393  	MOVD	old+16(FP), R4
   394  	MOVW	size+24(FP), R5
   395  	MOVW	$SYS_rt_sigprocmask, R1
   396  	SYSCALL
   397  	MOVD	$-4095, R3
   398  	CMPUBLT	R2, R3, 2(PC)
   399  	MOVD	R0, 0(R0) // crash
   400  	RET
   401  
   402  TEXT runtime·rt_sigaction(SB),NOSPLIT|NOFRAME,$0-36
   403  	MOVD	sig+0(FP), R2
   404  	MOVD	new+8(FP), R3
   405  	MOVD	old+16(FP), R4
   406  	MOVD	size+24(FP), R5
   407  	MOVW	$SYS_rt_sigaction, R1
   408  	SYSCALL
   409  	MOVW	R2, ret+32(FP)
   410  	RET
   411  
   412  TEXT runtime·sigfwd(SB),NOSPLIT,$0-32
   413  	MOVW	sig+8(FP), R2
   414  	MOVD	info+16(FP), R3
   415  	MOVD	ctx+24(FP), R4
   416  	MOVD	fn+0(FP), R5
   417  	BL	R5
   418  	RET
   419  
   420  TEXT runtime·sigreturn(SB),NOSPLIT,$0-0
   421  	RET
   422  
   423  TEXT runtime·sigtramp(SB),NOSPLIT|TOPFRAME,$64
   424  	// initialize essential registers (just in case)
   425  	XOR	R0, R0
   426  
   427  	// this might be called in external code context,
   428  	// where g is not set.
   429  	MOVB	runtime·iscgo(SB), R6
   430  	CMPBEQ	R6, $0, 2(PC)
   431  	BL	runtime·load_g(SB)
   432  
   433  	MOVW	R2, 8(R15)
   434  	MOVD	R3, 16(R15)
   435  	MOVD	R4, 24(R15)
   436  	MOVD	$runtime·sigtrampgo(SB), R5
   437  	BL	R5
   438  	RET
   439  
   440  TEXT runtime·cgoSigtramp(SB),NOSPLIT,$0
   441  	BR	runtime·sigtramp(SB)
   442  
   443  // func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uint32) unsafe.Pointer
   444  TEXT runtime·mmap(SB),NOSPLIT,$48-48
   445  	MOVD	addr+0(FP), R2
   446  	MOVD	n+8(FP), R3
   447  	MOVW	prot+16(FP), R4
   448  	MOVW	flags+20(FP), R5
   449  	MOVW	fd+24(FP), R6
   450  	MOVWZ	off+28(FP), R7
   451  
   452  	// s390x uses old_mmap, so the arguments need to be placed into
   453  	// a struct and a pointer to the struct passed to mmap.
   454  	MOVD	R2, addr-48(SP)
   455  	MOVD	R3, n-40(SP)
   456  	MOVD	R4, prot-32(SP)
   457  	MOVD	R5, flags-24(SP)
   458  	MOVD	R6, fd-16(SP)
   459  	MOVD	R7, off-8(SP)
   460  
   461  	MOVD	$addr-48(SP), R2
   462  	MOVW	$SYS_mmap, R1
   463  	SYSCALL
   464  	MOVD	$-4095, R3
   465  	CMPUBLT	R2, R3, ok
   466  	NEG	R2
   467  	MOVD	$0, p+32(FP)
   468  	MOVD	R2, err+40(FP)
   469  	RET
   470  ok:
   471  	MOVD	R2, p+32(FP)
   472  	MOVD	$0, err+40(FP)
   473  	RET
   474  
   475  TEXT runtime·munmap(SB),NOSPLIT|NOFRAME,$0
   476  	MOVD	addr+0(FP), R2
   477  	MOVD	n+8(FP), R3
   478  	MOVW	$SYS_munmap, R1
   479  	SYSCALL
   480  	MOVD	$-4095, R3
   481  	CMPUBLT	R2, R3, 2(PC)
   482  	MOVD	R0, 0(R0) // crash
   483  	RET
   484  
   485  TEXT runtime·madvise(SB),NOSPLIT|NOFRAME,$0
   486  	MOVD	addr+0(FP), R2
   487  	MOVD	n+8(FP), R3
   488  	MOVW	flags+16(FP), R4
   489  	MOVW	$SYS_madvise, R1
   490  	SYSCALL
   491  	MOVW	R2, ret+24(FP)
   492  	RET
   493  
   494  // int64 futex(int32 *uaddr, int32 op, int32 val,
   495  //	struct timespec *timeout, int32 *uaddr2, int32 val2);
   496  TEXT runtime·futex(SB),NOSPLIT|NOFRAME,$0
   497  	MOVD	addr+0(FP), R2
   498  	MOVW	op+8(FP), R3
   499  	MOVW	val+12(FP), R4
   500  	MOVD	ts+16(FP), R5
   501  	MOVD	addr2+24(FP), R6
   502  	MOVW	val3+32(FP),  R7
   503  	MOVW	$SYS_futex, R1
   504  	SYSCALL
   505  	MOVW	R2, ret+40(FP)
   506  	RET
   507  
   508  // int32 clone(int32 flags, void *stk, M *mp, G *gp, void (*fn)(void));
   509  TEXT runtime·clone(SB),NOSPLIT|NOFRAME,$0
   510  	MOVW	flags+0(FP), R3
   511  	MOVD	stk+8(FP), R2
   512  
   513  	// Copy mp, gp, fn off parent stack for use by child.
   514  	// Careful: Linux system call clobbers ???.
   515  	MOVD	mp+16(FP), R7
   516  	MOVD	gp+24(FP), R8
   517  	MOVD	fn+32(FP), R9
   518  
   519  	MOVD	R7, -8(R2)
   520  	MOVD	R8, -16(R2)
   521  	MOVD	R9, -24(R2)
   522  	MOVD	$1234, R7
   523  	MOVD	R7, -32(R2)
   524  
   525  	SYSCALL $SYS_clone
   526  
   527  	// In parent, return.
   528  	CMPBEQ	R2, $0, 3(PC)
   529  	MOVW	R2, ret+40(FP)
   530  	RET
   531  
   532  	// In child, on new stack.
   533  	// initialize essential registers
   534  	XOR	R0, R0
   535  	MOVD	-32(R15), R7
   536  	CMP	R7, $1234
   537  	BEQ	2(PC)
   538  	MOVD	R0, 0(R0)
   539  
   540  	// Initialize m->procid to Linux tid
   541  	SYSCALL $SYS_gettid
   542  
   543  	MOVD	-24(R15), R9        // fn
   544  	MOVD	-16(R15), R8        // g
   545  	MOVD	-8(R15), R7         // m
   546  
   547  	CMPBEQ	R7, $0, nog
   548  	CMP	R8, $0
   549  	BEQ	nog
   550  
   551  	MOVD	R2, m_procid(R7)
   552  
   553  	// In child, set up new stack
   554  	MOVD	R7, g_m(R8)
   555  	MOVD	R8, g
   556  	//CALL	runtime·stackcheck(SB)
   557  
   558  nog:
   559  	// Call fn
   560  	BL	R9
   561  
   562  	// It shouldn't return.	 If it does, exit that thread.
   563  	MOVW	$111, R2
   564  	MOVW	$SYS_exit, R1
   565  	SYSCALL
   566  	BR	-2(PC)	// keep exiting
   567  
   568  TEXT runtime·sigaltstack(SB),NOSPLIT|NOFRAME,$0
   569  	MOVD	new+0(FP), R2
   570  	MOVD	old+8(FP), R3
   571  	MOVW	$SYS_sigaltstack, R1
   572  	SYSCALL
   573  	MOVD	$-4095, R3
   574  	CMPUBLT	R2, R3, 2(PC)
   575  	MOVD	R0, 0(R0) // crash
   576  	RET
   577  
   578  TEXT runtime·osyield(SB),NOSPLIT|NOFRAME,$0
   579  	MOVW	$SYS_sched_yield, R1
   580  	SYSCALL
   581  	RET
   582  
   583  TEXT runtime·sched_getaffinity(SB),NOSPLIT|NOFRAME,$0
   584  	MOVD	pid+0(FP), R2
   585  	MOVD	len+8(FP), R3
   586  	MOVD	buf+16(FP), R4
   587  	MOVW	$SYS_sched_getaffinity, R1
   588  	SYSCALL
   589  	MOVW	R2, ret+24(FP)
   590  	RET
   591  
   592  // int32 runtime·epollcreate(int32 size);
   593  TEXT runtime·epollcreate(SB),NOSPLIT|NOFRAME,$0
   594  	MOVW    size+0(FP), R2
   595  	MOVW	$SYS_epoll_create, R1
   596  	SYSCALL
   597  	MOVW	R2, ret+8(FP)
   598  	RET
   599  
   600  // int32 runtime·epollcreate1(int32 flags);
   601  TEXT runtime·epollcreate1(SB),NOSPLIT|NOFRAME,$0
   602  	MOVW	flags+0(FP), R2
   603  	MOVW	$SYS_epoll_create1, R1
   604  	SYSCALL
   605  	MOVW	R2, ret+8(FP)
   606  	RET
   607  
   608  // func epollctl(epfd, op, fd int32, ev *epollEvent) int
   609  TEXT runtime·epollctl(SB),NOSPLIT|NOFRAME,$0
   610  	MOVW	epfd+0(FP), R2
   611  	MOVW	op+4(FP), R3
   612  	MOVW	fd+8(FP), R4
   613  	MOVD	ev+16(FP), R5
   614  	MOVW	$SYS_epoll_ctl, R1
   615  	SYSCALL
   616  	MOVW	R2, ret+24(FP)
   617  	RET
   618  
   619  // int32 runtime·epollwait(int32 epfd, EpollEvent *ev, int32 nev, int32 timeout);
   620  TEXT runtime·epollwait(SB),NOSPLIT|NOFRAME,$0
   621  	MOVW	epfd+0(FP), R2
   622  	MOVD	ev+8(FP), R3
   623  	MOVW	nev+16(FP), R4
   624  	MOVW	timeout+20(FP), R5
   625  	MOVW	$SYS_epoll_wait, R1
   626  	SYSCALL
   627  	MOVW	R2, ret+24(FP)
   628  	RET
   629  
   630  // void runtime·closeonexec(int32 fd);
   631  TEXT runtime·closeonexec(SB),NOSPLIT|NOFRAME,$0
   632  	MOVW    fd+0(FP), R2  // fd
   633  	MOVD    $2, R3  // F_SETFD
   634  	MOVD    $1, R4  // FD_CLOEXEC
   635  	MOVW	$SYS_fcntl, R1
   636  	SYSCALL
   637  	RET
   638  
   639  // func sbrk0() uintptr
   640  TEXT runtime·sbrk0(SB),NOSPLIT|NOFRAME,$0-8
   641  	// Implemented as brk(NULL).
   642  	MOVD	$0, R2
   643  	MOVW	$SYS_brk, R1
   644  	SYSCALL
   645  	MOVD	R2, ret+0(FP)
   646  	RET
   647  
   648  TEXT runtime·access(SB),$0-20
   649  	MOVD	$0, 2(R0) // unimplemented, only needed for android; declared in stubs_linux.go
   650  	MOVW	R0, ret+16(FP)
   651  	RET
   652  
   653  TEXT runtime·connect(SB),$0-28
   654  	MOVD	$0, 2(R0) // unimplemented, only needed for android; declared in stubs_linux.go
   655  	MOVW	R0, ret+24(FP)
   656  	RET
   657  
   658  TEXT runtime·socket(SB),$0-20
   659  	MOVD	$0, 2(R0) // unimplemented, only needed for android; declared in stubs_linux.go
   660  	MOVW	R0, ret+16(FP)
   661  	RET
   662  

View as plain text