...
Run Format

Text file src/syscall/asm_plan9_arm.s

Documentation: syscall

     1	// Copyright 2009 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	#include "textflag.h"
     6	#include "funcdata.h"
     7	
     8	#define SYS_ERRSTR 41	/* from zsysnum_plan9.go */
     9	#define SYS_SEEK 39	/* from zsysnum_plan9.go */
    10	
    11	// System call support for plan9 on arm
    12	
    13	//func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err ErrorString)
    14	TEXT	·Syscall(SB),NOSPLIT,$144-32
    15		NO_LOCAL_POINTERS
    16		BL		runtime·entersyscall(SB)
    17		MOVW	$a1+4(FP), R0	// move syscall args
    18		MOVW	$sysargs-144(SP), R1
    19		MOVM.IA	(R0), [R2-R4]
    20		MOVM.IA	[R2-R4], (R1)
    21		MOVW	trap+0(FP), R0	// syscall num
    22		SWI		$0
    23		MOVW	$0, R2
    24		MOVW	$r1+16(FP), R3
    25		MOVM.IA	[R0,R2], (R3)
    26		CMP		$-1, R0
    27		B.EQ	syscallerr
    28		BL		runtime·exitsyscall(SB)
    29		MOVW	$·emptystring+0(SB), R2
    30		B		syscallok
    31	syscallerr:
    32		MOVW	$errbuf-128(SP), R2
    33		MOVW	$128, R3
    34		MOVM.IA	[R2,R3], (R1)
    35		MOVW	$SYS_ERRSTR, R0
    36		SWI		$0
    37		BL		runtime·exitsyscall(SB)
    38		BL		runtime·gostring(SB)
    39		MOVW	$str-140(SP), R2
    40	syscallok:
    41		MOVW	$err+24(FP), R1
    42		MOVM.IA	(R2), [R3-R4]
    43		MOVM.IA	[R3-R4], (R1)
    44		RET
    45	
    46	
    47	//func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err ErrorString)
    48	// Actually Syscall5 but the rest of the code expects it to be named Syscall6.
    49	TEXT	·Syscall6(SB),NOSPLIT,$144-44
    50		NO_LOCAL_POINTERS
    51		BL		runtime·entersyscall(SB)
    52		MOVW	$a1+4(FP), R0	// move syscall args
    53		MOVW	$sysargs-144(SP), R1
    54		MOVM.IA	(R0), [R2-R6]
    55		MOVM.IA	[R2-R6], (R1)
    56		MOVW	trap+0(FP), R0	// syscall num
    57		SWI		$0
    58		MOVW	$0, R2
    59		MOVW	$r1+28(FP), R3
    60		MOVM.IA.W	[R0,R2], (R3)
    61		CMP		$-1, R0
    62		B.EQ	syscall6err
    63		BL		runtime·exitsyscall(SB)
    64		MOVW	$·emptystring+0(SB), R2
    65		B		syscall6ok
    66	syscall6err:
    67		MOVW	$errbuf-128(SP), R2
    68		MOVW	$128, R3
    69		MOVM.IA	[R2,R3], (R1)
    70		MOVW	$SYS_ERRSTR, R0
    71		SWI		$0
    72		BL		runtime·exitsyscall(SB)
    73		BL		runtime·gostring(SB)
    74		MOVW	$str-140(SP), R2
    75	syscall6ok:
    76		MOVW	$err+36(FP), R1
    77		MOVM.IA	(R2), [R3-R4]
    78		MOVM.IA	[R3-R4], (R1)
    79		RET
    80	
    81	//func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
    82	TEXT ·RawSyscall(SB),NOSPLIT,$12-28
    83		MOVW	$a1+4(FP), R0	// move syscall args
    84		MOVW	$sysargs-12(SP), R1
    85		MOVM.IA	(R0), [R2-R4]
    86		MOVM.IA	[R2-R4], (R1)
    87		MOVW	trap+0(FP), R0	// syscall num
    88		SWI		$0
    89		MOVW	R0, r1+16(FP)
    90		MOVW	R0, r2+20(FP)
    91		MOVW	R0, err+24(FP)
    92		RET
    93	
    94	//func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
    95	// Actually RawSyscall5 but the rest of the code expects it to be named RawSyscall6.
    96	TEXT	·RawSyscall6(SB),NOSPLIT,$20-40
    97		MOVW	$a1+4(FP), R0	// move syscall args
    98		MOVW	$sysargs-20(SP), R1
    99		MOVM.IA	(R0), [R2-R6]
   100		MOVM.IA	[R2-R6], (R1)
   101		MOVW	trap+0(FP), R0	// syscall num
   102		SWI		$0
   103		MOVW	R0, r1+28(FP)
   104		MOVW	R0, r2+32(FP)
   105		MOVW	R0, err+36(FP)
   106		RET
   107	
   108	//func seek(placeholder uintptr, fd int, offset int64, whence int) (newoffset int64, err string)
   109	TEXT ·seek(SB),NOSPLIT,$20-36
   110		NO_LOCAL_POINTERS
   111		MOVW	$newoffset_lo+20(FP), R6
   112		MOVW	R6, sysargs-20(SP)	// dest for return value
   113		MOVW	$fd+4(FP), R0		// move syscall args
   114		MOVW	$sysarg1-16(SP), R1
   115		MOVM.IA	(R0), [R2-R5]
   116		MOVM.IA	[R2-R5], (R1)
   117		MOVW	$SYS_SEEK, R0		// syscall num
   118		SWI		$0
   119		CMP		$-1, R0
   120		B.EQ	seekerr
   121		MOVW	$·emptystring+0(SB), R2
   122		B		seekok
   123	seekerr:
   124		MOVW	R0, 0(R6)
   125		MOVW	R0, 4(R6)
   126		BL		·errstr(SB)
   127		MOVW	$ret-20(SP), R2
   128	seekok:
   129		MOVW	$err+28(FP), R1
   130		MOVM.IA	(R2), [R3-R4]
   131		MOVM.IA	[R3-R4], (R1)
   132		RET

View as plain text