Skip to contentSkip to conversation

lib/x86_64/setjmp: Use 32-bit zero idiom for shorter encoding

PATCH Superseded George Hu 1 participant 1 message Nov 26, 2025

lore
Share & tools
lore

George Hu

author
#0 lore raw

PATCH 1/1 lib/x86_64/setjmp: Use 32-bit zero idiom for shorter encoding

Switch from xorq %rax, %rax to xorl %eax, %eax. In 64-bit mode, zeroing EAX implicitly clears RAX, and the 32-bit form encodes one byte smaller while keeping identical semantics.

---
 grub-core/lib/x86_64/setjmp.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
grub-core/lib/x86_64/setjmp.S +1 -1
index 6b151bc4d..4c6c81249 100644
@@ -36,7 +36,7 @@ GRUB_MOD_LICENSE "GPLv3+"
  */
 FUNCTION(grub_setjmp)
 	pop	%rsi		/* Return address, and adjust the stack */
-	xorq	%rax, %rax
+	xorl	%eax, %eax
 	movq	%rbx, 0(%rdi)	/* RBX */
 	movq	%rsp, 8(%rdi)   /* RSP */
 	push	%rsi
Signature · 7 lines
2.52.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel