2012-10-12 09:19:39 -06:00
|
|
|
// Copyright 2012 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
//
|
|
|
|
// System calls and other sys.stuff for ARM, FreeBSD
|
|
|
|
// /usr/src/sys/kern/syscalls.master for syscall numbers.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "zasm_GOOS_GOARCH.h"
|
2013-08-07 13:20:05 -06:00
|
|
|
#include "../../cmd/ld/textflag.h"
|
2012-10-12 09:19:39 -06:00
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·sys_umtx_op(SB),NOSPLIT,$0
|
2012-10-12 09:19:39 -06:00
|
|
|
MOVW 0(FP), R0
|
|
|
|
MOVW 4(FP), R1
|
|
|
|
MOVW 8(FP), R2
|
|
|
|
MOVW 12(FP), R3
|
|
|
|
ADD $20, R13 // arg 5 is passed on stack
|
|
|
|
SWI $454
|
|
|
|
SUB $20, R13
|
|
|
|
// BCS error
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·thr_new(SB),NOSPLIT,$0
|
2012-10-12 09:19:39 -06:00
|
|
|
MOVW 0(FP), R0
|
|
|
|
MOVW 4(FP), R1
|
|
|
|
SWI $455
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·thr_start(SB),NOSPLIT,$0
|
2013-05-28 06:13:02 -06:00
|
|
|
MOVW R0, m
|
2012-10-12 09:19:39 -06:00
|
|
|
|
|
|
|
// set up g
|
2013-05-28 06:13:02 -06:00
|
|
|
MOVW m_g0(m), g
|
2012-10-12 09:19:39 -06:00
|
|
|
BL runtime·emptyfunc(SB) // fault if stack check is wrong
|
2013-03-01 09:44:43 -07:00
|
|
|
BL runtime·mstart(SB)
|
2013-03-01 06:30:11 -07:00
|
|
|
|
2013-05-28 06:13:02 -06:00
|
|
|
MOVW $2, R8 // crash (not reached)
|
|
|
|
MOVW R8, (R8)
|
2012-10-12 09:19:39 -06:00
|
|
|
RET
|
|
|
|
|
|
|
|
// Exit the entire program (like C exit)
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·exit(SB),NOSPLIT,$-8
|
2012-10-12 09:19:39 -06:00
|
|
|
MOVW 0(FP), R0 // arg 1 exit status
|
|
|
|
SWI $1
|
2013-05-28 06:13:02 -06:00
|
|
|
MOVW.CS $0, R8 // crash on syscall failure
|
|
|
|
MOVW.CS R8, (R8)
|
2012-10-12 09:19:39 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·exit1(SB),NOSPLIT,$-8
|
2012-10-12 09:19:39 -06:00
|
|
|
MOVW 0(FP), R0 // arg 1 exit status
|
|
|
|
SWI $431
|
2013-05-28 06:13:02 -06:00
|
|
|
MOVW.CS $0, R8 // crash on syscall failure
|
|
|
|
MOVW.CS R8, (R8)
|
2012-10-12 09:19:39 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·open(SB),NOSPLIT,$-8
|
2013-03-14 15:45:44 -06:00
|
|
|
MOVW 0(FP), R0 // arg 1 name
|
|
|
|
MOVW 4(FP), R1 // arg 2 mode
|
|
|
|
MOVW 8(FP), R2 // arg 3 perm
|
|
|
|
SWI $5
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·read(SB),NOSPLIT,$-8
|
2013-03-14 15:45:44 -06:00
|
|
|
MOVW 0(FP), R0 // arg 1 fd
|
|
|
|
MOVW 4(FP), R1 // arg 2 buf
|
|
|
|
MOVW 8(FP), R2 // arg 3 count
|
|
|
|
SWI $3
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·write(SB),NOSPLIT,$-8
|
2012-10-12 09:19:39 -06:00
|
|
|
MOVW 0(FP), R0 // arg 1 fd
|
|
|
|
MOVW 4(FP), R1 // arg 2 buf
|
|
|
|
MOVW 8(FP), R2 // arg 3 count
|
|
|
|
SWI $4
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·close(SB),NOSPLIT,$-8
|
2013-03-14 15:45:44 -06:00
|
|
|
MOVW 0(FP), R0 // arg 1 fd
|
|
|
|
SWI $6
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·getrlimit(SB),NOSPLIT,$-8
|
2012-10-12 09:19:39 -06:00
|
|
|
MOVW 0(FP), R0
|
|
|
|
MOVW 4(FP), R1
|
|
|
|
MOVW 8(FP), R2
|
|
|
|
SWI $194
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·raise(SB),NOSPLIT,$8
|
2012-10-12 09:19:39 -06:00
|
|
|
// thr_self(&4(R13))
|
|
|
|
MOVW $4(R13), R0 // arg 1 &4(R13)
|
|
|
|
SWI $432
|
|
|
|
// thr_kill(self, SIGPIPE)
|
|
|
|
MOVW 4(R13), R0 // arg 1 id
|
2013-03-14 23:11:03 -06:00
|
|
|
MOVW sig+0(FP), R1 // arg 2 - signal
|
2012-10-12 09:19:39 -06:00
|
|
|
SWI $433
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·setitimer(SB), NOSPLIT, $-8
|
2012-10-12 09:19:39 -06:00
|
|
|
MOVW 0(FP), R0
|
|
|
|
MOVW 4(FP), R1
|
|
|
|
MOVW 8(FP), R2
|
|
|
|
SWI $83
|
|
|
|
RET
|
|
|
|
|
|
|
|
// func now() (sec int64, nsec int32)
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT time·now(SB), NOSPLIT, $32
|
runtime: use clock_gettime to get ns resolution for time.now & runtime.nanotime
For Linux/{386,arm}, FreeBSD/{386,amd64,arm}, NetBSD/{386,amd64}, OpenBSD/{386,amd64}.
Note: our Darwin implementation already has ns resolution.
Linux/386 (Core i7-2600 @ 3.40GHz, kernel 3.5.2-gentoo)
benchmark old ns/op new ns/op delta
BenchmarkNow 110 118 +7.27%
Linux/ARM (ARM Cortex-A8 @ 800MHz, kernel 2.6.32.28 android)
benchmark old ns/op new ns/op delta
BenchmarkNow 625 542 -13.28%
Linux/ARM (ARM Cortex-A9 @ 1GHz, Pandaboard)
benchmark old ns/op new ns/op delta
BenchmarkNow 992 909 -8.37%
FreeBSD 9-REL-p1/amd64 (Dell R610 Server with Xeon X5650 @ 2.67GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 699 695 -0.57%
FreeBSD 9-REL-p1/amd64 (Atom D525 @ 1.80GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1553 1658 +6.76%
OpenBSD/amd64 (Dell E6410 with i5 CPU M 540 @ 2.53GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1262 1236 -2.06%
OpenBSD/i386 (Asus eeePC 701 with Intel Celeron M 900MHz - locked to 631MHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 5089 5043 -0.90%
NetBSD/i386 (VMware VM with Core i5 CPU @ 2.7GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 277 278 +0.36%
NetBSD/amd64 (VMware VM with Core i5 CPU @ 2.7Ghz)
benchmark old ns/op new ns/op delta
BenchmarkNow 103 105 +1.94%
Thanks Maxim Khitrov, Joel Sing, and Dave Cheney for providing benchmark data.
R=jsing, dave, rsc
CC=golang-dev
https://golang.org/cl/6820120
2012-12-18 07:57:25 -07:00
|
|
|
MOVW $0, R0 // CLOCK_REALTIME
|
|
|
|
MOVW $8(R13), R1
|
|
|
|
SWI $232 // clock_gettime
|
2012-10-12 09:19:39 -06:00
|
|
|
|
|
|
|
MOVW 8(R13), R0 // sec.low
|
runtime: use clock_gettime to get ns resolution for time.now & runtime.nanotime
For Linux/{386,arm}, FreeBSD/{386,amd64,arm}, NetBSD/{386,amd64}, OpenBSD/{386,amd64}.
Note: our Darwin implementation already has ns resolution.
Linux/386 (Core i7-2600 @ 3.40GHz, kernel 3.5.2-gentoo)
benchmark old ns/op new ns/op delta
BenchmarkNow 110 118 +7.27%
Linux/ARM (ARM Cortex-A8 @ 800MHz, kernel 2.6.32.28 android)
benchmark old ns/op new ns/op delta
BenchmarkNow 625 542 -13.28%
Linux/ARM (ARM Cortex-A9 @ 1GHz, Pandaboard)
benchmark old ns/op new ns/op delta
BenchmarkNow 992 909 -8.37%
FreeBSD 9-REL-p1/amd64 (Dell R610 Server with Xeon X5650 @ 2.67GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 699 695 -0.57%
FreeBSD 9-REL-p1/amd64 (Atom D525 @ 1.80GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1553 1658 +6.76%
OpenBSD/amd64 (Dell E6410 with i5 CPU M 540 @ 2.53GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1262 1236 -2.06%
OpenBSD/i386 (Asus eeePC 701 with Intel Celeron M 900MHz - locked to 631MHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 5089 5043 -0.90%
NetBSD/i386 (VMware VM with Core i5 CPU @ 2.7GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 277 278 +0.36%
NetBSD/amd64 (VMware VM with Core i5 CPU @ 2.7Ghz)
benchmark old ns/op new ns/op delta
BenchmarkNow 103 105 +1.94%
Thanks Maxim Khitrov, Joel Sing, and Dave Cheney for providing benchmark data.
R=jsing, dave, rsc
CC=golang-dev
https://golang.org/cl/6820120
2012-12-18 07:57:25 -07:00
|
|
|
MOVW 12(R13), R1 // sec.high
|
|
|
|
MOVW 16(R13), R2 // nsec
|
2012-10-12 09:19:39 -06:00
|
|
|
|
|
|
|
MOVW R0, 0(FP)
|
|
|
|
MOVW R1, 4(FP)
|
|
|
|
MOVW R2, 8(FP)
|
|
|
|
RET
|
|
|
|
|
|
|
|
// int64 nanotime(void) so really
|
|
|
|
// void nanotime(int64 *nsec)
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·nanotime(SB), NOSPLIT, $32
|
runtime: use clock_gettime to get ns resolution for time.now & runtime.nanotime
For Linux/{386,arm}, FreeBSD/{386,amd64,arm}, NetBSD/{386,amd64}, OpenBSD/{386,amd64}.
Note: our Darwin implementation already has ns resolution.
Linux/386 (Core i7-2600 @ 3.40GHz, kernel 3.5.2-gentoo)
benchmark old ns/op new ns/op delta
BenchmarkNow 110 118 +7.27%
Linux/ARM (ARM Cortex-A8 @ 800MHz, kernel 2.6.32.28 android)
benchmark old ns/op new ns/op delta
BenchmarkNow 625 542 -13.28%
Linux/ARM (ARM Cortex-A9 @ 1GHz, Pandaboard)
benchmark old ns/op new ns/op delta
BenchmarkNow 992 909 -8.37%
FreeBSD 9-REL-p1/amd64 (Dell R610 Server with Xeon X5650 @ 2.67GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 699 695 -0.57%
FreeBSD 9-REL-p1/amd64 (Atom D525 @ 1.80GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1553 1658 +6.76%
OpenBSD/amd64 (Dell E6410 with i5 CPU M 540 @ 2.53GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1262 1236 -2.06%
OpenBSD/i386 (Asus eeePC 701 with Intel Celeron M 900MHz - locked to 631MHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 5089 5043 -0.90%
NetBSD/i386 (VMware VM with Core i5 CPU @ 2.7GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 277 278 +0.36%
NetBSD/amd64 (VMware VM with Core i5 CPU @ 2.7Ghz)
benchmark old ns/op new ns/op delta
BenchmarkNow 103 105 +1.94%
Thanks Maxim Khitrov, Joel Sing, and Dave Cheney for providing benchmark data.
R=jsing, dave, rsc
CC=golang-dev
https://golang.org/cl/6820120
2012-12-18 07:57:25 -07:00
|
|
|
MOVW $0, R0 // CLOCK_REALTIME
|
|
|
|
MOVW $8(R13), R1
|
|
|
|
SWI $232 // clock_gettime
|
2012-10-12 09:19:39 -06:00
|
|
|
|
|
|
|
MOVW 8(R13), R0 // sec.low
|
runtime: use clock_gettime to get ns resolution for time.now & runtime.nanotime
For Linux/{386,arm}, FreeBSD/{386,amd64,arm}, NetBSD/{386,amd64}, OpenBSD/{386,amd64}.
Note: our Darwin implementation already has ns resolution.
Linux/386 (Core i7-2600 @ 3.40GHz, kernel 3.5.2-gentoo)
benchmark old ns/op new ns/op delta
BenchmarkNow 110 118 +7.27%
Linux/ARM (ARM Cortex-A8 @ 800MHz, kernel 2.6.32.28 android)
benchmark old ns/op new ns/op delta
BenchmarkNow 625 542 -13.28%
Linux/ARM (ARM Cortex-A9 @ 1GHz, Pandaboard)
benchmark old ns/op new ns/op delta
BenchmarkNow 992 909 -8.37%
FreeBSD 9-REL-p1/amd64 (Dell R610 Server with Xeon X5650 @ 2.67GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 699 695 -0.57%
FreeBSD 9-REL-p1/amd64 (Atom D525 @ 1.80GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1553 1658 +6.76%
OpenBSD/amd64 (Dell E6410 with i5 CPU M 540 @ 2.53GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1262 1236 -2.06%
OpenBSD/i386 (Asus eeePC 701 with Intel Celeron M 900MHz - locked to 631MHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 5089 5043 -0.90%
NetBSD/i386 (VMware VM with Core i5 CPU @ 2.7GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 277 278 +0.36%
NetBSD/amd64 (VMware VM with Core i5 CPU @ 2.7Ghz)
benchmark old ns/op new ns/op delta
BenchmarkNow 103 105 +1.94%
Thanks Maxim Khitrov, Joel Sing, and Dave Cheney for providing benchmark data.
R=jsing, dave, rsc
CC=golang-dev
https://golang.org/cl/6820120
2012-12-18 07:57:25 -07:00
|
|
|
MOVW 12(R13), R4 // sec.high
|
|
|
|
MOVW 16(R13), R2 // nsec
|
2012-10-12 09:19:39 -06:00
|
|
|
|
|
|
|
MOVW $1000000000, R3
|
|
|
|
MULLU R0, R3, (R1, R0)
|
runtime: use clock_gettime to get ns resolution for time.now & runtime.nanotime
For Linux/{386,arm}, FreeBSD/{386,amd64,arm}, NetBSD/{386,amd64}, OpenBSD/{386,amd64}.
Note: our Darwin implementation already has ns resolution.
Linux/386 (Core i7-2600 @ 3.40GHz, kernel 3.5.2-gentoo)
benchmark old ns/op new ns/op delta
BenchmarkNow 110 118 +7.27%
Linux/ARM (ARM Cortex-A8 @ 800MHz, kernel 2.6.32.28 android)
benchmark old ns/op new ns/op delta
BenchmarkNow 625 542 -13.28%
Linux/ARM (ARM Cortex-A9 @ 1GHz, Pandaboard)
benchmark old ns/op new ns/op delta
BenchmarkNow 992 909 -8.37%
FreeBSD 9-REL-p1/amd64 (Dell R610 Server with Xeon X5650 @ 2.67GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 699 695 -0.57%
FreeBSD 9-REL-p1/amd64 (Atom D525 @ 1.80GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1553 1658 +6.76%
OpenBSD/amd64 (Dell E6410 with i5 CPU M 540 @ 2.53GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1262 1236 -2.06%
OpenBSD/i386 (Asus eeePC 701 with Intel Celeron M 900MHz - locked to 631MHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 5089 5043 -0.90%
NetBSD/i386 (VMware VM with Core i5 CPU @ 2.7GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 277 278 +0.36%
NetBSD/amd64 (VMware VM with Core i5 CPU @ 2.7Ghz)
benchmark old ns/op new ns/op delta
BenchmarkNow 103 105 +1.94%
Thanks Maxim Khitrov, Joel Sing, and Dave Cheney for providing benchmark data.
R=jsing, dave, rsc
CC=golang-dev
https://golang.org/cl/6820120
2012-12-18 07:57:25 -07:00
|
|
|
MUL R3, R4
|
2012-10-12 09:19:39 -06:00
|
|
|
ADD.S R2, R0
|
|
|
|
ADC R4, R1
|
runtime: use clock_gettime to get ns resolution for time.now & runtime.nanotime
For Linux/{386,arm}, FreeBSD/{386,amd64,arm}, NetBSD/{386,amd64}, OpenBSD/{386,amd64}.
Note: our Darwin implementation already has ns resolution.
Linux/386 (Core i7-2600 @ 3.40GHz, kernel 3.5.2-gentoo)
benchmark old ns/op new ns/op delta
BenchmarkNow 110 118 +7.27%
Linux/ARM (ARM Cortex-A8 @ 800MHz, kernel 2.6.32.28 android)
benchmark old ns/op new ns/op delta
BenchmarkNow 625 542 -13.28%
Linux/ARM (ARM Cortex-A9 @ 1GHz, Pandaboard)
benchmark old ns/op new ns/op delta
BenchmarkNow 992 909 -8.37%
FreeBSD 9-REL-p1/amd64 (Dell R610 Server with Xeon X5650 @ 2.67GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 699 695 -0.57%
FreeBSD 9-REL-p1/amd64 (Atom D525 @ 1.80GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1553 1658 +6.76%
OpenBSD/amd64 (Dell E6410 with i5 CPU M 540 @ 2.53GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 1262 1236 -2.06%
OpenBSD/i386 (Asus eeePC 701 with Intel Celeron M 900MHz - locked to 631MHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 5089 5043 -0.90%
NetBSD/i386 (VMware VM with Core i5 CPU @ 2.7GHz)
benchmark old ns/op new ns/op delta
BenchmarkNow 277 278 +0.36%
NetBSD/amd64 (VMware VM with Core i5 CPU @ 2.7Ghz)
benchmark old ns/op new ns/op delta
BenchmarkNow 103 105 +1.94%
Thanks Maxim Khitrov, Joel Sing, and Dave Cheney for providing benchmark data.
R=jsing, dave, rsc
CC=golang-dev
https://golang.org/cl/6820120
2012-12-18 07:57:25 -07:00
|
|
|
|
2012-10-12 09:19:39 -06:00
|
|
|
MOVW 0(FP), R3
|
|
|
|
MOVW R0, 0(R3)
|
|
|
|
MOVW R1, 4(R3)
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·sigaction(SB),NOSPLIT,$-8
|
2012-10-12 09:19:39 -06:00
|
|
|
MOVW 0(FP), R0 // arg 1 sig
|
|
|
|
MOVW 4(FP), R1 // arg 2 act
|
|
|
|
MOVW 8(FP), R2 // arg 3 oact
|
|
|
|
SWI $416
|
2013-05-28 06:13:02 -06:00
|
|
|
MOVW.CS $0, R8 // crash on syscall failure
|
|
|
|
MOVW.CS R8, (R8)
|
2012-10-12 09:19:39 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·sigtramp(SB),NOSPLIT,$24
|
2012-10-12 09:19:39 -06:00
|
|
|
// this might be called in external code context,
|
|
|
|
// where g and m are not set.
|
2013-08-14 11:18:32 -06:00
|
|
|
// first save R0, because runtime·load_gm will clobber it
|
2012-10-12 09:19:39 -06:00
|
|
|
MOVW R0, 4(R13) // signum
|
2013-08-14 11:18:32 -06:00
|
|
|
MOVB runtime·iscgo(SB), R0
|
2012-10-12 09:19:39 -06:00
|
|
|
CMP $0, R0
|
2013-08-14 11:18:32 -06:00
|
|
|
BL.NE runtime·load_gm(SB)
|
2012-10-12 09:19:39 -06:00
|
|
|
|
2013-05-27 06:46:53 -06:00
|
|
|
CMP $0, m
|
2013-07-11 14:39:39 -06:00
|
|
|
BNE 4(PC)
|
2013-05-27 06:46:53 -06:00
|
|
|
// signal number is already prepared in 4(R13)
|
2013-07-11 14:39:39 -06:00
|
|
|
MOVW $runtime·badsignal(SB), R11
|
|
|
|
BL (R11)
|
2013-05-27 06:46:53 -06:00
|
|
|
RET
|
|
|
|
|
2012-10-12 09:19:39 -06:00
|
|
|
// save g
|
2013-05-28 06:13:02 -06:00
|
|
|
MOVW g, R4
|
|
|
|
MOVW g, 20(R13)
|
2012-10-12 09:19:39 -06:00
|
|
|
|
|
|
|
// g = m->signal
|
2013-05-28 06:13:02 -06:00
|
|
|
MOVW m_gsignal(m), g
|
2012-10-12 09:19:39 -06:00
|
|
|
|
|
|
|
// R0 is already saved
|
|
|
|
MOVW R1, 8(R13) // info
|
|
|
|
MOVW R2, 12(R13) // context
|
|
|
|
MOVW R4, 16(R13) // oldg
|
|
|
|
|
|
|
|
BL runtime·sighandler(SB)
|
|
|
|
|
|
|
|
// restore g
|
2013-05-28 06:13:02 -06:00
|
|
|
MOVW 20(R13), g
|
2012-10-12 09:19:39 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·mmap(SB),NOSPLIT,$12
|
2012-10-12 09:19:39 -06:00
|
|
|
MOVW 0(FP), R0 // arg 1 addr
|
|
|
|
MOVW 4(FP), R1 // arg 2 len
|
|
|
|
MOVW 8(FP), R2 // arg 3 prot
|
|
|
|
MOVW 12(FP), R3 // arg 4 flags
|
|
|
|
// arg 5 (fid) and arg6 (offset_lo, offset_hi) are passed on stack
|
|
|
|
// note the C runtime only passes the 32-bit offset_lo to us
|
|
|
|
MOVW 16(FP), R4 // arg 5
|
|
|
|
MOVW R4, 4(R13)
|
|
|
|
MOVW 20(FP), R5 // arg 6 lower 32-bit
|
|
|
|
MOVW R5, 8(R13)
|
|
|
|
MOVW $0, R6 // higher 32-bit for arg 6
|
|
|
|
MOVW R6, 12(R13)
|
|
|
|
ADD $4, R13 // pass arg 5 and arg 6 on stack
|
|
|
|
SWI $477
|
|
|
|
SUB $4, R13
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·munmap(SB),NOSPLIT,$0
|
2012-10-12 09:19:39 -06:00
|
|
|
MOVW 0(FP), R0 // arg 1 addr
|
|
|
|
MOVW 4(FP), R1 // arg 2 len
|
|
|
|
SWI $73
|
2013-05-28 06:13:02 -06:00
|
|
|
MOVW.CS $0, R8 // crash on syscall failure
|
|
|
|
MOVW.CS R8, (R8)
|
2012-10-12 09:19:39 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·madvise(SB),NOSPLIT,$0
|
2012-11-23 21:55:19 -07:00
|
|
|
MOVW 0(FP), R0 // arg 1 addr
|
|
|
|
MOVW 4(FP), R1 // arg 2 len
|
|
|
|
MOVW 8(FP), R2 // arg 3 flags
|
|
|
|
SWI $75
|
2012-12-22 13:06:28 -07:00
|
|
|
// ignore failure - maybe pages are locked
|
2012-11-23 21:55:19 -07:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·sigaltstack(SB),NOSPLIT,$-8
|
2012-10-12 09:19:39 -06:00
|
|
|
MOVW new+0(FP), R0
|
|
|
|
MOVW old+4(FP), R1
|
|
|
|
SWI $53
|
2013-05-28 06:13:02 -06:00
|
|
|
MOVW.CS $0, R8 // crash on syscall failure
|
|
|
|
MOVW.CS R8, (R8)
|
2012-10-12 09:19:39 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·usleep(SB),NOSPLIT,$16
|
2012-10-12 09:19:39 -06:00
|
|
|
MOVW usec+0(FP), R0
|
|
|
|
MOVW R0, R2
|
|
|
|
MOVW $1000000, R1
|
|
|
|
DIV R1, R0
|
|
|
|
// 0(R13) is the saved LR, don't use it
|
|
|
|
MOVW R0, 4(R13) // tv_sec.low
|
|
|
|
MOVW $0, R0
|
|
|
|
MOVW R0, 8(R13) // tv_sec.high
|
|
|
|
MOD R1, R2
|
|
|
|
MOVW $1000, R1
|
|
|
|
MUL R1, R2
|
|
|
|
MOVW R2, 12(R13) // tv_nsec
|
|
|
|
|
|
|
|
MOVW $4(R13), R0 // arg 1 - rqtp
|
|
|
|
MOVW $0, R1 // arg 2 - rmtp
|
|
|
|
SWI $240 // sys_nanosleep
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·sysctl(SB),NOSPLIT,$0
|
2012-10-12 09:19:39 -06:00
|
|
|
MOVW 0(FP), R0 // arg 1 - name
|
|
|
|
MOVW 4(FP), R1 // arg 2 - namelen
|
|
|
|
MOVW 8(FP), R2 // arg 3 - oldp
|
|
|
|
MOVW 12(FP), R3 // arg 4 - oldlenp
|
|
|
|
// arg 5 (newp) and arg 6 (newlen) are passed on stack
|
|
|
|
ADD $20, R13
|
|
|
|
SWI $202 // sys___sysctl
|
|
|
|
SUB.CS $0, R0, R0
|
|
|
|
SUB $20, R13
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·osyield(SB),NOSPLIT,$-4
|
2012-10-12 09:19:39 -06:00
|
|
|
SWI $331 // sys_sched_yield
|
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·sigprocmask(SB),NOSPLIT,$0
|
2012-10-12 09:19:39 -06:00
|
|
|
MOVW $3, R0 // arg 1 - how (SIG_SETMASK)
|
|
|
|
MOVW 0(FP), R1 // arg 2 - set
|
|
|
|
MOVW 4(FP), R2 // arg 3 - oset
|
|
|
|
SWI $340 // sys_sigprocmask
|
2013-05-28 06:13:02 -06:00
|
|
|
MOVW.CS $0, R8 // crash on syscall failure
|
|
|
|
MOVW.CS R8, (R8)
|
2012-10-12 09:19:39 -06:00
|
|
|
RET
|
|
|
|
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·casp(SB),NOSPLIT,$0
|
2012-10-12 09:19:39 -06:00
|
|
|
B runtime·cas(SB)
|
|
|
|
|
|
|
|
// TODO(minux): this is only valid for ARMv6+
|
|
|
|
// bool armcas(int32 *val, int32 old, int32 new)
|
|
|
|
// Atomically:
|
|
|
|
// if(*val == old){
|
|
|
|
// *val = new;
|
|
|
|
// return 1;
|
|
|
|
// }else
|
|
|
|
// return 0;
|
2013-08-07 13:20:05 -06:00
|
|
|
TEXT runtime·cas(SB),NOSPLIT,$0
|
2012-10-12 09:19:39 -06:00
|
|
|
B runtime·armcas(SB)
|
runtime.cmd/ld: Add ARM external linking and implement -shared in terms of external linking
This CL is an aggregate of 10271047, 10499043, 9733044. Descriptions of each follow:
10499043
runtime,cmd/ld: Merge TLS symbols and teach 5l about ARM TLS
This CL prepares for external linking support to ARM.
The pseudo-symbols runtime.g and runtime.m are merged into a single
runtime.tlsgm symbol. When external linking, the offset of a thread local
variable is stored at a memory location instead of being embedded into a offset
of a ldr instruction. With a single runtime.tlsgm symbol for both g and m, only
one such offset is needed.
The larger part of this CL moves TLS code from gcc compiled to internally
compiled. The TLS code now uses the modern MRC instruction, and 5l is taught
about TLS fallbacks in case the instruction is not available or appropriate.
10271047
This CL adds support for -linkmode external to 5l.
For 5l itself, use addrel to allow for D_CALL relocations to be handled by the
host linker. Of the cases listed in rsc's comment in issue 4069, only case 5 and
63 needed an update. One of the TODO: addrel cases was since replaced, and the
rest of the cases are either covered by indirection through addpool (cases with
LTO or LFROM flags) or stubs (case 74). The addpool cases are covered because
addpool emits AWORD instructions, which in turn are handled by case 11.
In the runtime, change the argv argument in the rt0* functions slightly to be a
pointer to the argv list, instead of relying on a particular location of argv.
9733044
The -shared flag to 6l outputs a shared library, implemented in Go
and callable from non-Go programs such as C.
The main part of this CL change the thread local storage model.
Go uses the fastest and least general mode, local exec. TLS data in shared
libraries normally requires at least the local dynamic mode, however, this CL
instead opts for using the initial exec mode. Initial exec mode is faster than
local dynamic mode and can be used in linux since the linker has reserved a
limited amount of TLS space for performance sensitive TLS code.
Initial exec mode requires an extra load from the GOT table to determine the
TLS offset. This penalty will not be paid if ld is not in -shared mode, since
TLS accesses will be reduced to local exec.
The elf sections .init_array and .rela.init_array are added to register the Go
runtime entry with cgo at library load time.
The "hidden" attribute is added to Cgo functions called from Go, since Go
does not generate call through the GOT table, and adding non-GOT relocations for
a global function is not supported by gcc. Cgo symbols don't need to be global
and avoiding the GOT table is also faster.
The changes to 8l are only removes code relevant to the old -shared mode where
internal linking was used.
This CL only address the low level linker work. It can be submitted by itself,
but to be useful, the runtime changes in CL 9738047 is also needed.
Design discussion at
https://groups.google.com/forum/?fromgroups#!topic/golang-nuts/zmjXkGrEx6Q
Fixes #5590.
R=rsc
CC=golang-dev
https://golang.org/cl/12871044
2013-08-14 09:38:54 -06:00
|
|
|
|
|
|
|
TEXT runtime·read_tls_fallback(SB),NOSPLIT,$-4
|
|
|
|
MOVW $0xffff1000, R0
|
|
|
|
MOVW (R0), R0
|