public inbox for grub-devel@gnu.org
 help / color / mirror / Atom feed
* [PATCH RESEND] lib/x86_64/setjmp: Use 32-bit zero idiom for shorter encoding
@ 2025-11-26  8:45 George Hu
  2025-12-18 17:28 ` Daniel Kiper
  0 siblings, 1 reply; 2+ messages in thread
From: George Hu @ 2025-11-26  8:45 UTC (permalink / raw)
  To: grub-devel
  Cc: Daniel Kiper, Alex Burmashev,
	Vladimir 'phcoder' Serbinenko, George Hu

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.

Signed-off-by: George Hu <integral@archlinux.org>
---
 grub-core/lib/x86_64/setjmp.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/grub-core/lib/x86_64/setjmp.S b/grub-core/lib/x86_64/setjmp.S
index 6b151bc4d..4c6c81249 100644
--- a/grub-core/lib/x86_64/setjmp.S
+++ b/grub-core/lib/x86_64/setjmp.S
@@ -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
-- 
2.52.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH RESEND] lib/x86_64/setjmp: Use 32-bit zero idiom for shorter encoding
  2025-11-26  8:45 [PATCH RESEND] lib/x86_64/setjmp: Use 32-bit zero idiom for shorter encoding George Hu
@ 2025-12-18 17:28 ` Daniel Kiper
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Kiper @ 2025-12-18 17:28 UTC (permalink / raw)
  To: George Hu
  Cc: grub-devel, Alex Burmashev, Vladimir 'phcoder' Serbinenko

On Wed, Nov 26, 2025 at 04:45:46PM +0800, George Hu wrote:
> 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.
>
> Signed-off-by: George Hu <integral@archlinux.org>

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-18 17:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-26  8:45 [PATCH RESEND] lib/x86_64/setjmp: Use 32-bit zero idiom for shorter encoding George Hu
2025-12-18 17:28 ` Daniel Kiper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox