Skip to content

Commit d297e15

Browse files
committed
runtime: fix misleading comments in amd64 assembly
The RBX register is actually callee-saved, according to the System V ABI used by OpenBSD and Darwin. The comments now make more sense in the context of code that re-uses RBX after calling a function.
1 parent a621973 commit d297e15

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/runtime/sys_darwin_amd64.s

+1-1
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ TEXT runtime·pthread_cond_signal_trampoline(SB),NOSPLIT,$0
582582
TEXT runtime·pthread_self_trampoline(SB),NOSPLIT,$0
583583
PUSHQ BP
584584
MOVQ SP, BP
585-
MOVQ DI, BX // BX is caller-save
585+
MOVQ DI, BX // BX is callee-saved
586586
CALL libc_pthread_self(SB)
587587
MOVQ AX, 0(BX) // return value
588588
POPQ BP

src/runtime/sys_openbsd_amd64.s

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ TEXT runtime·exit_trampoline(SB),NOSPLIT,$0
178178
TEXT runtime·getthrid_trampoline(SB),NOSPLIT,$0
179179
PUSHQ BP
180180
MOVQ SP, BP
181-
MOVQ DI, BX // BX is caller-save
181+
MOVQ DI, BX // BX is callee-saved
182182
CALL libc_getthrid(SB)
183183
MOVL AX, 0(BX) // return value
184184
POPQ BP

0 commit comments

Comments
 (0)