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

Side by Side Diff: src/pkg/runtime/sys_plan9_amd64.s

Issue 160200044: [dev.power64] code review 160200044: build: merge default into dev.power64 (Closed)
Patch Set: diff -r be0c14f62257b42485019e9e1db23cf40d2e249f https://code.google.com/p/go Created 10 years, 4 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:
View unified diff | Download patch
« no previous file with comments | « src/pkg/runtime/sys_plan9_386.s ('k') | src/pkg/runtime/sys_solaris_amd64.s » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Go Authors. All rights reserved. 1 // Copyright 2010 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 #include "zasm_GOOS_GOARCH.h" 5 #include "zasm_GOOS_GOARCH.h"
6 #include "../../cmd/ld/textflag.h" 6 #include "textflag.h"
7 7
8 // setldt(int entry, int address, int limit) 8 // setldt(int entry, int address, int limit)
9 TEXT runtime·setldt(SB),NOSPLIT,$0 9 TEXT runtime·setldt(SB),NOSPLIT,$0
10 RET 10 RET
11 11
12 TEXT runtime·open(SB),NOSPLIT,$0 12 TEXT runtime·open(SB),NOSPLIT,$0
13 MOVQ $14, BP 13 MOVQ $14, BP
14 SYSCALL 14 SYSCALL
15 MOVL AX, ret+16(FP)
15 RET 16 RET
16 17
17 TEXT runtime·pread(SB),NOSPLIT,$0 18 TEXT runtime·pread(SB),NOSPLIT,$0
18 MOVQ $50, BP 19 MOVQ $50, BP
19 SYSCALL 20 SYSCALL
21 MOVL AX, ret+32(FP)
20 RET 22 RET
21 23
22 TEXT runtime·pwrite(SB),NOSPLIT,$0 24 TEXT runtime·pwrite(SB),NOSPLIT,$0
23 MOVQ $51, BP 25 MOVQ $51, BP
24 SYSCALL 26 SYSCALL
27 MOVL AX, ret+32(FP)
25 RET 28 RET
26 29
27 // int32 _seek(int64*, int32, int64, int32) 30 // int32 _seek(int64*, int32, int64, int32)
28 TEXT _seek<>(SB),NOSPLIT,$0 31 TEXT _seek<>(SB),NOSPLIT,$0
29 MOVQ $39, BP 32 MOVQ $39, BP
30 SYSCALL 33 SYSCALL
31 RET 34 RET
32 35
33 // int64 seek(int32, int64, int32) 36 // int64 seek(int32, int64, int32)
34 TEXT runtime·seek(SB),NOSPLIT,$56 37 // Convenience wrapper around _seek, the actual system call.
35 » LEAQ» new+48(SP), CX 38 TEXT runtime·seek(SB),NOSPLIT,$32
36 » MOVQ» CX, 0(SP) 39 » LEAQ» ret+24(FP), AX
37 » MOVQ» fd+0(FP), CX 40 » MOVL» fd+0(FP), BX
38 » MOVQ» CX, 8(SP) 41 » MOVQ» offset+8(FP), CX
39 » MOVQ» off+8(FP), CX 42 » MOVL» whence+16(FP), DX
43 » MOVQ» AX, 0(SP)
44 » MOVL» BX, 8(SP)
40 MOVQ CX, 16(SP) 45 MOVQ CX, 16(SP)
41 » MOVQ» whence+16(FP), CX 46 » MOVL» DX, 24(SP)
42 » MOVQ» CX, 24(SP)
43 CALL _seek<>(SB) 47 CALL _seek<>(SB)
44 CMPL AX, $0 48 CMPL AX, $0
45 JGE 2(PC) 49 JGE 2(PC)
46 » MOVQ» $-1, new+48(SP) 50 » MOVQ» $-1, ret+24(FP)
47 » MOVQ» new+48(SP), AX
48 RET 51 RET
49 52
50 TEXT runtime·close(SB),NOSPLIT,$0 53 TEXT runtime·close(SB),NOSPLIT,$0
51 MOVQ $4, BP 54 MOVQ $4, BP
52 SYSCALL 55 SYSCALL
56 MOVL AX, ret+8(FP)
53 RET 57 RET
54 58
55 TEXT runtime·exits(SB),NOSPLIT,$0 59 TEXT runtime·exits(SB),NOSPLIT,$0
56 MOVQ $8, BP 60 MOVQ $8, BP
57 SYSCALL 61 SYSCALL
58 RET 62 RET
59 63
60 TEXT runtime·brk_(SB),NOSPLIT,$0 64 TEXT runtime·brk_(SB),NOSPLIT,$0
61 MOVQ $24, BP 65 MOVQ $24, BP
62 SYSCALL 66 SYSCALL
67 MOVQ AX, ret+8(FP)
63 RET 68 RET
64 69
65 TEXT runtime·sleep(SB),NOSPLIT,$0 70 TEXT runtime·sleep(SB),NOSPLIT,$0
66 MOVQ $17, BP 71 MOVQ $17, BP
67 SYSCALL 72 SYSCALL
73 MOVL AX, ret+8(FP)
68 RET 74 RET
69 75
70 TEXT runtime·plan9_semacquire(SB),NOSPLIT,$0 76 TEXT runtime·plan9_semacquire(SB),NOSPLIT,$0
71 MOVQ $37, BP 77 MOVQ $37, BP
72 SYSCALL 78 SYSCALL
79 MOVL AX, ret+16(FP)
73 RET 80 RET
74 81
75 TEXT runtime·plan9_tsemacquire(SB),NOSPLIT,$0 82 TEXT runtime·plan9_tsemacquire(SB),NOSPLIT,$0
76 MOVQ $52, BP 83 MOVQ $52, BP
77 SYSCALL 84 SYSCALL
85 MOVL AX, ret+16(FP)
78 RET 86 RET
79 87
80 TEXT runtime·nsec(SB),NOSPLIT,$0 88 TEXT runtime·nsec(SB),NOSPLIT,$0
81 MOVQ $53, BP 89 MOVQ $53, BP
82 SYSCALL 90 SYSCALL
91 MOVQ AX, ret+8(FP)
92 RET
93
94 // func now() (sec int64, nsec int32)
95 TEXT time·now(SB),NOSPLIT,$8-12
96 CALL runtime·nanotime(SB)
97 MOVQ 0(SP), AX
98
99 // generated code for
100 // func f(x uint64) (uint64, uint64) { return x/1000000000, x%10000 0000 }
101 // adapted to reduce duplication
102 MOVQ AX, CX
103 MOVQ $1360296554856532783, AX
104 MULQ CX
105 ADDQ CX, DX
106 RCRQ $1, DX
107 SHRQ $29, DX
108 MOVQ DX, sec+0(FP)
109 IMULQ $1000000000, DX
110 SUBQ DX, CX
111 MOVL CX, nsec+8(FP)
83 RET 112 RET
84 113
85 TEXT runtime·notify(SB),NOSPLIT,$0 114 TEXT runtime·notify(SB),NOSPLIT,$0
86 MOVQ $28, BP 115 MOVQ $28, BP
87 SYSCALL 116 SYSCALL
117 MOVL AX, ret+8(FP)
88 RET 118 RET
89 119
90 TEXT runtime·noted(SB),NOSPLIT,$0 120 TEXT runtime·noted(SB),NOSPLIT,$0
91 MOVQ $29, BP 121 MOVQ $29, BP
92 SYSCALL 122 SYSCALL
123 MOVL AX, ret+8(FP)
93 RET 124 RET
94 ········ 125 ········
95 TEXT runtime·plan9_semrelease(SB),NOSPLIT,$0 126 TEXT runtime·plan9_semrelease(SB),NOSPLIT,$0
96 MOVQ $38, BP 127 MOVQ $38, BP
97 SYSCALL 128 SYSCALL
129 MOVL AX, ret+16(FP)
98 RET 130 RET
99 131
100 TEXT runtime·rfork(SB),NOSPLIT,$0 132 TEXT runtime·rfork(SB),NOSPLIT,$0
101 MOVQ $19, BP // rfork 133 MOVQ $19, BP // rfork
102 SYSCALL 134 SYSCALL
103 135
104 // In parent, return. 136 // In parent, return.
105 CMPQ AX, $0 137 CMPQ AX, $0
106 » JEQ» 2(PC) 138 » JEQ» 3(PC)
139 » MOVL» AX, ret+40(FP)
107 RET 140 RET
108 141
109 // In child on forked stack. 142 // In child on forked stack.
110 MOVQ mm+24(SP), BX // m 143 MOVQ mm+24(SP), BX // m
111 MOVQ gg+32(SP), DX // g 144 MOVQ gg+32(SP), DX // g
112 MOVQ fn+40(SP), SI // fn 145 MOVQ fn+40(SP), SI // fn
113 146
114 // set SP to be on the new child stack 147 // set SP to be on the new child stack
115 MOVQ stack+16(SP), CX 148 MOVQ stack+16(SP), CX
116 MOVQ CX, SP 149 MOVQ CX, SP
117 150
118 // Initialize m, g. 151 // Initialize m, g.
119 get_tls(AX) 152 get_tls(AX)
120 MOVQ DX, g(AX) 153 MOVQ DX, g(AX)
121 MOVQ BX, g_m(DX) 154 MOVQ BX, g_m(DX)
122 155
123 // Initialize procid from TOS struct. 156 // Initialize procid from TOS struct.
124 MOVQ _tos(SB), AX 157 MOVQ _tos(SB), AX
125 MOVQ 64(AX), AX 158 MOVQ 64(AX), AX
126 MOVQ AX, m_procid(BX) // save pid as m->procid 159 MOVQ AX, m_procid(BX) // save pid as m->procid
127 ········ 160 ········
128 CALL runtime·stackcheck(SB) // smashes AX, CX 161 CALL runtime·stackcheck(SB) // smashes AX, CX
129 ········ 162 ········
130 MOVQ 0(DX), DX // paranoia; check they are not nil 163 MOVQ 0(DX), DX // paranoia; check they are not nil
131 MOVQ 0(BX), BX 164 MOVQ 0(BX), BX
132 ········ 165 ········
133 CALL SI // fn() 166 CALL SI // fn()
134 CALL runtime·exit(SB) 167 CALL runtime·exit(SB)
168 MOVL AX, ret+40(FP)
135 RET 169 RET
136 170
137 // This is needed by asm_amd64.s 171 // This is needed by asm_amd64.s
138 TEXT runtime·settls(SB),NOSPLIT,$0 172 TEXT runtime·settls(SB),NOSPLIT,$0
139 RET 173 RET
140 174
141 // void sigtramp(void *ureg, int8 *note) 175 // void sigtramp(void *ureg, int8 *note)
142 TEXT runtime·sigtramp(SB),NOSPLIT,$0 176 TEXT runtime·sigtramp(SB),NOSPLIT,$0
143 get_tls(AX) 177 get_tls(AX)
144 178
145 // check that g exists 179 // check that g exists
146 MOVQ g(AX), BX 180 MOVQ g(AX), BX
147 CMPQ BX, $0 181 CMPQ BX, $0
148 JNE 3(PC) 182 JNE 3(PC)
149 CALL runtime·badsignal2(SB) // will exit 183 CALL runtime·badsignal2(SB) // will exit
150 RET 184 RET
151 185
152 // save args 186 // save args
153 MOVQ ureg+8(SP), CX 187 MOVQ ureg+8(SP), CX
154 MOVQ note+16(SP), DX 188 MOVQ note+16(SP), DX
155 189
156 // change stack 190 // change stack
157 MOVQ g_m(BX), BX 191 MOVQ g_m(BX), BX
158 MOVQ m_gsignal(BX), R10 192 MOVQ m_gsignal(BX), R10
159 MOVQ g_stackbase(R10), BP 193 MOVQ g_stackbase(R10), BP
160 MOVQ BP, SP 194 MOVQ BP, SP
161 195
162 // make room for args and g 196 // make room for args and g
163 » SUBQ» $32, SP 197 » SUBQ» $40, SP
164 198
165 // save g 199 // save g
166 MOVQ g(AX), BP 200 MOVQ g(AX), BP
167 » MOVQ» BP, 24(SP) 201 » MOVQ» BP, 32(SP)
168 202
169 // g = m->gsignal 203 // g = m->gsignal
170 MOVQ R10, g(AX) 204 MOVQ R10, g(AX)
171 205
172 // load args and call sighandler 206 // load args and call sighandler
173 MOVQ CX, 0(SP) 207 MOVQ CX, 0(SP)
174 MOVQ DX, 8(SP) 208 MOVQ DX, 8(SP)
175 MOVQ BP, 16(SP) 209 MOVQ BP, 16(SP)
176 210
177 CALL runtime·sighandler(SB) 211 CALL runtime·sighandler(SB)
212 MOVL 24(SP), AX
178 213
179 // restore g 214 // restore g
180 get_tls(BX) 215 get_tls(BX)
181 » MOVQ» 24(SP), R10 216 » MOVQ» 32(SP), R10
182 MOVQ R10, g(BX) 217 MOVQ R10, g(BX)
183 218
184 // call noted(AX) 219 // call noted(AX)
185 MOVQ AX, 0(SP) 220 MOVQ AX, 0(SP)
186 CALL runtime·noted(SB) 221 CALL runtime·noted(SB)
187 RET 222 RET
188 223
189 TEXT runtime·setfpmasks(SB),NOSPLIT,$8 224 TEXT runtime·setfpmasks(SB),NOSPLIT,$8
190 STMXCSR 0(SP) 225 STMXCSR 0(SP)
191 MOVL 0(SP), AX 226 MOVL 0(SP), AX
192 ANDL $~0x3F, AX 227 ANDL $~0x3F, AX
193 ORL $(0x3F<<7), AX 228 ORL $(0x3F<<7), AX
194 MOVL AX, 0(SP) 229 MOVL AX, 0(SP)
195 LDMXCSR 0(SP) 230 LDMXCSR 0(SP)
196 RET 231 RET
197 232
198 #define ERRMAX 128 /* from os_plan9.h */ 233 #define ERRMAX 128 /* from os_plan9.h */
199 234
200 // func errstr() String 235 // void errstr(int8 *buf, int32 len)
236 TEXT errstr<>(SB),NOSPLIT,$0
237 » MOVQ $41, BP
238 » SYSCALL
239 » RET
240
241 // func errstr() string
201 // Only used by package syscall. 242 // Only used by package syscall.
202 // Grab error string due to a syscall made 243 // Grab error string due to a syscall made
203 // in entersyscall mode, without going 244 // in entersyscall mode, without going
204 // through the allocator (issue 4994). 245 // through the allocator (issue 4994).
205 // See ../syscall/asm_plan9_386.s:/·Syscall/ 246 // See ../syscall/asm_plan9_amd64.s:/·Syscall/
206 TEXT runtime·errstr(SB),NOSPLIT,$0 247 TEXT runtime·errstr(SB),NOSPLIT,$16-16
207 get_tls(AX) 248 get_tls(AX)
208 MOVQ g(AX), BX 249 MOVQ g(AX), BX
209 MOVQ g_m(BX), BX 250 MOVQ g_m(BX), BX
210 MOVQ m_errstr(BX), CX 251 MOVQ m_errstr(BX), CX
211 » MOVQ» CX, 8(SP) 252 » MOVQ» CX, 0(SP)
212 » MOVQ» $ERRMAX, 16(SP) 253 » MOVQ» $ERRMAX, 8(SP)
213 » MOVQ» $41, BP 254 » CALL» errstr<>(SB)
214 » SYSCALL
215
216 » // syscall requires caller-save
217 » MOVQ» 8(SP), CX
218
219 » // push the argument
220 » PUSHQ» CX
221 CALL runtime·findnull(SB) 255 CALL runtime·findnull(SB)
222 » POPQ» CX 256 » MOVQ» 8(SP), AX
223 » MOVQ» AX, 16(SP) 257 » MOVQ» AX, ret_len+8(FP)
258 » MOVQ» 0(SP), AX
259 » MOVQ» AX, ret_base+0(FP)
224 RET 260 RET
OLDNEW
« no previous file with comments | « src/pkg/runtime/sys_plan9_386.s ('k') | src/pkg/runtime/sys_solaris_amd64.s » ('j') | no next file with comments »

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