git: 86c63225ea21 - main - rtld: Microoptimize rtld_start on i386

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Tue, 11 Jul 2023 12:12:17 UTC
The branch main has been updated by dchagin:

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

commit 86c63225ea21f2b4c0926bde9d9d4da1ec891b06
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-07-11 12:10:08 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-07-11 12:10:08 +0000

    rtld: Microoptimize rtld_start on i386
    
    Initial stack pointer is preserved in calle-saved %esi,
    use it bellow to pass initial stack pointer to _rtld().
    
    Reviewed by:            kib
    Differential Revision:  https://reviews.freebsd.org/D40950
---
 libexec/rtld-elf/i386/rtld_start.S | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libexec/rtld-elf/i386/rtld_start.S b/libexec/rtld-elf/i386/rtld_start.S
index 87dca0e5b66b..6dbae220d89c 100644
--- a/libexec/rtld-elf/i386/rtld_start.S
+++ b/libexec/rtld-elf/i386/rtld_start.S
@@ -31,7 +31,6 @@
 	.type	.rtld_start,@function
 .rtld_start:
 	xorl	%ebp,%ebp		# Clear frame pointer for good form
-	movl	%esp,%eax		# Save initial stack pointer
 	movl	%esp,%esi		# Save initial stack pointer
 	andl	$0xfffffff0,%esp	# Align stack pointer
 	subl	$16,%esp		# A place to store exit procedure addr
@@ -41,7 +40,7 @@
 	subl	$4,%esp			# Keep stack aligned
 	pushl	%ecx			# Pass address of obj_main
 	pushl	%ebx			# Pass address of exit proc
-	pushl	%eax			# Pass initial stack pointer to rtld
+	pushl	%esi			# Pass initial stack pointer to rtld
 	call	_rtld			# Call rtld(sp); returns entry point
 	addl	$16,%esp		# Remove arguments from stack
 	popl	%edx			# Get exit procedure address