diff options
author | Srdjan Petrovic <spetrovic@google.com> | 2015-04-17 17:27:07 -0700 |
---|---|---|
committer | David Crawshaw <crawshaw@golang.org> | 2015-04-22 16:28:57 +0000 |
commit | ca9128f18fe75878ba2d5e0df09ae755c085f72a (patch) | |
tree | 14dc3f65d05c3425c251282b91b1fe1be2079895 /src/runtime/sys_linux_arm.s | |
parent | 3f91a017f8f67cb9a744cf5d0a8b5db34a95808d (diff) | |
download | go-ca9128f18fe75878ba2d5e0df09ae755c085f72a.tar.gz go-ca9128f18fe75878ba2d5e0df09ae755c085f72a.zip |
runtime: merge clone0 and clone
We initially added clone0 to handle the case when G or M don't exist, but
it turns out that we could have just modified clone. (It also helps that
the function we're invoking in clone0 no longer needs arguments.)
As a side-effect, newosproc0 is now supported on all linux archs.
Change-Id: Ie603af75d8f164310fc16446052d83743961f3ca
Reviewed-on: https://go-review.googlesource.com/9164
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Diffstat (limited to 'src/runtime/sys_linux_arm.s')
-rw-r--r-- | src/runtime/sys_linux_arm.s | 51 |
1 files changed, 10 insertions, 41 deletions
diff --git a/src/runtime/sys_linux_arm.s b/src/runtime/sys_linux_arm.s index bbd7eb9eb3..9d21eaebcb 100644 --- a/src/runtime/sys_linux_arm.s +++ b/src/runtime/sys_linux_arm.s @@ -241,7 +241,6 @@ TEXT runtime·futex(SB),NOSPLIT,$0 MOVW R0, ret+24(FP) RET - // int32 clone(int32 flags, void *stack, M *mp, G *gp, void (*fn)(void)); TEXT runtime·clone(SB),NOSPLIT,$0 MOVW flags+0(FP), R0 @@ -279,8 +278,15 @@ TEXT runtime·clone(SB),NOSPLIT,$0 BEQ 2(PC) BL runtime·abort(SB) - MOVW 4(R13), g - MOVW 0(R13), R8 + MOVW 0(R13), R8 // m + MOVW 4(R13), R0 // g + + CMP $0, R8 + BEQ nog + CMP $0, R0 + BEQ nog + + MOVW R0, g MOVW R8, g_m(g) // paranoia; check they are not nil @@ -295,54 +301,17 @@ TEXT runtime·clone(SB),NOSPLIT,$0 MOVW g_m(g), R8 MOVW R0, m_procid(R8) +nog: // Call fn MOVW 8(R13), R0 MOVW $16(R13), R13 BL (R0) - MOVW $0, R0 - MOVW R0, 4(R13) - BL runtime·exit1(SB) - // It shouldn't return - MOVW $1234, R0 - MOVW $1005, R1 - MOVW R0, (R1) - -// int32 clone0(int32 flags, void *stack, void* fn, void* fnarg); -TEXT runtime·clone0(SB),NOSPLIT,$0-20 - MOVW flags+0(FP), R0 - MOVW stack+4(FP), R1 - // Update child's future stack and save fn and fnarg on it. - MOVW $-8(R1), R1 - MOVW fn+8(FP), R6 - MOVW R6, 0(R1) - MOVW fnarg+12(FP), R6 - MOVW R6, 4(R1) - MOVW $0, R2 // parent tid ptr - MOVW $0, R3 // tls_val - MOVW $0, R4 // child tid ptr - MOVW $0, R5 - MOVW $SYS_clone, R7 - SWI $0 - - // In parent, return. - CMP $0, R0 - BEQ 3(PC) - MOVW R0, ret+16(FP) - RET - - // In child. - MOVW 0(R13), R6 // fn - MOVW 4(R13), R0 // fnarg - MOVW $8(R13), R13 - BL (R6) - MOVW $0, R0 MOVW R0, 4(R13) BL runtime·exit1(SB) - // It shouldn't return MOVW $1234, R0 MOVW $1005, R1 MOVW R0, (R1) |