about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorRafael Ávila de Espíndola <respindola@mozilla.com>2011-05-18 16:15:30 -0400
committerRafael Ávila de Espíndola <respindola@mozilla.com>2011-05-18 16:16:52 -0400
commit843739ee988fc9060d3d55c2b6a8f222c2f728cb (patch)
tree531c6a370630a4f230b60dcc20fb8765897776cf /src
parent13d9f6a2640815aa1fa2a299e0ab364cd292cbfa (diff)
downloadrust-843739ee988fc9060d3d55c2b6a8f222c2f728cb.tar.gz
rust-843739ee988fc9060d3d55c2b6a8f222c2f728cb.zip
A quick hack to get the bots green while I refactor this code.
Diffstat (limited to 'src')
-rw-r--r--src/rt/new_exit.ll36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/rt/new_exit.ll b/src/rt/new_exit.ll
index 07798153ff4..07f52e7759d 100644
--- a/src/rt/new_exit.ll
+++ b/src/rt/new_exit.ll
@@ -1,4 +1,36 @@
-declare fastcc i32 @rust_native_rust_1(i32, i32)
+declare fastcc i32 @"\01rust_native_rust_local_copy"(i32, i32)
+
+module asm "\09.globl rust_native_rust_local_copy"
+module asm "\09.balign 4"
+module asm "rust_native_rust_local_copy:"
+module asm "\09.cfi_startproc"
+module asm "\09pushl %ebp"
+module asm "\09.cfi_def_cfa_offset 8"
+module asm "\09.cfi_offset %ebp, -8"
+module asm "\09pushl %edi"
+module asm "\09.cfi_def_cfa_offset 12"
+module asm "\09pushl %esi"
+module asm "\09.cfi_def_cfa_offset 16"
+module asm "\09pushl %ebx"
+module asm "\09.cfi_def_cfa_offset 20"
+module asm "\09movl  %esp, %ebp     # ebp = rust_sp"
+module asm "\09.cfi_def_cfa_register %ebp"
+module asm "\09movl  %esp, 16(%edx)"
+module asm "\09movl  12(%edx), %esp"
+module asm "\09subl  $4, %esp   # esp -= args"
+module asm "\09andl  $~0xf, %esp    # align esp down"
+module asm "\09movl  %edx, (%esp)"
+module asm "\09movl  %edx, %edi     # save task from edx to edi"
+module asm "\09call  *%ecx          # call *%ecx"
+module asm "\09movl  %edi, %edx     # restore edi-saved task to edx"
+module asm "\09movl  16(%edx), %esp"
+module asm "\09popl  %ebx"
+module asm "\09popl  %esi"
+module asm "\09popl  %edi"
+module asm "\09popl  %ebp"
+module asm "\09ret"
+module asm "\09.cfi_endproc"
+
 
 declare i32 @upcall_exit(i32)
 
@@ -6,6 +38,6 @@ define void @rust_new_exit_task_glue(i32, i32, i32, i32, i32) {
 entry:
   %5 = inttoptr i32 %0 to void (i32, i32, i32, i32)*
   tail call fastcc void %5(i32 %1, i32 %2, i32 %3, i32 %4)
-  %6 = tail call fastcc i32 @rust_native_rust_1(i32 ptrtoint (i32 (i32)* @upcall_exit to i32), i32 %2)
+  %6 = tail call fastcc i32 @"\01rust_native_rust_local_copy"(i32 ptrtoint (i32 (i32)* @upcall_exit to i32), i32 %2)
   ret void
 }