OLD | NEW |
1 // Copyright 2012 The Go Authors. All rights reserved. | 1 // Copyright 2012 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 // System calls and other sys.stuff for ARM, FreeBSD | 5 // System calls and other sys.stuff for ARM, FreeBSD |
6 // /usr/src/sys/kern/syscalls.master for syscall numbers. | 6 // /usr/src/sys/kern/syscalls.master for syscall numbers. |
7 // | 7 // |
8 | 8 |
9 #include "zasm_GOOS_GOARCH.h" | 9 #include "go_asm.h" |
| 10 #include "go_tls.h" |
10 #include "textflag.h" | 11 #include "textflag.h" |
11 | 12 |
12 // for EABI, as we don't support OABI | 13 // for EABI, as we don't support OABI |
13 #define SYS_BASE 0x0 | 14 #define SYS_BASE 0x0 |
14 | 15 |
15 #define SYS_exit (SYS_BASE + 1) | 16 #define SYS_exit (SYS_BASE + 1) |
16 #define SYS_read (SYS_BASE + 3) | 17 #define SYS_read (SYS_BASE + 3) |
17 #define SYS_write (SYS_BASE + 4) | 18 #define SYS_write (SYS_BASE + 4) |
18 #define SYS_open (SYS_BASE + 5) | 19 #define SYS_open (SYS_BASE + 5) |
19 #define SYS_close (SYS_BASE + 6) | 20 #define SYS_close (SYS_BASE + 6) |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 356 |
356 // void runtime·closeonexec(int32 fd) | 357 // void runtime·closeonexec(int32 fd) |
357 TEXT runtime·closeonexec(SB),NOSPLIT,$0 | 358 TEXT runtime·closeonexec(SB),NOSPLIT,$0 |
358 MOVW 0(FP), R0 // fd | 359 MOVW 0(FP), R0 // fd |
359 MOVW $2, R1 // F_SETFD | 360 MOVW $2, R1 // F_SETFD |
360 MOVW $1, R2 // FD_CLOEXEC | 361 MOVW $1, R2 // FD_CLOEXEC |
361 MOVW $SYS_fcntl, R7 | 362 MOVW $SYS_fcntl, R7 |
362 SWI $0 | 363 SWI $0 |
363 RET | 364 RET |
364 | 365 |
365 TEXT runtime·casp(SB),NOSPLIT,$0 | 366 TEXT runtime·casp1(SB),NOSPLIT,$0 |
366 B runtime·cas(SB) | 367 B runtime·cas(SB) |
367 | 368 |
368 // TODO(minux): this is only valid for ARMv6+ | 369 // TODO(minux): this is only valid for ARMv6+ |
369 // bool armcas(int32 *val, int32 old, int32 new) | 370 // bool armcas(int32 *val, int32 old, int32 new) |
370 // Atomically: | 371 // Atomically: |
371 // if(*val == old){ | 372 // if(*val == old){ |
372 // *val = new; | 373 // *val = new; |
373 // return 1; | 374 // return 1; |
374 // }else | 375 // }else |
375 // return 0; | 376 // return 0; |
376 TEXT runtime·cas(SB),NOSPLIT,$0 | 377 TEXT runtime·cas(SB),NOSPLIT,$0 |
377 B runtime·armcas(SB) | 378 B runtime·armcas(SB) |
378 | 379 |
379 // TODO(minux): this only supports ARMv6K+. | 380 // TODO(minux): this only supports ARMv6K+. |
380 TEXT runtime·read_tls_fallback(SB),NOSPLIT,$-4 | 381 TEXT runtime·read_tls_fallback(SB),NOSPLIT,$-4 |
381 WORD $0xee1d0f70 // mrc p15, 0, r0, c13, c0, 3 | 382 WORD $0xee1d0f70 // mrc p15, 0, r0, c13, c0, 3 |
382 RET | 383 RET |
OLD | NEW |