about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-12-15 14:46:51 -0800
committerBrian Anderson <banderson@mozilla.com>2011-12-16 18:18:43 -0800
commit9d70c1949e4c26cc558525b242714efb3e8eb212 (patch)
tree398552f30e4d88e0a409ebe010d19bd742d513c0 /src
parent23df4de86d8740545891a745f3c2f6c90cf1d1fd (diff)
downloadrust-9d70c1949e4c26cc558525b242714efb3e8eb212.tar.gz
rust-9d70c1949e4c26cc558525b242714efb3e8eb212.zip
rt: Fix alignment of the call to upcall_del_stack in __morestack
Diffstat (limited to 'src')
-rw-r--r--src/rt/arch/i386/morestack.S9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/rt/arch/i386/morestack.S b/src/rt/arch/i386/morestack.S
index 85f1139fbe6..7481ce3afd0 100644
--- a/src/rt/arch/i386/morestack.S
+++ b/src/rt/arch/i386/morestack.S
@@ -64,6 +64,9 @@ MORESTACK:
 	// NB: This can be called with the fastcc convention so we
 	// have to preserve any argument registers we want to use
 
+	// NB: __morestack is called misaligned by 4 bytes, i.e.
+	// subl $4, %esp would get us to a normal alignment
+
 	// FIXME (1226): main is compiled with the split-stack prologue,
 	// causing it to call __morestack, so we have to jump back out
 	subl $28,%esp
@@ -120,7 +123,9 @@ MORESTACK:
 	// Switch back to the rust stack
 	movl %ebp, %esp
 
-	subl $8, %esp // Alignment
+	// Remember that __morestack is called misaligned so %ebp
+	// is not aligned to a 16-byte boundary, these 4 bytes realign.
+	subl $4, %esp
 
 	// Now that we're on the return path we want to avoid
 	// stomping on %eax. FIXME: Need to save and restore
@@ -137,7 +142,7 @@ MORESTACK:
 	pushl $0
 	call UPCALL_CALL_C
 
-	addl $16,%esp
+	addl $12,%esp
 
 	popl %ebp
 #if defined(__linux__) || defined(__APPLE__)