File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -180,17 +180,19 @@ impl<'p> Core<'p> {
180180 // Set up the stack
181181 let mut stack_ptr = unsafe { stack. as_mut_ptr ( ) . add ( stack. len ( ) ) } ;
182182
183- let mut push = |v : usize | unsafe {
184- stack_ptr = stack_ptr. sub ( 1 ) ;
185- stack_ptr. write ( v) ;
186- } ;
187-
188183 // We don't want to drop this, since it's getting moved to the other core.
189184 let mut entry = ManuallyDrop :: new ( entry) ;
190185
191186 // Push the arguments to `core1_startup` onto the stack.
192- push ( stack. as_mut_ptr ( ) as usize ) ;
193- push ( & mut entry as * mut _ as usize ) ;
187+ unsafe {
188+ // Push `stack_bottom`.
189+ stack_ptr = stack_ptr. sub ( 1 ) ;
190+ stack_ptr. cast :: < * mut usize > ( ) . write ( stack. as_mut_ptr ( ) ) ;
191+
192+ // Push `entry`.
193+ stack_ptr = stack_ptr. sub ( 1 ) ;
194+ stack_ptr. cast :: < & mut ManuallyDrop < F > > ( ) . write ( & mut entry) ;
195+ }
194196
195197 let vector_table = ppb. vtor . read ( ) . bits ( ) ;
196198
You can’t perform that action at this time.
0 commit comments