Text file
src/syscall/asm_linux_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//
9// System calls for arm, Linux
10//
11
12#define SYS__LLSEEK 140 /* from zsysnum_linux_arm.go */
13// func seek(fd int, offset int64, whence int) (newoffset int64, errno int)
14// Implemented in assembly to avoid allocation when
15// taking the address of the return value newoffset.
16// Underlying system call is
17// llseek(int fd, int offhi, int offlo, int64 *result, int whence)
18TEXT ·seek(SB),NOSPLIT,$0-28
19 BL runtime·entersyscall(SB)
20 MOVW $SYS__LLSEEK, R7 // syscall entry
21 MOVW fd+0(FP), R0
22 MOVW offset_hi+8(FP), R1
23 MOVW offset_lo+4(FP), R2
24 MOVW $newoffset_lo+16(FP), R3
25 MOVW whence+12(FP), R4
26 SWI $0
27 MOVW $0xfffff001, R6
28 CMP R6, R0
29 BLS okseek
30 MOVW $0, R1
31 MOVW R1, newoffset_lo+16(FP)
32 MOVW R1, newoffset_hi+20(FP)
33 RSB $0, R0, R0
34 MOVW R0, err+24(FP)
35 BL runtime·exitsyscall(SB)
36 RET
37okseek:
38 // system call filled in newoffset already
39 MOVW $0, R0
40 MOVW R0, err+24(FP)
41 BL runtime·exitsyscall(SB)
42 RET
43
44// func rawVforkSyscall(trap, a1, a2, a3 uintptr) (r1, err uintptr)
45TEXT ·rawVforkSyscall(SB),NOSPLIT|NOFRAME,$0-24
46 MOVW trap+0(FP), R7 // syscall entry
47 MOVW a1+4(FP), R0
48 MOVW a2+8(FP), R1
49 MOVW a3+12(FP), R2
50 SWI $0
51 MOVW $0xfffff001, R1
52 CMP R1, R0
53 BLS ok
54 MOVW $-1, R1
55 MOVW R1, r1+16(FP)
56 RSB $0, R0, R0
57 MOVW R0, err+20(FP)
58 RET
59ok:
60 MOVW R0, r1+16(FP)
61 MOVW $0, R0
62 MOVW R0, err+20(FP)
63 RET
64
65// func rawSyscallNoError(trap uintptr, a1, a2, a3 uintptr) (r1, r2 uintptr);
66TEXT ·rawSyscallNoError(SB),NOSPLIT,$0-24
67 MOVW trap+0(FP), R7 // syscall entry
68 MOVW a1+4(FP), R0
69 MOVW a2+8(FP), R1
70 MOVW a3+12(FP), R2
71 SWI $0
72 MOVW R0, r1+16(FP)
73 MOVW $0, R0
74 MOVW R0, r2+20(FP)
75 RET
View as plain text