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

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

Issue 3733046: code review 3733046: new cgo windows port. (Closed)
Left Patch Set: Created 14 years, 3 months ago
Right Patch Set: code review 3733046: new cgo windows port. Created 14 years, 2 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/debug/pe/file.go ('k') | src/pkg/runtime/cgo/Makefile » ('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 #include "386/asm.h" 5 #include "386/asm.h"
6 6
7 TEXT _rt0_386(SB),7,$0 7 TEXT _rt0_386(SB),7,$0
8 // copy arguments forward on an even stack 8 // copy arguments forward on an even stack
9 MOVL 0(SP), AX // argc 9 MOVL 0(SP), AX // argc
10 LEAL 4(SP), BX // argv 10 LEAL 4(SP), BX // argv
11 SUBL $128, SP // plenty of scratch 11 SUBL $128, SP // plenty of scratch
12 ANDL $~15, SP 12 ANDL $~15, SP
13 MOVL AX, 120(SP) // save argc, argv away 13 MOVL AX, 120(SP) // save argc, argv away
14 MOVL BX, 124(SP) 14 MOVL BX, 124(SP)
15 15
16 // if there is an initcgo, call it to let it 16 // if there is an initcgo, call it to let it
17 // initialize and to set up GS. if not, 17 // initialize and to set up GS. if not,
18 // we set up GS ourselves. 18 // we set up GS ourselves.
19 MOVL initcgo(SB), AX 19 MOVL initcgo(SB), AX
20 TESTL AX, AX 20 TESTL AX, AX
21 » JZ» 2(PC) 21 » JZ» 4(PC)
22 CALL AX 22 CALL AX
23 CMPL runtime·iswindows(SB), $0
24 JEQ ok
23 25
24 // set up %gs 26 // set up %gs
25 CALL runtime·ldt0setup(SB) 27 CALL runtime·ldt0setup(SB)
26 28
27 // store through it, to make sure it works 29 // store through it, to make sure it works
28 CMPL runtime·isplan9(SB), $1 30 CMPL runtime·isplan9(SB), $1
29 JEQ ok 31 JEQ ok
30 get_tls(BX) 32 get_tls(BX)
31 MOVL $0x123, g(BX) 33 MOVL $0x123, g(BX)
32 MOVL runtime·tls0(SB), AX 34 MOVL runtime·tls0(SB), AX
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 get_tls(CX) 150 get_tls(CX)
149 MOVL m(CX), BX 151 MOVL m(CX), BX
150 MOVL m_g0(BX), SI 152 MOVL m_g0(BX), SI
151 CMPL g(CX), SI 153 CMPL g(CX), SI
152 JNE 2(PC) 154 JNE 2(PC)
153 INT $3 155 INT $3
154 156
155 // frame size in DX 157 // frame size in DX
156 // arg size in AX 158 // arg size in AX
157 // Save in m. 159 // Save in m.
158 » MOVL» DX, m_moreframe(BX) 160 » MOVL» DX, m_moreframesize(BX)
159 » MOVL» AX, m_moreargs(BX) 161 » MOVL» AX, m_moreargsize(BX)
160 162
161 // Called from f. 163 // Called from f.
162 // Set m->morebuf to f's caller. 164 // Set m->morebuf to f's caller.
163 MOVL 4(SP), DI // f's caller's PC 165 MOVL 4(SP), DI // f's caller's PC
164 MOVL DI, (m_morebuf+gobuf_pc)(BX) 166 MOVL DI, (m_morebuf+gobuf_pc)(BX)
165 LEAL 8(SP), CX // f's caller's SP 167 LEAL 8(SP), CX // f's caller's SP
166 MOVL CX, (m_morebuf+gobuf_sp)(BX) 168 MOVL CX, (m_morebuf+gobuf_sp)(BX)
167 » MOVL» CX, (m_morefp)(BX) 169 » MOVL» CX, m_moreargp(BX)
168 get_tls(CX) 170 get_tls(CX)
169 MOVL g(CX), SI 171 MOVL g(CX), SI
170 MOVL SI, (m_morebuf+gobuf_g)(BX) 172 MOVL SI, (m_morebuf+gobuf_g)(BX)
171 173
172 // Set m->morepc to f's PC. 174 // Set m->morepc to f's PC.
173 MOVL 0(SP), AX 175 MOVL 0(SP), AX
174 MOVL AX, m_morepc(BX) 176 MOVL AX, m_morepc(BX)
175 177
176 // Call newstack on m's scheduling stack. 178 // Call newstack on m's scheduling stack.
177 MOVL m_g0(BX), BP 179 MOVL m_g0(BX), BP
(...skipping 27 matching lines...) Expand all
205 // We set f's frame size to 1, as a hint to newstack 207 // We set f's frame size to 1, as a hint to newstack
206 // that this is a call from reflect·call. 208 // that this is a call from reflect·call.
207 // If it turns out that f needs a larger frame than 209 // If it turns out that f needs a larger frame than
208 // the default stack, f's usual stack growth prolog will 210 // the default stack, f's usual stack growth prolog will
209 // allocate a new segment (and recopy the arguments). 211 // allocate a new segment (and recopy the arguments).
210 MOVL 4(SP), AX // fn 212 MOVL 4(SP), AX // fn
211 MOVL 8(SP), DX // arg frame 213 MOVL 8(SP), DX // arg frame
212 MOVL 12(SP), CX // arg size 214 MOVL 12(SP), CX // arg size
213 215
214 MOVL AX, m_morepc(BX) // f's PC 216 MOVL AX, m_morepc(BX) // f's PC
215 » MOVL» DX, m_morefp(BX)» // argument frame pointer 217 » MOVL» DX, m_moreargp(BX)» // f's argument pointer
216 » MOVL» CX, m_moreargs(BX)» // f's argument size 218 » MOVL» CX, m_moreargsize(BX)» // f's argument size
217 » MOVL» $1, m_moreframe(BX)» // f's frame size 219 » MOVL» $1, m_moreframesize(BX)»// f's frame size
218 220
219 // Call newstack on m's scheduling stack. 221 // Call newstack on m's scheduling stack.
220 MOVL m_g0(BX), BP 222 MOVL m_g0(BX), BP
221 get_tls(CX) 223 get_tls(CX)
222 MOVL BP, g(CX) 224 MOVL BP, g(CX)
223 MOVL (m_sched+gobuf_sp)(BX), SP 225 MOVL (m_sched+gobuf_sp)(BX), SP
224 CALL runtime·newstack(SB) 226 CALL runtime·newstack(SB)
225 MOVL $0, 0x1103 // crash if newstack returns 227 MOVL $0, 0x1103 // crash if newstack returns
226 RET 228 RET
227 229
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 MOVL g(CX), AX 409 MOVL g(CX), AX
408 CMPL g_stackbase(AX), SP 410 CMPL g_stackbase(AX), SP
409 JHI 2(PC) 411 JHI 2(PC)
410 INT $3 412 INT $3
411 CMPL SP, g_stackguard(AX) 413 CMPL SP, g_stackguard(AX)
412 JHI 2(PC) 414 JHI 2(PC)
413 INT $3 415 INT $3
414 RET 416 RET
415 417
416 GLOBL runtime·tls0(SB), $32 418 GLOBL runtime·tls0(SB), $32
LEFTRIGHT

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