[x32] PATCH: Properly save the x32 new stack boundary

H.J. Lu hongjiu.lu@intel.com
Wed Mar 16 01:01:00 GMT 2011


Hi,

I checked in this patch to properly save the x32 new stack boundary.


H.J.
---
commit 556b6e068c17f0b5775140c29cd5323014775b37
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Mar 15 18:00:01 2011 -0700

    Properly save the x32 new stack boundary.

diff --git a/libgcc/ChangeLog.x32 b/libgcc/ChangeLog.x32
index d980b39..2fc9d48 100644
--- a/libgcc/ChangeLog.x32
+++ b/libgcc/ChangeLog.x32
@@ -1,3 +1,8 @@
+2011-03-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* config/i386/morestack.S: Properly save the x32 new stack
+	boundary.
+
 2011-02-14  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* config/i386/morestack.S: Replace __LP64___ with __LP64__.
diff --git a/libgcc/config/i386/morestack.S b/libgcc/config/i386/morestack.S
index 4496e3d..70a6e94 100644
--- a/libgcc/config/i386/morestack.S
+++ b/libgcc/config/i386/morestack.S
@@ -354,7 +354,11 @@ __morestack:
 	# FIXME: The offset must match
 	# TARGET_THREAD_SPLIT_STACK_OFFSET in
 	# gcc/config/i386/linux64.h.
+#ifdef __LP64__
 	movq	%rax,%fs:0x70		# Save the new stack boundary.
+#else
+	movl	%eax,%fs:0x40		# Save the new stack boundary.
+#endif
 
 	call	__morestack_unblock_signals
 
@@ -392,7 +396,11 @@ __morestack:
 	subq	0(%rsp),%rax		# Subtract available space.
 	addq	$BACKOFF,%rax		# Back off 1024 bytes.
 .LEHE0:
+#ifdef __LP64__
 	movq	%rax,%fs:0x70		# Save the new stack boundary.
+#else
+	movl	%eax,%fs:0x40		# Save the new stack boundary.
+#endif
 
 	addq	$16,%rsp		# Remove values from stack.
 
@@ -434,7 +442,11 @@ __morestack:
 	movq	%rbp,%rcx		# Get the stack pointer.
 	subq	%rax,%rcx		# Subtract available space.
 	addq	$BACKOFF,%rcx		# Back off 1024 bytes.
+#ifdef __LP64__
 	movq	%rcx,%fs:0x70		# Save new stack boundary.
+#else
+	movl	%ecx,%fs:0x40		# Save new stack boundary.
+#endif
 	movq	(%rsp),%rdi		# Restore exception data for call.
 #ifdef __PIC__
 	call	_Unwind_Resume@PLT	# Resume unwinding.
@@ -554,7 +566,11 @@ __stack_split_initialize:
 #else /* defined(__x86_64__) */
 
 	leaq	-16000(%rsp),%rax	# We should have at least 16K.
+#ifdef __LP64__
 	movq	%rax,%fs:0x70
+#else
+	movl	%eax,%fs:0x40
+#endif
 	movq	%rsp,%rdi
 	movq	$16000,%rsi
 #ifdef __PIC__



More information about the Gcc-patches mailing list