mirror of
https://github.com/golang/go
synced 2024-11-24 19:30:42 -07:00
clone and futex
go/test: passes 99% (343/347) R=rsc http://go/go-review/1016004
This commit is contained in:
parent
09d68334cc
commit
770b872752
@ -21,7 +21,7 @@ chmod +x $GOBIN/quietgcc
|
|||||||
|
|
||||||
# TODO(kaib): converge with normal build
|
# TODO(kaib): converge with normal build
|
||||||
#for i in lib9 libbio libmach cmd pkg libcgo cmd/cgo cmd/ebnflint cmd/godoc cmd/gofmt
|
#for i in lib9 libbio libmach cmd pkg libcgo cmd/cgo cmd/ebnflint cmd/godoc cmd/gofmt
|
||||||
for i in lib9 libbio libmach cmd pkg cmd/cgo cmd/ebnflint cmd/godoc cmd/gofmt
|
for i in lib9 libbio libmach cmd pkg cmd/ebnflint cmd/godoc cmd/gofmt
|
||||||
do
|
do
|
||||||
# The ( ) here are to preserve the current directory
|
# The ( ) here are to preserve the current directory
|
||||||
# for the next round despite the cd $i below.
|
# for the next round despite the cd $i below.
|
||||||
|
@ -55,20 +55,22 @@ TEXT _rt0_arm(SB),7,$-4
|
|||||||
// start this M
|
// start this M
|
||||||
BL mstart(SB)
|
BL mstart(SB)
|
||||||
|
|
||||||
MOVW $0, R0
|
MOVW $1234, R0
|
||||||
SWI $0x00900001
|
MOVW $1000, R1
|
||||||
|
MOVW R0, (R1) // fail hard
|
||||||
B _dep_dummy(SB) // Never reached
|
B _dep_dummy(SB) // Never reached
|
||||||
|
|
||||||
|
|
||||||
TEXT mainstart(SB),7,$0
|
TEXT mainstart(SB),7,$4
|
||||||
BL main·init(SB)
|
BL main·init(SB)
|
||||||
BL initdone(SB)
|
BL initdone(SB)
|
||||||
BL main·main(SB)
|
BL main·main(SB)
|
||||||
MOVW $0, R0
|
MOVW $0, R0
|
||||||
MOVW.W R0, -4(SP)
|
MOVW R0, 4(SP)
|
||||||
MOVW.W R14, -4(SP) // Push link as well
|
|
||||||
BL exit(SB)
|
BL exit(SB)
|
||||||
MOVW $8(SP), SP // pop args and LR
|
MOVW $1234, R0
|
||||||
|
MOVW $1001, R1
|
||||||
|
MOVW R0, (R1) // fail hard
|
||||||
RET
|
RET
|
||||||
|
|
||||||
// TODO(kaib): remove these once linker works properly
|
// TODO(kaib): remove these once linker works properly
|
||||||
|
@ -6,10 +6,16 @@
|
|||||||
// System calls and other sys.stuff for arm, Linux
|
// System calls and other sys.stuff for arm, Linux
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include "arm/asm.h"
|
||||||
|
|
||||||
#define SYS_BASE 0x00900000
|
#define SYS_BASE 0x00900000
|
||||||
#define SYS_exit (SYS_BASE + 1)
|
#define SYS_exit (SYS_BASE + 1)
|
||||||
#define SYS_write (SYS_BASE + 4)
|
#define SYS_write (SYS_BASE + 4)
|
||||||
|
#define SYS_clone (SYS_BASE + 120)
|
||||||
#define SYS_mmap2 (SYS_BASE + 192)
|
#define SYS_mmap2 (SYS_BASE + 192)
|
||||||
|
#define SYS_gettid (SYS_BASE + 224)
|
||||||
|
#define SYS_futex (SYS_BASE + 240)
|
||||||
|
#define SYS_exit_group (SYS_BASE + 248)
|
||||||
|
|
||||||
TEXT write(SB),7,$0
|
TEXT write(SB),7,$0
|
||||||
MOVW 0(FP), R0
|
MOVW 0(FP), R0
|
||||||
@ -19,8 +25,18 @@ TEXT write(SB),7,$0
|
|||||||
RET
|
RET
|
||||||
|
|
||||||
TEXT exit(SB),7,$-4
|
TEXT exit(SB),7,$-4
|
||||||
|
MOVW 0(FP), R0
|
||||||
|
SWI $SYS_exit_group
|
||||||
|
MOVW $1234, R0
|
||||||
|
MOVW $1002, R1
|
||||||
|
MOVW R0, (R1) // fail hard
|
||||||
|
|
||||||
|
TEXT exit1(SB),7,$-4
|
||||||
MOVW 0(FP), R0
|
MOVW 0(FP), R0
|
||||||
SWI $SYS_exit
|
SWI $SYS_exit
|
||||||
|
MOVW $1234, R0
|
||||||
|
MOVW $1003, R1
|
||||||
|
MOVW R0, (R1) // fail hard
|
||||||
|
|
||||||
TEXT runtime·mmap(SB),7,$0
|
TEXT runtime·mmap(SB),7,$0
|
||||||
MOVW 0(FP), R0
|
MOVW 0(FP), R0
|
||||||
@ -32,13 +48,79 @@ TEXT runtime·mmap(SB),7,$0
|
|||||||
SWI $SYS_mmap2
|
SWI $SYS_mmap2
|
||||||
RET
|
RET
|
||||||
|
|
||||||
// int64 futex(int32 *uaddr, int32 op, int32 val,
|
// int32 futex(int32 *uaddr, int32 op, int32 val,
|
||||||
// struct timespec *timeout, int32 *uaddr2, int32 val2);
|
// struct timespec *timeout, int32 *uaddr2, int32 val2);
|
||||||
TEXT futex(SB),7,$0
|
TEXT futex(SB),7,$0
|
||||||
BL abort(SB)
|
MOVW 4(SP), R0
|
||||||
|
MOVW 8(SP), R1
|
||||||
|
MOVW 12(SP), R2
|
||||||
|
MOVW 16(SP), R3
|
||||||
|
MOVW 20(SP), R4
|
||||||
|
MOVW 24(SP), R5
|
||||||
|
SWI $SYS_futex
|
||||||
RET
|
RET
|
||||||
|
|
||||||
// int64 clone(int32 flags, void *stack, M *m, G *g, void (*fn)(void));
|
|
||||||
|
// int32 clone(int32 flags, void *stack, M *m, G *g, void (*fn)(void));
|
||||||
TEXT clone(SB),7,$0
|
TEXT clone(SB),7,$0
|
||||||
BL abort(SB)
|
MOVW flags+0(FP), R0
|
||||||
|
MOVW stack+4(FP), R1
|
||||||
|
MOVW $0, R2 // parent tid ptr
|
||||||
|
MOVW $0, R3 // tls_val
|
||||||
|
MOVW $0, R4 // child tid ptr
|
||||||
|
MOVW $0, R5
|
||||||
|
|
||||||
|
// Copy m, g, fn off parent stack for use by child.
|
||||||
|
// TODO(kaib): figure out which registers are clobbered by clone and avoid stack copying
|
||||||
|
MOVW $-16(R1), R1
|
||||||
|
MOVW mm+8(FP), R6
|
||||||
|
MOVW R6, 0(R1)
|
||||||
|
MOVW gg+12(FP), R6
|
||||||
|
MOVW R6, 4(R1)
|
||||||
|
MOVW fn+16(FP), R6
|
||||||
|
MOVW R6, 8(R1)
|
||||||
|
MOVW $1234, R6
|
||||||
|
MOVW R6, 12(R1)
|
||||||
|
|
||||||
|
SWI $SYS_clone
|
||||||
|
|
||||||
|
// In parent, return.
|
||||||
|
CMP $0, R0
|
||||||
|
BEQ 2(PC)
|
||||||
RET
|
RET
|
||||||
|
|
||||||
|
// Paranoia: check that SP is as we expect. Use R13 to avoid linker 'fixup'
|
||||||
|
MOVW 12(R13), R0
|
||||||
|
MOVW $1234, R1
|
||||||
|
CMP R0, R1
|
||||||
|
BEQ 2(PC)
|
||||||
|
B abort(SB)
|
||||||
|
|
||||||
|
MOVW 0(R13), m
|
||||||
|
MOVW 4(R13), g
|
||||||
|
|
||||||
|
// paranoia; check they are not nil
|
||||||
|
MOVW 0(m), R0
|
||||||
|
MOVW 0(g), R0
|
||||||
|
|
||||||
|
BL emptyfunc(SB) // fault if stack check is wrong
|
||||||
|
|
||||||
|
// Initialize m->procid to Linux tid
|
||||||
|
SWI $SYS_gettid
|
||||||
|
MOVW R0, m_procid(m)
|
||||||
|
|
||||||
|
// Call fn
|
||||||
|
MOVW 8(R13), R0
|
||||||
|
MOVW $16(R13), R13
|
||||||
|
BL (R0)
|
||||||
|
|
||||||
|
MOVW $0, R0
|
||||||
|
MOVW R0, 4(R13)
|
||||||
|
BL exit1(SB)
|
||||||
|
|
||||||
|
// It shouldn't return
|
||||||
|
MOVW $1234, R0
|
||||||
|
MOVW $1005, R1
|
||||||
|
MOVW R0, (R1)
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,8 +5,11 @@ assign.go
|
|||||||
bigalg.go
|
bigalg.go
|
||||||
blank.go
|
blank.go
|
||||||
blank1.go
|
blank1.go
|
||||||
|
bugs/bug212.go
|
||||||
|
bugs/bug213.go
|
||||||
chan/fifo.go
|
chan/fifo.go
|
||||||
chan/goroutines.go
|
chan/goroutines.go
|
||||||
|
chan/nonblock.go
|
||||||
chan/perm.go
|
chan/perm.go
|
||||||
chan/powser1.go
|
chan/powser1.go
|
||||||
chan/powser2.go
|
chan/powser2.go
|
||||||
@ -33,6 +36,7 @@ convlit.go
|
|||||||
convlit1.go
|
convlit1.go
|
||||||
decl.go
|
decl.go
|
||||||
declbad.go
|
declbad.go
|
||||||
|
defer.go
|
||||||
empty.go
|
empty.go
|
||||||
env.go
|
env.go
|
||||||
escape.go
|
escape.go
|
||||||
@ -116,6 +120,7 @@ fixedbugs/bug088.go
|
|||||||
fixedbugs/bug089.go
|
fixedbugs/bug089.go
|
||||||
fixedbugs/bug090.go
|
fixedbugs/bug090.go
|
||||||
fixedbugs/bug091.go
|
fixedbugs/bug091.go
|
||||||
|
fixedbugs/bug092.go
|
||||||
fixedbugs/bug093.go
|
fixedbugs/bug093.go
|
||||||
fixedbugs/bug094.go
|
fixedbugs/bug094.go
|
||||||
fixedbugs/bug096.go
|
fixedbugs/bug096.go
|
||||||
@ -257,6 +262,7 @@ interface/convert1.go
|
|||||||
interface/convert2.go
|
interface/convert2.go
|
||||||
interface/embed.go
|
interface/embed.go
|
||||||
interface/embed0.go
|
interface/embed0.go
|
||||||
|
interface/embed1.go
|
||||||
interface/explicit.go
|
interface/explicit.go
|
||||||
interface/fail.go
|
interface/fail.go
|
||||||
interface/fake.go
|
interface/fake.go
|
||||||
@ -292,6 +298,7 @@ ken/robfunc.go
|
|||||||
ken/robif.go
|
ken/robif.go
|
||||||
ken/shift.go
|
ken/shift.go
|
||||||
ken/simpbool.go
|
ken/simpbool.go
|
||||||
|
ken/simpconv.go
|
||||||
ken/simpfun.go
|
ken/simpfun.go
|
||||||
ken/simpprint.go
|
ken/simpprint.go
|
||||||
ken/simpswitch.go
|
ken/simpswitch.go
|
||||||
@ -329,6 +336,7 @@ stringrange.go
|
|||||||
switch.go
|
switch.go
|
||||||
switch1.go
|
switch1.go
|
||||||
test0.go
|
test0.go
|
||||||
|
turing.go
|
||||||
typeswitch.go
|
typeswitch.go
|
||||||
typeswitch1.go
|
typeswitch1.go
|
||||||
utf.go
|
utf.go
|
||||||
|
Loading…
Reference in New Issue
Block a user