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

Delta Between Two Patch Sets: src/pkg/runtime/windows/386/sys.s

Issue 4960057: code review 4960057: runtime: implement pprof support for windows (Closed)
Left Patch Set: diff -r 2d8706ce68b4 https://go.googlecode.com/hg/ Created 12 years, 6 months ago
Right Patch Set: diff -r b80728111ff9 https://go.googlecode.com/hg/ Created 12 years, 6 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
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 #include "386/asm.h" 5 #include "386/asm.h"
6 6
7 // void runtime·asmstdcall(void *c); 7 // void runtime·asmstdcall(void *c);
8 TEXT runtime·asmstdcall(SB),7,$0 8 TEXT runtime·asmstdcall(SB),7,$0
9 » MOVL» c+0(FP), DX 9 » MOVL» c+0(FP), BX
10 10
11 // SetLastError(0). 11 // SetLastError(0).
12 MOVL $0, 0x34(FS) 12 MOVL $0, 0x34(FS)
13 13
14 // Copy args to the stack. 14 // Copy args to the stack.
15 MOVL SP, BP 15 MOVL SP, BP
16 » MOVL» wincall_n(DX), CX» // words 16 » MOVL» wincall_n(BX), CX» // words
17 » MOVL» CX, BX 17 » MOVL» CX, AX
18 » SALL» $2, BX 18 » SALL» $2, AX
19 » SUBL» BX, SP» » » // room for args 19 » SUBL» AX, SP» » » // room for args
20 MOVL SP, DI 20 MOVL SP, DI
21 » MOVL» wincall_args(DX), SI 21 » MOVL» wincall_args(BX), SI
22 CLD 22 CLD
23 REP; MOVSL 23 REP; MOVSL
24 24
25 // Call stdcall or cdecl function. 25 // Call stdcall or cdecl function.
26 // DI SI BP BX are preserved, SP is not 26 // DI SI BP BX are preserved, SP is not
27 » MOVL» wincall_fn(DX), AX 27 » CALL» wincall_fn(BX)
28 » CALL» AX
29 MOVL BP, SP 28 MOVL BP, SP
30 29
31 // Return result. 30 // Return result.
32 » MOVL» c+0(FP), DX 31 » MOVL» c+0(FP), BX
33 » MOVL» AX, wincall_r(DX) 32 » MOVL» AX, wincall_r1(BX)
33 » MOVL» DX, wincall_r2(BX)
34 34
35 // GetLastError(). 35 // GetLastError().
36 » MOVL» 0x34(FS), BX 36 » MOVL» 0x34(FS), AX
37 » MOVL» BX, wincall_err(DX) 37 » MOVL» AX, wincall_err(BX)
38 38
39 RET 39 RET
40 40
41 // faster get/set last error 41 // faster get/set last error
42 TEXT runtime·getlasterror(SB),7,$0 42 TEXT runtime·getlasterror(SB),7,$0
43 MOVL 0x34(FS), AX 43 MOVL 0x34(FS), AX
44 RET 44 RET
45 45
46 TEXT runtime·setlasterror(SB),7,$0 46 TEXT runtime·setlasterror(SB),7,$0
47 MOVL err+0(FP), AX 47 MOVL err+0(FP), AX
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 CALL 4(BX) 94 CALL 4(BX)
95 95
96 sigdone: 96 sigdone:
97 RET 97 RET
98 98
99 TEXT runtime·ctrlhandler(SB),7,$0 99 TEXT runtime·ctrlhandler(SB),7,$0
100 PUSHL $runtime·ctrlhandler1(SB) 100 PUSHL $runtime·ctrlhandler1(SB)
101 CALL runtime·externalthreadhandler(SB) 101 CALL runtime·externalthreadhandler(SB)
102 MOVL 4(SP), CX 102 MOVL 4(SP), CX
103 ADDL $12, SP 103 ADDL $12, SP
104 JMP CX 104 JMP CX
jp 2011/09/08 07:24:15 looks like POPL CX // to any register RET 4
hector 2011/09/08 10:40:20 Unfortunately the assembler doesn't support RETN n
105 105
106 TEXT runtime·timerhandler(SB),7,$0 106 TEXT runtime·profileloop(SB),7,$0
107 » PUSHL» $runtime·timerhandler1(SB) 107 » PUSHL» $runtime·profileloop1(SB)
108 CALL runtime·externalthreadhandler(SB) 108 CALL runtime·externalthreadhandler(SB)
109 MOVL 4(SP), CX 109 MOVL 4(SP), CX
110 » ADDL» $16, SP 110 » ADDL» $12, SP
111 JMP CX 111 JMP CX
jp 2011/09/08 07:24:15 looks like POPL CX // to any register RET 8
112 112
113 TEXT runtime·externalthreadhandler(SB),7,$0 113 TEXT runtime·externalthreadhandler(SB),7,$0
114 PUSHL BP 114 PUSHL BP
115 MOVL SP, BP 115 MOVL SP, BP
116 PUSHL BX 116 PUSHL BX
117 PUSHL SI 117 PUSHL SI
118 PUSHL DI 118 PUSHL DI
119 PUSHL 0x2c(FS) 119 PUSHL 0x2c(FS)
120 » MOVL» SP, BX 120 » MOVL» SP, DX
121 121
122 // setup dummy m, g 122 // setup dummy m, g
123 SUBL $m_end, SP // space for M 123 SUBL $m_end, SP // space for M
124 MOVL SP, 0(SP)
125 MOVL $m_end, 4(SP)
126 CALL runtime·memclr(SB) // smashes AX,BX,CX
127
124 LEAL m_tls(SP), CX 128 LEAL m_tls(SP), CX
125 MOVL CX, 0x2c(FS) 129 MOVL CX, 0x2c(FS)
126 MOVL SP, m(CX) 130 MOVL SP, m(CX)
127 » MOVL» SP, DX 131 » MOVL» SP, BX
128 SUBL $g_end, SP // space for G 132 SUBL $g_end, SP // space for G
129 MOVL SP, g(CX) 133 MOVL SP, g(CX)
130 » MOVL» SP, m_g0(DX) 134 » MOVL» SP, m_g0(BX)
135
136 » MOVL» SP, 0(SP)
137 » MOVL» $g_end, 4(SP)
138 » CALL» runtime·memclr(SB)» // smashes AX,BX,CX
131 LEAL -4096(SP), CX 139 LEAL -4096(SP), CX
132 MOVL CX, g_stackguard(SP) 140 MOVL CX, g_stackguard(SP)
133 » MOVL» BX, g_stackbase(SP) 141 » MOVL» DX, g_stackbase(SP)
134 142
135 PUSHL 16(BP) // arg for handler 143 PUSHL 16(BP) // arg for handler
136 CALL 8(BP) 144 CALL 8(BP)
137 POPL CX 145 POPL CX
138 146
139 get_tls(CX) 147 get_tls(CX)
140 MOVL g(CX), CX 148 MOVL g(CX), CX
141 MOVL g_stackbase(CX), SP 149 MOVL g_stackbase(CX), SP
142 POPL 0x2c(FS) 150 POPL 0x2c(FS)
143 POPL DI 151 POPL DI
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 259
252 XORL AX, AX // return 0 == success 260 XORL AX, AX // return 0 == success
253 261
254 RET 262 RET
255 263
256 // setldt(int entry, int address, int limit) 264 // setldt(int entry, int address, int limit)
257 TEXT runtime·setldt(SB),7,$0 265 TEXT runtime·setldt(SB),7,$0
258 MOVL address+4(FP), CX 266 MOVL address+4(FP), CX
259 MOVL CX, 0x2c(FS) 267 MOVL CX, 0x2c(FS)
260 RET 268 RET
LEFTRIGHT

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