git: acc46e300b0d - main - cpu_switch(): Move 'sw1wait' inside the function block

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Tue, 24 Nov 2026 20:46:26 UTC
The branch main has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=acc46e300b0de09ac78df4099a187527c547c15d

commit acc46e300b0de09ac78df4099a187527c547c15d
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-06-05 16:21:54 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-11-24 20:45:56 +0000

    cpu_switch(): Move 'sw1wait' inside the function block
    
    This code block is unrelated to the resumectx() procedure it was after,
    and is referenced only by cpu_switch(), so move it between
    ENTRY(cpu_switch) and END(cpu_switch).  This, in particular, puts it
    inside a .cfi_startproc/.cfi_endproc block, giving clearer debugging
    information should a problem arise there.
    
    Keep it at the end so that jumping to it is initially predicted not
    taken.
    
    Reviewed by:    kib
    Fixes:          73dd84a7a54d ("amd64: clean up cpu_switch.S")
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D61713
---
 sys/amd64/amd64/cpu_switch.S | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S
index 47519c38b7ee..9fd3074ee231 100644
--- a/sys/amd64/amd64/cpu_switch.S
+++ b/sys/amd64/amd64/cpu_switch.S
@@ -299,6 +299,15 @@ do_ldt:	movq	PCPU(LDT),%rax
 ctx_switch_xsave32:
 	xsave	(%r9)
 	jmp	ctx_switch_xsave_done
+
+	/* Wait for the new thread to become unblocked */
+sw1wait:
+1:
+	pause
+	movq	TD_LOCK(%r12),%rcx
+	cmpq	%rcx, %rdx
+	je	1b
+	jmp	sw1cont
 END(cpu_switch)
 
 /*
@@ -554,13 +563,4 @@ ENTRY(resumectx)
 	ret
 END(resumectx)
 
-/* Wait for the new thread to become unblocked */
-sw1wait:
-1:
-	pause
-	movq	TD_LOCK(%r12),%rcx
-	cmpq	%rcx, %rdx
-	je	1b
-	jmp	sw1cont
-
 	.section .note.GNU-stack,"",%progbits