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

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

Issue 12613044: code review 12613044: runtime: convert .s textflags from numbers to symbolic ... (Closed)
Patch Set: diff -r 06da2934c103 https://khr%40golang.org@code.google.com/p/go/ Created 11 years, 7 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_amd64.s ('k') | src/pkg/runtime/sys_windows_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 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 #include "zasm_GOOS_GOARCH.h" 5 #include "zasm_GOOS_GOARCH.h"
6 #include "../../cmd/ld/textflag.h"
6 7
7 // void runtime·asmstdcall(void *c); 8 // void runtime·asmstdcall(void *c);
8 TEXT runtime·asmstdcall(SB),7,$0 9 TEXT runtime·asmstdcall(SB),NOSPLIT,$0
9 MOVL c+0(FP), BX 10 MOVL c+0(FP), BX
10 11
11 // SetLastError(0). 12 // SetLastError(0).
12 MOVL $0, 0x34(FS) 13 MOVL $0, 0x34(FS)
13 14
14 // Copy args to the stack. 15 // Copy args to the stack.
15 MOVL SP, BP 16 MOVL SP, BP
16 MOVL wincall_n(BX), CX // words 17 MOVL wincall_n(BX), CX // words
17 MOVL CX, AX 18 MOVL CX, AX
18 SALL $2, AX 19 SALL $2, AX
(...skipping 12 matching lines...) Expand all
31 MOVL c+0(FP), BX 32 MOVL c+0(FP), BX
32 MOVL AX, wincall_r1(BX) 33 MOVL AX, wincall_r1(BX)
33 MOVL DX, wincall_r2(BX) 34 MOVL DX, wincall_r2(BX)
34 35
35 // GetLastError(). 36 // GetLastError().
36 MOVL 0x34(FS), AX 37 MOVL 0x34(FS), AX
37 MOVL AX, wincall_err(BX) 38 MOVL AX, wincall_err(BX)
38 39
39 RET 40 RET
40 41
41 TEXT» runtime·badsignal2(SB),7,$24 42 TEXT» runtime·badsignal2(SB),NOSPLIT,$24
42 // stderr 43 // stderr
43 MOVL $-12, 0(SP) 44 MOVL $-12, 0(SP)
44 MOVL SP, BP 45 MOVL SP, BP
45 CALL *runtime·GetStdHandle(SB) 46 CALL *runtime·GetStdHandle(SB)
46 MOVL BP, SP 47 MOVL BP, SP
47 48
48 MOVL AX, 0(SP) // handle 49 MOVL AX, 0(SP) // handle
49 MOVL $runtime·badsignalmsg(SB), DX // pointer 50 MOVL $runtime·badsignalmsg(SB), DX // pointer
50 MOVL DX, 4(SP) 51 MOVL DX, 4(SP)
51 MOVL runtime·badsignallen(SB), DX // count 52 MOVL runtime·badsignallen(SB), DX // count
52 MOVL DX, 8(SP) 53 MOVL DX, 8(SP)
53 LEAL 20(SP), DX // written count 54 LEAL 20(SP), DX // written count
54 MOVL $0, 0(DX) 55 MOVL $0, 0(DX)
55 MOVL DX, 12(SP) 56 MOVL DX, 12(SP)
56 MOVL $0, 16(SP) // overlapped 57 MOVL $0, 16(SP) // overlapped
57 CALL *runtime·WriteFile(SB) 58 CALL *runtime·WriteFile(SB)
58 MOVL BP, SI 59 MOVL BP, SI
59 RET 60 RET
60 61
61 // faster get/set last error 62 // faster get/set last error
62 TEXT runtime·getlasterror(SB),7,$0 63 TEXT runtime·getlasterror(SB),NOSPLIT,$0
63 MOVL 0x34(FS), AX 64 MOVL 0x34(FS), AX
64 RET 65 RET
65 66
66 TEXT runtime·setlasterror(SB),7,$0 67 TEXT runtime·setlasterror(SB),NOSPLIT,$0
67 MOVL err+0(FP), AX 68 MOVL err+0(FP), AX
68 MOVL AX, 0x34(FS) 69 MOVL AX, 0x34(FS)
69 RET 70 RET
70 71
71 TEXT runtime·sigtramp(SB),7,$28 72 TEXT runtime·sigtramp(SB),NOSPLIT,$28
72 // unwinding? 73 // unwinding?
73 MOVL info+0(FP), CX 74 MOVL info+0(FP), CX
74 TESTL $6, 4(CX) // exception flags 75 TESTL $6, 4(CX) // exception flags
75 MOVL $1, AX 76 MOVL $1, AX
76 JNZ sigdone 77 JNZ sigdone
77 78
78 // copy arguments for call to sighandler 79 // copy arguments for call to sighandler
79 MOVL CX, 0(SP) 80 MOVL CX, 0(SP)
80 MOVL context+8(FP), CX 81 MOVL context+8(FP), CX
81 MOVL CX, 4(SP) 82 MOVL CX, 4(SP)
(...skipping 17 matching lines...) Expand all
99 CALL runtime·sighandler(SB) 100 CALL runtime·sighandler(SB)
100 // AX is set to report result back to Windows 101 // AX is set to report result back to Windows
101 102
102 MOVL 24(SP), DI 103 MOVL 24(SP), DI
103 MOVL 20(SP), SI 104 MOVL 20(SP), SI
104 MOVL 16(SP), BP 105 MOVL 16(SP), BP
105 MOVL 12(SP), BX 106 MOVL 12(SP), BX
106 sigdone: 107 sigdone:
107 RET 108 RET
108 109
109 TEXT runtime·ctrlhandler(SB),7,$0 110 TEXT runtime·ctrlhandler(SB),NOSPLIT,$0
110 PUSHL $runtime·ctrlhandler1(SB) 111 PUSHL $runtime·ctrlhandler1(SB)
111 CALL runtime·externalthreadhandler(SB) 112 CALL runtime·externalthreadhandler(SB)
112 MOVL 4(SP), CX 113 MOVL 4(SP), CX
113 ADDL $12, SP 114 ADDL $12, SP
114 JMP CX 115 JMP CX
115 116
116 TEXT runtime·profileloop(SB),7,$0 117 TEXT runtime·profileloop(SB),NOSPLIT,$0
117 PUSHL $runtime·profileloop1(SB) 118 PUSHL $runtime·profileloop1(SB)
118 CALL runtime·externalthreadhandler(SB) 119 CALL runtime·externalthreadhandler(SB)
119 MOVL 4(SP), CX 120 MOVL 4(SP), CX
120 ADDL $12, SP 121 ADDL $12, SP
121 JMP CX 122 JMP CX
122 123
123 TEXT runtime·externalthreadhandler(SB),7,$0 124 TEXT runtime·externalthreadhandler(SB),NOSPLIT,$0
124 PUSHL BP 125 PUSHL BP
125 MOVL SP, BP 126 MOVL SP, BP
126 PUSHL BX 127 PUSHL BX
127 PUSHL SI 128 PUSHL SI
128 PUSHL DI 129 PUSHL DI
129 PUSHL 0x14(FS) 130 PUSHL 0x14(FS)
130 MOVL SP, DX 131 MOVL SP, DX
131 132
132 // setup dummy m, g 133 // setup dummy m, g
133 SUBL $m_end, SP // space for M 134 SUBL $m_end, SP // space for M
(...skipping 25 matching lines...) Expand all
159 MOVL g_stackbase(CX), SP 160 MOVL g_stackbase(CX), SP
160 POPL 0x14(FS) 161 POPL 0x14(FS)
161 POPL DI 162 POPL DI
162 POPL SI 163 POPL SI
163 POPL BX 164 POPL BX
164 POPL BP 165 POPL BP
165 RET 166 RET
166 167
167 GLOBL runtime·cbctxts(SB), $4 168 GLOBL runtime·cbctxts(SB), $4
168 169
169 TEXT runtime·callbackasm1+0(SB),7,$0 170 TEXT runtime·callbackasm1+0(SB),NOSPLIT,$0
170 MOVL 0(SP), AX // will use to find our callback context 171 MOVL 0(SP), AX // will use to find our callback context
171 172
172 // remove return address from stack, we are not returning there 173 // remove return address from stack, we are not returning there
173 ADDL $4, SP 174 ADDL $4, SP
174 175
175 // address to callback parameters into CX 176 // address to callback parameters into CX
176 LEAL 4(SP), CX 177 LEAL 4(SP), CX
177 178
178 // save registers as required for windows callback 179 // save registers as required for windows callback
179 PUSHL DI 180 PUSHL DI
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // remove callback parameters before return (as per Windows spec) 245 // remove callback parameters before return (as per Windows spec)
245 POPL DX 246 POPL DX
246 ADDL CX, SP 247 ADDL CX, SP
247 PUSHL DX 248 PUSHL DX
248 249
249 CLD 250 CLD
250 251
251 RET 252 RET
252 253
253 // void tstart(M *newm); 254 // void tstart(M *newm);
254 TEXT runtime·tstart(SB),7,$0 255 TEXT runtime·tstart(SB),NOSPLIT,$0
255 MOVL newm+4(SP), CX // m 256 MOVL newm+4(SP), CX // m
256 MOVL m_g0(CX), DX // g 257 MOVL m_g0(CX), DX // g
257 258
258 // Layout new m scheduler stack on os stack. 259 // Layout new m scheduler stack on os stack.
259 MOVL SP, AX 260 MOVL SP, AX
260 MOVL AX, g_stackbase(DX) 261 MOVL AX, g_stackbase(DX)
261 SUBL $(64*1024), AX // stack size 262 SUBL $(64*1024), AX // stack size
262 MOVL AX, g_stackguard(DX) 263 MOVL AX, g_stackguard(DX)
263 264
264 // Set up tls. 265 // Set up tls.
265 LEAL m_tls(CX), SI 266 LEAL m_tls(CX), SI
266 MOVL SI, 0x14(FS) 267 MOVL SI, 0x14(FS)
267 MOVL CX, m(SI) 268 MOVL CX, m(SI)
268 MOVL DX, g(SI) 269 MOVL DX, g(SI)
269 270
270 // Someday the convention will be D is always cleared. 271 // Someday the convention will be D is always cleared.
271 CLD 272 CLD
272 273
273 CALL runtime·stackcheck(SB) // clobbers AX,CX 274 CALL runtime·stackcheck(SB) // clobbers AX,CX
274 CALL runtime·mstart(SB) 275 CALL runtime·mstart(SB)
275 276
276 RET 277 RET
277 278
278 // uint32 tstart_stdcall(M *newm); 279 // uint32 tstart_stdcall(M *newm);
279 TEXT runtime·tstart_stdcall(SB),7,$0 280 TEXT runtime·tstart_stdcall(SB),NOSPLIT,$0
280 MOVL newm+4(SP), BX 281 MOVL newm+4(SP), BX
281 282
282 PUSHL BX 283 PUSHL BX
283 CALL runtime·tstart(SB) 284 CALL runtime·tstart(SB)
284 POPL BX 285 POPL BX
285 286
286 // Adjust stack for stdcall to return properly. 287 // Adjust stack for stdcall to return properly.
287 MOVL (SP), AX // save return address 288 MOVL (SP), AX // save return address
288 ADDL $4, SP // remove single parameter 289 ADDL $4, SP // remove single parameter
289 MOVL AX, (SP) // restore return address 290 MOVL AX, (SP) // restore return address
290 291
291 XORL AX, AX // return 0 == success 292 XORL AX, AX // return 0 == success
292 293
293 RET 294 RET
294 295
295 // setldt(int entry, int address, int limit) 296 // setldt(int entry, int address, int limit)
296 TEXT runtime·setldt(SB),7,$0 297 TEXT runtime·setldt(SB),NOSPLIT,$0
297 MOVL address+4(FP), CX 298 MOVL address+4(FP), CX
298 MOVL CX, 0x14(FS) 299 MOVL CX, 0x14(FS)
299 RET 300 RET
300 301
301 // void install_exception_handler() 302 // void install_exception_handler()
302 TEXT runtime·install_exception_handler(SB),7,$0 303 TEXT runtime·install_exception_handler(SB),NOSPLIT,$0
303 get_tls(CX) 304 get_tls(CX)
304 MOVL m(CX), CX // m 305 MOVL m(CX), CX // m
305 306
306 // Set up SEH frame 307 // Set up SEH frame
307 MOVL m_seh(CX), DX 308 MOVL m_seh(CX), DX
308 MOVL $runtime·sigtramp(SB), AX 309 MOVL $runtime·sigtramp(SB), AX
309 MOVL AX, seh_handler(DX) 310 MOVL AX, seh_handler(DX)
310 MOVL 0(FS), AX 311 MOVL 0(FS), AX
311 MOVL AX, seh_prev(DX) 312 MOVL AX, seh_prev(DX)
312 313
313 // Install it 314 // Install it
314 MOVL DX, 0(FS) 315 MOVL DX, 0(FS)
315 316
316 RET 317 RET
317 318
318 // void remove_exception_handler() 319 // void remove_exception_handler()
319 TEXT runtime·remove_exception_handler(SB),7,$0 320 TEXT runtime·remove_exception_handler(SB),NOSPLIT,$0
320 get_tls(CX) 321 get_tls(CX)
321 MOVL m(CX), CX // m 322 MOVL m(CX), CX // m
322 323
323 // Remove SEH frame 324 // Remove SEH frame
324 MOVL m_seh(CX), DX 325 MOVL m_seh(CX), DX
325 MOVL seh_prev(DX), AX 326 MOVL seh_prev(DX), AX
326 MOVL AX, 0(FS) 327 MOVL AX, 0(FS)
327 328
328 RET 329 RET
329 330
330 // Sleep duration is in 100ns units. 331 // Sleep duration is in 100ns units.
331 TEXT runtime·usleep1(SB),7,$0 332 TEXT runtime·usleep1(SB),NOSPLIT,$0
332 MOVL duration+0(FP), BX 333 MOVL duration+0(FP), BX
333 MOVL $runtime·usleep2(SB), AX // to hide from 8l 334 MOVL $runtime·usleep2(SB), AX // to hide from 8l
334 335
335 // Execute call on m->g0 stack, in case we are not actually 336 // Execute call on m->g0 stack, in case we are not actually
336 // calling a system call wrapper, like when running under WINE. 337 // calling a system call wrapper, like when running under WINE.
337 get_tls(CX) 338 get_tls(CX)
338 CMPL CX, $0 339 CMPL CX, $0
339 JNE 3(PC) 340 JNE 3(PC)
340 // Not a Go-managed thread. Do not switch stack. 341 // Not a Go-managed thread. Do not switch stack.
341 CALL AX 342 CALL AX
342 RET 343 RET
343 344
344 MOVL m(CX), BP 345 MOVL m(CX), BP
345 MOVL m_g0(BP), SI 346 MOVL m_g0(BP), SI
346 CMPL g(CX), SI 347 CMPL g(CX), SI
347 JNE 3(PC) 348 JNE 3(PC)
348 // executing on m->g0 already 349 // executing on m->g0 already
349 CALL AX 350 CALL AX
350 RET 351 RET
351 352
352 // Switch to m->g0 stack and back. 353 // Switch to m->g0 stack and back.
353 MOVL (g_sched+gobuf_sp)(SI), SI 354 MOVL (g_sched+gobuf_sp)(SI), SI
354 MOVL SP, -4(SI) 355 MOVL SP, -4(SI)
355 LEAL -4(SI), SP 356 LEAL -4(SI), SP
356 CALL AX 357 CALL AX
357 MOVL 0(SP), SP 358 MOVL 0(SP), SP
358 RET 359 RET
359 360
360 // Runs on OS stack. duration (in 100ns units) is in BX. 361 // Runs on OS stack. duration (in 100ns units) is in BX.
361 TEXT runtime·usleep2(SB),7,$20 362 TEXT runtime·usleep2(SB),NOSPLIT,$20
362 // Want negative 100ns units. 363 // Want negative 100ns units.
363 NEGL BX 364 NEGL BX
364 MOVL $-1, hi-4(SP) 365 MOVL $-1, hi-4(SP)
365 MOVL BX, lo-8(SP) 366 MOVL BX, lo-8(SP)
366 LEAL lo-8(SP), BX 367 LEAL lo-8(SP), BX
367 MOVL BX, ptime-12(SP) 368 MOVL BX, ptime-12(SP)
368 MOVL $0, alertable-16(SP) 369 MOVL $0, alertable-16(SP)
369 MOVL $-1, handle-20(SP) 370 MOVL $-1, handle-20(SP)
370 MOVL SP, BP 371 MOVL SP, BP
371 MOVL runtime·NtWaitForSingleObject(SB), AX 372 MOVL runtime·NtWaitForSingleObject(SB), AX
372 CALL AX 373 CALL AX
373 MOVL BP, SP 374 MOVL BP, SP
374 RET 375 RET
OLDNEW
« no previous file with comments | « src/pkg/runtime/sys_plan9_amd64.s ('k') | src/pkg/runtime/sys_windows_amd64.s » ('j') | no next file with comments »

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