changeset 641:d9927f20758b

Fiber support: clobber the registers we want restored on a context switch.
author Christian Kamm <kamm incasoftware de>
date Fri, 03 Oct 2008 09:11:41 +0200
parents c2a342b5d8e5
children 307ae566885f
files runtime/llvmdc.diff
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/llvmdc.diff	Fri Oct 03 00:42:17 2008 +0200
+++ b/runtime/llvmdc.diff	Fri Oct 03 09:11:41 2008 +0200
@@ -121,7 +121,7 @@
  ////////////////////////////////////////////////////////////////////////////////
  // Fiber Entry Point and Context Switch
  ////////////////////////////////////////////////////////////////////////////////
-@@ -2450,6 +2484,17 @@
+@@ -2450,6 +2484,22 @@
                  ret;
              }
          }
@@ -129,6 +129,11 @@
 +        {
 +            asm
 +            {
++                // clobber registers to save
++                inc EBX;
++                inc ESI;
++                inc EDI;
++
 +                // store oldp again with more accurate address
 +                mov EAX, oldp;
 +                mov [EAX], ESP;
@@ -139,16 +144,19 @@
          else static if( is( ucontext_t ) )
          {
              Fiber   cfib = Fiber.getThis();
-@@ -3115,6 +3160,13 @@
+@@ -3115,6 +3165,16 @@
              push( 0x00000000 );                                     // ESI
              push( 0x00000000 );                                     // EDI
          }
 +        else version( LLVM_AsmX86_Posix )
 +        {
 +            push( cast(size_t) &fiber_entryPoint );                 // EIP
-+            push( 0x00000000 );                                     // EBP
 +            push( 0x00000000 );                                     // newp
 +            push( 0x00000000 );                                     // oldp
++            push( 0x00000000 );                                     // EBP
++            push( 0x00000000 );                                     // EBX
++            push( 0x00000000 );                                     // ESI
++            push( 0x00000000 );                                     // EDI
 +        }
          else version( AsmPPC_Posix )
          {