Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 May 2003 18:11:54 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 31748 for review
Message-ID:  <200305240111.h4O1BsAA007869@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=31748

Change 31748 by peter@peter_hammer on 2003/05/23 18:11:46

	Take a shot at _rtld_bind_start

Affected files ...

.. //depot/projects/hammer/libexec/rtld-elf/amd64/rtld_start.S#8 edit

Differences ...

==== //depot/projects/hammer/libexec/rtld-elf/amd64/rtld_start.S#8 (text+ko) ====

@@ -60,26 +60,52 @@
  * We are careful to preserve all registers, even the the caller-save
  * registers.  That is because this code may be invoked by low-level
  * assembly-language code that is not ABI-compliant.
+ *
+ * Stack map:
+ * obj          0x58
+ * reloff       0x50
+ * return addr  0x48
+ * rflags       0x40
+ * rax          0x38
+ * rdx          0x30
+ * rcx          0x28
+ * rdi          0x20
+ * r8           0x18
+ * r9           0x10
+ * r10          0x8
+ * r11          0x0
  */
 	.align	4
 	.globl	_rtld_bind_start
 	.type	_rtld_bind_start,@function
 _rtld_bind_start:
-	pushfq				# Save eflags
+	pushfq				# Save rflags
 	pushq	%rax			# Save %rax
 	pushq	%rdx			# Save %rdx
 	pushq	%rcx			# Save %rcx
-	pushq	20(%rsp)		# Copy reloff argument
-	pushq	20(%rsp)		# Copy obj argument
+	pushq	%rsi			# Save %rsi
+	pushq	%rdi			# Save %rdi
+	pushq	%r8			# Save %r8
+	pushq	%r9			# Save %r9
+	pushq	%r10			# Save %r10
+	pushq	%r11			# Save %r11
+
+	movq	0x58(%rsp),%rdi		# Fetch obj argument
+	movq	0x50(%rsp),%rsi		# Fetch reloff argument
 
 	call	_rtld_bind@PLT		# Transfer control to the binder
 	/* Now %rax contains the entry point of the function being called. */
 
-	addq	$16,%rsp		# Discard binder arguments
-	movq	%rax,20(%rsp)		# Store target over obj argument
+	movq	%rax,0x58(%rsp)		# Store target over obj argument
+	popq	%r11			# Restore %r11
+	popq	%r10			# Restore %r10
+	popq	%r9			# Restore %r9
+	popq	%r8			# Restore %r8
+	popq	%rdi			# Restore %rdi
+	popq	%rsi			# Restore %rsi
 	popq	%rcx			# Restore %rcx
 	popq	%rdx			# Restore %rdx
 	popq	%rax			# Restore %rax
-	popfq				# Restore eflags
-	leaq	8(%rsp),%rsp		# Discard reloff, do not change eflags
+	popfq				# Restore rflags
+	leaq	8(%rsp),%rsp		# Discard reloff, do not change rflags
 	ret				# "Return" to target address



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305240111.h4O1BsAA007869>