Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(414)

Delta Between Two Patch Sets: src/pkg/runtime/rt0_linux_arm.s

Issue 10271047: code review 10271047: cmd/5l,runtime: External linking support on linux-arm (Closed)
Left Patch Set: diff -r 52d53d0e177e https://go.googlecode.com/hg/ Created 11 years, 10 months ago
Right Patch Set: diff -r cc6d9589262e8f88e8e1a8a424f143dde76d68e0 https://go.googlecode.com/hg/ Created 11 years, 8 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/runtime/rt0_freebsd_arm.s ('k') | src/pkg/runtime/rt0_netbsd_arm.s » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 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 TEXT _rt0_arm_linux(SB),7,$-4 5 #include "../../cmd/ld/textflag.h"
6
7 TEXT _rt0_arm_linux(SB),NOSPLIT,$-4
6 MOVW (R13), R0 // argc 8 MOVW (R13), R0 // argc
7 MOVW $4(R13), R1 // argv 9 MOVW $4(R13), R1 // argv
8 MOVM.DB.W [R0-R1], (R13)
9 MOVW $_rt0_arm_linux1(SB), R4 10 MOVW $_rt0_arm_linux1(SB), R4
10 B (R4) 11 B (R4)
11 12
12 TEXT _rt0_arm_linux1(SB),7,$-4 13 TEXT _rt0_arm_linux1(SB),NOSPLIT,$-4
13 // We first need to detect the kernel ABI, and warn the user 14 // We first need to detect the kernel ABI, and warn the user
14 // if the system only supports OABI 15 // if the system only supports OABI
15 // The strategy here is to call some EABI syscall to see if 16 // The strategy here is to call some EABI syscall to see if
16 // SIGILL is received. 17 // SIGILL is received.
17 // To catch SIGILL, we have to first setup sigaction, this is 18 // To catch SIGILL, we have to first setup sigaction, this is
18 // a chicken-and-egg problem, because we can't do syscall if 19 // a chicken-and-egg problem, because we can't do syscall if
19 // we don't know the kernel ABI... Oh, not really, we can do 20 // we don't know the kernel ABI... Oh, not really, we can do
20 // syscall in Thumb mode. 21 // syscall in Thumb mode.
21 22
23 // Save argc and argv
24 MOVM.DB.W [R0-R1], (R13)
22 // set up sa_handler 25 // set up sa_handler
23 MOVW $bad_abi<>(SB), R0 // sa_handler 26 MOVW $bad_abi<>(SB), R0 // sa_handler
24 MOVW $0, R1 // sa_flags 27 MOVW $0, R1 // sa_flags
25 MOVW $0, R2 // sa_restorer 28 MOVW $0, R2 // sa_restorer
26 MOVW $0, R3 // sa_mask 29 MOVW $0, R3 // sa_mask
27 MOVM.DB.W [R0-R3], (R13) 30 MOVM.DB.W [R0-R3], (R13)
28 MOVW $4, R0 // SIGILL 31 MOVW $4, R0 // SIGILL
29 MOVW R13, R1 // sa 32 MOVW R13, R1 // sa
30 SUB $16, R13 33 SUB $16, R13
31 MOVW R13, R2 // old_sa 34 MOVW R13, R2 // old_sa
(...skipping 11 matching lines...) Expand all
43 MOVW $8, R3 // c 46 MOVW $8, R3 // c
44 MOVW $174, R7 // sys_sigaction 47 MOVW $174, R7 // sys_sigaction
45 SWI $0 // restore signal handler 48 SWI $0 // restore signal handler
46 ADD $32, R13 49 ADD $32, R13
47 50
48 SUB $4, R13 // fake a stack frame for runtime·setup_auxv 51 SUB $4, R13 // fake a stack frame for runtime·setup_auxv
49 BL runtime·setup_auxv(SB) 52 BL runtime·setup_auxv(SB)
50 ADD $4, R13 53 ADD $4, R13
51 B _rt0_go(SB) 54 B _rt0_go(SB)
52 55
53 TEXT bad_abi<>(SB),7,$-4 56 TEXT bad_abi<>(SB),NOSPLIT,$-4
54 // give diagnosis and exit 57 // give diagnosis and exit
55 MOVW $2, R0 // stderr 58 MOVW $2, R0 // stderr
56 MOVW $bad_abi_msg(SB), R1 // data 59 MOVW $bad_abi_msg(SB), R1 // data
57 MOVW $45, R2 // len 60 MOVW $45, R2 // len
58 MOVW $4, R7 // sys_write 61 MOVW $4, R7 // sys_write
59 BL oabi_syscall<>(SB) 62 BL oabi_syscall<>(SB)
60 MOVW $1, R0 63 MOVW $1, R0
61 MOVW $1, R7 // sys_exit 64 MOVW $1, R7 // sys_exit
62 BL oabi_syscall<>(SB) 65 BL oabi_syscall<>(SB)
63 B 0(PC) 66 B 0(PC)
64 67
65 DATA bad_abi_msg+0x00(SB)/8, $"This pro" 68 DATA bad_abi_msg+0x00(SB)/8, $"This pro"
66 DATA bad_abi_msg+0x08(SB)/8, $"gram can" 69 DATA bad_abi_msg+0x08(SB)/8, $"gram can"
67 DATA bad_abi_msg+0x10(SB)/8, $" only be" 70 DATA bad_abi_msg+0x10(SB)/8, $" only be"
68 DATA bad_abi_msg+0x18(SB)/8, $" run on " 71 DATA bad_abi_msg+0x18(SB)/8, $" run on "
69 DATA bad_abi_msg+0x20(SB)/8, $"EABI ker" 72 DATA bad_abi_msg+0x20(SB)/8, $"EABI ker"
70 DATA bad_abi_msg+0x28(SB)/4, $"nels" 73 DATA bad_abi_msg+0x28(SB)/4, $"nels"
71 DATA bad_abi_msg+0x2c(SB)/1, $0xa 74 DATA bad_abi_msg+0x2c(SB)/1, $0xa
72 GLOBL bad_abi_msg(SB), $45 75 GLOBL bad_abi_msg(SB), $45
73 76
74 TEXT oabi_syscall<>(SB),7,$-4 77 TEXT oabi_syscall<>(SB),NOSPLIT,$-4
75 ADD $1, PC, R4 78 ADD $1, PC, R4
76 WORD $0xe12fff14 //BX (R4) // enter thumb mode 79 WORD $0xe12fff14 //BX (R4) // enter thumb mode
77 // TODO(minux): only supports little-endian CPUs 80 // TODO(minux): only supports little-endian CPUs
78 WORD $0x4770df01 // swi $1; bx lr 81 WORD $0x4770df01 // swi $1; bx lr
79 82
80 TEXT main(SB),7,$-8 83 TEXT main(SB),NOSPLIT,$-8
rsc 2013/08/13 19:05:49 $-8 doesnt mean what you think it means. should be
81 » MOVM.DB.W» [R0-R1], (R13) // argc, argv
82 MOVW $_rt0_arm_linux1(SB), R4 84 MOVW $_rt0_arm_linux1(SB), R4
83 B (R4) 85 B (R4)
86
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b