Skip to content

Commit fd3976b

Browse files
aykevldeadprogram
authored andcommitted
windows: fix wrong register for first parameter
I'm surprised this worked as long as it did, since it looks like the goroutine stack did not get scanned. Or maybe the RCX register contained the stack pointer by accident. In any case, it now uses the correct register (RCX instead of RDI on Windows) for passing the stack pointer as the first parameter.
1 parent 48f145c commit fd3976b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/runtime/asm_amd64_windows.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ tinygo_scanCurrentStack:
1212
pushq %r15
1313

1414
// Scan the stack.
15-
subq $8, %rsp // adjust the stack before the call to maintain 16-byte alignment
16-
movq %rsp, %rdi
15+
subq $8, %rsp // adjust the stack before the call to maintain 16-byte alignment
16+
movq %rsp, %rcx // pass the stack pointer as the first parameter
1717
callq tinygo_scanstack
1818

1919
// Restore the stack pointer. Registers do not need to be restored as they

0 commit comments

Comments
 (0)