LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // | 5 // |
6 // System calls and other sys.stuff for arm, Linux | 6 // System calls and other sys.stuff for arm, Linux |
7 // | 7 // |
8 | 8 |
9 #include "arm/asm.h" | 9 #include "arm/asm.h" |
10 | 10 |
11 // OABI | 11 // OABI |
12 //#define SYS_BASE 0x00900000 | 12 //#define SYS_BASE 0x00900000 |
13 | 13 |
14 // EABI | 14 // EABI |
15 #define SYS_BASE 0x0 | 15 #define SYS_BASE 0x0 |
16 | 16 |
17 #define SYS_exit (SYS_BASE + 1) | 17 #define SYS_exit (SYS_BASE + 1) |
| 18 #define SYS_read (SYS_BASE + 3) |
18 #define SYS_write (SYS_BASE + 4) | 19 #define SYS_write (SYS_BASE + 4) |
| 20 #define SYS_open (SYS_BASE + 5) |
| 21 #define SYS_close (SYS_BASE + 6) |
19 #define SYS_gettimeofday (SYS_BASE + 78) | 22 #define SYS_gettimeofday (SYS_BASE + 78) |
20 #define SYS_clone (SYS_BASE + 120) | 23 #define SYS_clone (SYS_BASE + 120) |
21 #define SYS_rt_sigreturn (SYS_BASE + 173) | 24 #define SYS_rt_sigreturn (SYS_BASE + 173) |
22 #define SYS_rt_sigaction (SYS_BASE + 174) | 25 #define SYS_rt_sigaction (SYS_BASE + 174) |
23 #define SYS_sigaltstack (SYS_BASE + 186) | 26 #define SYS_sigaltstack (SYS_BASE + 186) |
24 #define SYS_mmap2 (SYS_BASE + 192) | 27 #define SYS_mmap2 (SYS_BASE + 192) |
25 #define SYS_futex (SYS_BASE + 240) | 28 #define SYS_futex (SYS_BASE + 240) |
26 #define SYS_exit_group (SYS_BASE + 248) | 29 #define SYS_exit_group (SYS_BASE + 248) |
27 #define SYS_munmap (SYS_BASE + 91) | 30 #define SYS_munmap (SYS_BASE + 91) |
28 #define SYS_setitimer (SYS_BASE + 104) | 31 #define SYS_setitimer (SYS_BASE + 104) |
29 #define SYS_mincore (SYS_BASE + 219) | 32 #define SYS_mincore (SYS_BASE + 219) |
30 #define SYS_gettid (SYS_BASE + 224) | 33 #define SYS_gettid (SYS_BASE + 224) |
31 #define SYS_tkill (SYS_BASE + 238) | 34 #define SYS_tkill (SYS_BASE + 238) |
32 #define SYS_sched_yield (SYS_BASE + 158) | 35 #define SYS_sched_yield (SYS_BASE + 158) |
33 | 36 |
34 #define ARM_BASE (SYS_BASE + 0x0f0000) | 37 #define ARM_BASE (SYS_BASE + 0x0f0000) |
35 #define SYS_ARM_cacheflush (ARM_BASE + 2) | 38 #define SYS_ARM_cacheflush (ARM_BASE + 2) |
36 | 39 |
| 40 TEXT runtime·open(SB),7,$0 |
| 41 MOVW 0(FP), R0 |
| 42 MOVW 4(FP), R1 |
| 43 MOVW 8(FP), R2 |
| 44 MOVW $SYS_open, R7 |
| 45 SWI $0 |
| 46 RET |
| 47 |
| 48 TEXT runtime·close(SB),7,$0 |
| 49 MOVW 0(FP), R0 |
| 50 MOVW $SYS_close, R7 |
| 51 SWI $0 |
| 52 RET |
| 53 |
37 TEXT runtime·write(SB),7,$0 | 54 TEXT runtime·write(SB),7,$0 |
38 MOVW 0(FP), R0 | 55 MOVW 0(FP), R0 |
39 MOVW 4(FP), R1 | 56 MOVW 4(FP), R1 |
40 MOVW 8(FP), R2 | 57 MOVW 8(FP), R2 |
41 MOVW $SYS_write, R7 | 58 MOVW $SYS_write, R7 |
| 59 SWI $0 |
| 60 RET |
| 61 |
| 62 TEXT runtime·read(SB),7,$0 |
| 63 MOVW 0(FP), R0 |
| 64 MOVW 4(FP), R1 |
| 65 MOVW 8(FP), R2 |
| 66 MOVW $SYS_read, R7 |
42 SWI $0 | 67 SWI $0 |
43 RET | 68 RET |
44 | 69 |
45 TEXT runtime·exit(SB),7,$-4 | 70 TEXT runtime·exit(SB),7,$-4 |
46 MOVW 0(FP), R0 | 71 MOVW 0(FP), R0 |
47 MOVW $SYS_exit_group, R7 | 72 MOVW $SYS_exit_group, R7 |
48 SWI $0 | 73 SWI $0 |
49 MOVW $1234, R0 | 74 MOVW $1234, R0 |
50 MOVW $1002, R1 | 75 MOVW $1002, R1 |
51 MOVW R0, (R1) // fail hard | 76 MOVW R0, (R1) // fail hard |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 MOVW 0(R2), R3 | 306 MOVW 0(R2), R3 |
282 CMP R0, R3 | 307 CMP R0, R3 |
283 BEQ casagain | 308 BEQ casagain |
284 MOVW $0, R0 | 309 MOVW $0, R0 |
285 RET | 310 RET |
286 | 311 |
287 | 312 |
288 TEXT runtime·casp(SB),7,$0 | 313 TEXT runtime·casp(SB),7,$0 |
289 B runtime·cas(SB) | 314 B runtime·cas(SB) |
290 | 315 |
291 TEXT runtime·schedyield(SB),7,$0 | 316 TEXT runtime·osyield(SB),7,$0 |
292 MOVW $SYS_sched_yield, R7 | 317 MOVW $SYS_sched_yield, R7 |
293 SWI $0 | 318 SWI $0 |
294 RET | 319 RET |
LEFT | RIGHT |