mirror of
https://github.com/italicsjenga/rp-hal-boards.git
synced 2025-01-23 09:46:33 +11:00
Write core 1 arguments directly to RAM without casting to usize
This commit is contained in:
parent
0e5fdcfd9c
commit
9848f849bd
1 changed files with 9 additions and 7 deletions
|
@ -180,17 +180,19 @@ impl<'p> Core<'p> {
|
||||||
// Set up the stack
|
// Set up the stack
|
||||||
let mut stack_ptr = unsafe { stack.as_mut_ptr().add(stack.len()) };
|
let mut stack_ptr = unsafe { stack.as_mut_ptr().add(stack.len()) };
|
||||||
|
|
||||||
let mut push = |v: usize| unsafe {
|
|
||||||
stack_ptr = stack_ptr.sub(1);
|
|
||||||
stack_ptr.write(v);
|
|
||||||
};
|
|
||||||
|
|
||||||
// We don't want to drop this, since it's getting moved to the other core.
|
// We don't want to drop this, since it's getting moved to the other core.
|
||||||
let mut entry = ManuallyDrop::new(entry);
|
let mut entry = ManuallyDrop::new(entry);
|
||||||
|
|
||||||
// Push the arguments to `core1_startup` onto the stack.
|
// Push the arguments to `core1_startup` onto the stack.
|
||||||
push(stack.as_mut_ptr() as usize);
|
unsafe {
|
||||||
push(&mut entry as *mut _ as usize);
|
// Push `stack_bottom`.
|
||||||
|
stack_ptr = stack_ptr.sub(1);
|
||||||
|
stack_ptr.cast::<*mut usize>().write(stack.as_mut_ptr());
|
||||||
|
|
||||||
|
// Push `entry`.
|
||||||
|
stack_ptr = stack_ptr.sub(1);
|
||||||
|
stack_ptr.cast::<&mut ManuallyDrop<F>>().write(&mut entry);
|
||||||
|
}
|
||||||
|
|
||||||
let vector_table = ppb.vtor.read().bits();
|
let vector_table = ppb.vtor.read().bits();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue