From 664b621a16398fd530ebb1ac3c61dff68fb54f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Gr=C3=A9goire?= Date: Sat, 24 Oct 2026 19:01:45 -0400 Subject: [PATCH] ke/amd64: use movb instead of xchg --- src/sys/kern/amd64/locore.s | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/sys/kern/amd64/locore.s b/src/sys/kern/amd64/locore.s index 0482263..3fa2515 100644 --- a/src/sys/kern/amd64/locore.s +++ b/src/sys/kern/amd64/locore.s @@ -150,12 +150,10 @@ amd64_context_switch: mov (%rsi), %rsp /* Set switching to false. */ - xorl %eax, %eax - xchgb %al, (%rcx) + movb $0, (%rcx) /* Unlock passed lock. */ - xorl %eax, %eax - xchgb %al, (%rdx) + movb $0, (%rdx) /* Restore callee-saved registers. */ pop %rbp @@ -196,12 +194,10 @@ amd64_context_switch_cont_n: call ki_free_old_stack /* Set switching to false. */ - xorl %eax, %eax - xchgb %al, (%r13) + movb $0, (%r13) /* Unlock passed lock. */ - xorl %eax, %eax - xchgb %al, (%r12) + movb $0, (%r12) /* Restore callee-saved registers. */ pop %rbp