Mercurial > projects > ldc
comparison runtime/llvmdc.diff @ 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 |
comparison
equal
deleted
inserted
replaced
640:c2a342b5d8e5 | 641:d9927f20758b |
---|---|
119 - | 119 - |
120 +extern(C) int printf(char*, ...); | 120 +extern(C) int printf(char*, ...); |
121 //////////////////////////////////////////////////////////////////////////////// | 121 //////////////////////////////////////////////////////////////////////////////// |
122 // Fiber Entry Point and Context Switch | 122 // Fiber Entry Point and Context Switch |
123 //////////////////////////////////////////////////////////////////////////////// | 123 //////////////////////////////////////////////////////////////////////////////// |
124 @@ -2450,6 +2484,17 @@ | 124 @@ -2450,6 +2484,22 @@ |
125 ret; | 125 ret; |
126 } | 126 } |
127 } | 127 } |
128 + else version( LLVM_AsmX86_Posix ) | 128 + else version( LLVM_AsmX86_Posix ) |
129 + { | 129 + { |
130 + asm | 130 + asm |
131 + { | 131 + { |
132 + // clobber registers to save | |
133 + inc EBX; | |
134 + inc ESI; | |
135 + inc EDI; | |
136 + | |
132 + // store oldp again with more accurate address | 137 + // store oldp again with more accurate address |
133 + mov EAX, oldp; | 138 + mov EAX, oldp; |
134 + mov [EAX], ESP; | 139 + mov [EAX], ESP; |
135 + // load newp to begin context switch | 140 + // load newp to begin context switch |
136 + mov ESP, newp; | 141 + mov ESP, newp; |
137 + } | 142 + } |
138 + } | 143 + } |
139 else static if( is( ucontext_t ) ) | 144 else static if( is( ucontext_t ) ) |
140 { | 145 { |
141 Fiber cfib = Fiber.getThis(); | 146 Fiber cfib = Fiber.getThis(); |
142 @@ -3115,6 +3160,13 @@ | 147 @@ -3115,6 +3165,16 @@ |
143 push( 0x00000000 ); // ESI | 148 push( 0x00000000 ); // ESI |
144 push( 0x00000000 ); // EDI | 149 push( 0x00000000 ); // EDI |
145 } | 150 } |
146 + else version( LLVM_AsmX86_Posix ) | 151 + else version( LLVM_AsmX86_Posix ) |
147 + { | 152 + { |
148 + push( cast(size_t) &fiber_entryPoint ); // EIP | 153 + push( cast(size_t) &fiber_entryPoint ); // EIP |
149 + push( 0x00000000 ); // EBP | |
150 + push( 0x00000000 ); // newp | 154 + push( 0x00000000 ); // newp |
151 + push( 0x00000000 ); // oldp | 155 + push( 0x00000000 ); // oldp |
156 + push( 0x00000000 ); // EBP | |
157 + push( 0x00000000 ); // EBX | |
158 + push( 0x00000000 ); // ESI | |
159 + push( 0x00000000 ); // EDI | |
152 + } | 160 + } |
153 else version( AsmPPC_Posix ) | 161 else version( AsmPPC_Posix ) |
154 { | 162 { |
155 version( StackGrowsDown ) | 163 version( StackGrowsDown ) |
156 Index: lib/unittest.sh | 164 Index: lib/unittest.sh |