@@ -13,6 +13,8 @@ use std::uint;
13
13
use std:: mem:: transmute;
14
14
use std:: rt:: stack;
15
15
use std:: raw;
16
+ #[ cfg( target_arch = "x86_64" ) ]
17
+ use std:: simd;
16
18
17
19
// FIXME #7761: Registers is boxed so that it is 16-byte aligned, for storing
18
20
// SSE regs. It would be marginally better not to do this. In C++ we
@@ -103,11 +105,11 @@ impl Context {
103
105
// invalid for the current task. Lucky for us `rust_swap_registers`
104
106
// is a C function so we don't have to worry about that!
105
107
match in_context. stack_bounds {
106
- Some ( ( lo, hi) ) => stack:: record_stack_bounds ( lo, hi) ,
108
+ Some ( ( lo, hi) ) => stack:: record_rust_managed_stack_bounds ( lo, hi) ,
107
109
// If we're going back to one of the original contexts or
108
110
// something that's possibly not a "normal task", then reset
109
111
// the stack limit to 0 to make morestack never fail
110
- None => stack:: record_stack_bounds ( 0 , uint:: MAX ) ,
112
+ None => stack:: record_rust_managed_stack_bounds ( 0 , uint:: MAX ) ,
111
113
}
112
114
rust_swap_registers ( out_regs, in_regs)
113
115
}
@@ -186,14 +188,30 @@ fn initialize_call_frame(regs: &mut Registers, fptr: InitFn, arg: uint,
186
188
// windows requires saving more registers (both general and XMM), so the windows
187
189
// register context must be larger.
188
190
#[ cfg( windows, target_arch = "x86_64" ) ]
189
- type Registers = [ uint , ..34 ] ;
191
+ struct Registers {
192
+ gpr : [ uint , ..14 ] ,
193
+ _xmm : [ simd:: u32x4 , ..10 ]
194
+ }
190
195
#[ cfg( not( windows) , target_arch = "x86_64" ) ]
191
- type Registers = [ uint , ..22 ] ;
196
+ struct Registers {
197
+ gpr : [ uint , ..10 ] ,
198
+ _xmm : [ simd:: u32x4 , ..6 ]
199
+ }
192
200
193
201
#[ cfg( windows, target_arch = "x86_64" ) ]
194
- fn new_regs ( ) -> Box < Registers > { box ( ) ( [ 0 , .. 34 ] ) }
202
+ fn new_regs ( ) -> Box < Registers > {
203
+ box ( ) Registers {
204
+ gpr : [ 0 , ..14 ] ,
205
+ _xmm : [ simd:: u32x4 ( 0 , 0 , 0 , 0 ) , ..10 ]
206
+ }
207
+ }
195
208
#[ cfg( not( windows) , target_arch = "x86_64" ) ]
196
- fn new_regs ( ) -> Box < Registers > { box ( ) ( [ 0 , .. 22 ] ) }
209
+ fn new_regs ( ) -> Box < Registers > {
210
+ box ( ) Registers {
211
+ gpr : [ 0 , ..10 ] ,
212
+ _xmm : [ simd:: u32x4 ( 0 , 0 , 0 , 0 ) , ..6 ]
213
+ }
214
+ }
197
215
198
216
#[ cfg( target_arch = "x86_64" ) ]
199
217
fn initialize_call_frame ( regs : & mut Registers , fptr : InitFn , arg : uint ,
@@ -222,20 +240,20 @@ fn initialize_call_frame(regs: &mut Registers, fptr: InitFn, arg: uint,
222
240
223
241
// These registers are frobbed by rust_bootstrap_green_task into the right
224
242
// location so we can invoke the "real init function", `fptr`.
225
- regs[ RUSTRT_R12 ] = arg as uint ;
226
- regs[ RUSTRT_R13 ] = procedure. code as uint ;
227
- regs[ RUSTRT_R14 ] = procedure. env as uint ;
228
- regs[ RUSTRT_R15 ] = fptr as uint ;
243
+ regs. gpr [ RUSTRT_R12 ] = arg as uint ;
244
+ regs. gpr [ RUSTRT_R13 ] = procedure. code as uint ;
245
+ regs. gpr [ RUSTRT_R14 ] = procedure. env as uint ;
246
+ regs. gpr [ RUSTRT_R15 ] = fptr as uint ;
229
247
230
248
// These registers are picked up by the regular context switch paths. These
231
249
// will put us in "mostly the right context" except for frobbing all the
232
250
// arguments to the right place. We have the small trampoline code inside of
233
251
// rust_bootstrap_green_task to do that.
234
- regs[ RUSTRT_RSP ] = sp as uint ;
235
- regs[ RUSTRT_IP ] = rust_bootstrap_green_task as uint ;
252
+ regs. gpr [ RUSTRT_RSP ] = sp as uint ;
253
+ regs. gpr [ RUSTRT_IP ] = rust_bootstrap_green_task as uint ;
236
254
237
255
// Last base pointer on the stack should be 0
238
- regs[ RUSTRT_RBP ] = 0 ;
256
+ regs. gpr [ RUSTRT_RBP ] = 0 ;
239
257
}
240
258
241
259
#[ cfg( target_arch = "arm" ) ]
0 commit comments