Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
770b8727
Commit
770b8727
authored
Oct 30, 2009
by
Kai Backman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clone and futex
go/test: passes 99% (343/347) R=rsc
http://go/go-review/1016004
parent
09d68334
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
12 deletions
+104
-12
make-arm.bash
src/make-arm.bash
+1
-1
asm.s
src/pkg/runtime/arm/asm.s
+8
-6
sys.s
src/pkg/runtime/linux/arm/sys.s
+87
-5
arm-pass.txt
test/arm-pass.txt
+8
-0
No files found.
src/make-arm.bash
View file @
770b8727
...
...
@@ -21,7 +21,7 @@ chmod +x $GOBIN/quietgcc
# 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 cmd/
cgo cmd/
ebnflint cmd/godoc cmd/gofmt
for
i
in
lib9 libbio libmach cmd pkg cmd/ebnflint cmd/godoc cmd/gofmt
do
# The ( ) here are to preserve the current directory
# for the next round despite the cd $i below.
...
...
src/pkg/runtime/arm/asm.s
View file @
770b8727
...
...
@@ -55,20 +55,22 @@ TEXT _rt0_arm(SB),7,$-4
// start this M
BL mstart(SB)
MOVW $0, R0
SWI $0x00900001
MOVW $1234, R0
MOVW $1000, R1
MOVW R0, (R1) // fail hard
B _dep_dummy(SB) // Never reached
TEXT mainstart(SB),7,$
0
TEXT mainstart(SB),7,$
4
BL main·init(SB)
BL initdone(SB)
BL main·main(SB)
MOVW $0, R0
MOVW.W R0, -4(SP)
MOVW.W R14, -4(SP) // Push link as well
MOVW R0, 4(SP)
BL exit(SB)
MOVW $8(SP), SP // pop args and LR
MOVW $1234, R0
MOVW $1001, R1
MOVW R0, (R1) // fail hard
RET
// TODO(kaib): remove these once linker works properly
...
...
src/pkg/runtime/linux/arm/sys.s
View file @
770b8727
...
...
@@ -6,10 +6,16 @@
// System calls and other sys.stuff for arm, Linux
//
#include "arm/asm.h"
#define SYS_BASE 0x00900000
#define SYS_exit (SYS_BASE + 1)
#define SYS_write (SYS_BASE + 4)
#define SYS_clone (SYS_BASE + 120)
#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
MOVW 0(FP), R0
...
...
@@ -19,8 +25,18 @@ TEXT write(SB),7,$0
RET
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
SWI $SYS_exit
MOVW $1234, R0
MOVW $1003, R1
MOVW R0, (R1) // fail hard
TEXT runtime·mmap(SB),7,$0
MOVW 0(FP), R0
...
...
@@ -32,13 +48,79 @@ TEXT runtime·mmap(SB),7,$0
SWI $SYS_mmap2
RET
// int
64
futex(int32 *uaddr, int32 op, int32 val,
// int
32
futex(int32 *uaddr, int32 op, int32 val,
// struct timespec *timeout, int32 *uaddr2, int32 val2);
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
// 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
BL abort(SB)
RET
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
// 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)
test/arm-pass.txt
View file @
770b8727
...
...
@@ -5,8 +5,11 @@ assign.go
bigalg.go
blank.go
blank1.go
bugs/bug212.go
bugs/bug213.go
chan/fifo.go
chan/goroutines.go
chan/nonblock.go
chan/perm.go
chan/powser1.go
chan/powser2.go
...
...
@@ -33,6 +36,7 @@ convlit.go
convlit1.go
decl.go
declbad.go
defer.go
empty.go
env.go
escape.go
...
...
@@ -116,6 +120,7 @@ fixedbugs/bug088.go
fixedbugs/bug089.go
fixedbugs/bug090.go
fixedbugs/bug091.go
fixedbugs/bug092.go
fixedbugs/bug093.go
fixedbugs/bug094.go
fixedbugs/bug096.go
...
...
@@ -257,6 +262,7 @@ interface/convert1.go
interface/convert2.go
interface/embed.go
interface/embed0.go
interface/embed1.go
interface/explicit.go
interface/fail.go
interface/fake.go
...
...
@@ -292,6 +298,7 @@ ken/robfunc.go
ken/robif.go
ken/shift.go
ken/simpbool.go
ken/simpconv.go
ken/simpfun.go
ken/simpprint.go
ken/simpswitch.go
...
...
@@ -329,6 +336,7 @@ stringrange.go
switch.go
switch1.go
test0.go
turing.go
typeswitch.go
typeswitch1.go
utf.go
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment