Skip to content

Commit 6176ec9

Browse files
committed
Clean up imports and add to changelog.
1 parent 30b06d7 commit 6176ec9

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
rather than relying on global symbols.
99
- Added `RegisterStateRef` parameter to exception handlers to access the saved register state, and
1010
removed ELR and SPSR parameters.
11+
- `start_core` now takes an `FnOnce` rather than an `fn` and an argument. This allows arbitrary
12+
context to be captured in the closure.
1113

1214
## 0.3.1
1315

src/lib.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub mod __private {
3131
use core::arch::asm;
3232
#[cfg(not(feature = "initial-pagetable"))]
3333
use core::arch::naked_asm;
34+
use core::mem::ManuallyDrop;
3435
pub use entry::secondary_entry;
3536
#[cfg(feature = "exceptions")]
3637
pub use exceptions::{ExceptionHandlers, RegisterState, RegisterStateRef};
@@ -46,8 +47,6 @@ pub use pagetable::{
4647
InitialPagetable,
4748
};
4849

49-
use core::mem::ManuallyDrop;
50-
5150
#[cfg(not(feature = "initial-pagetable"))]
5251
#[unsafe(naked)]
5352
#[unsafe(link_section = ".init")]
@@ -244,19 +243,19 @@ pub unsafe fn start_core<C: smccc::Call, F: FnOnce() + Send + 'static, const N:
244243
) -> Result<(), smccc::psci::Error> {
245244
const {
246245
assert!(
247-
core::mem::size_of::<StartCoreStack<F>>()
248-
+ 2 * core::mem::size_of::<F>()
249-
+ 2 * core::mem::align_of::<F>()
246+
size_of::<StartCoreStack<F>>()
247+
+ 2 * size_of::<F>()
248+
+ 2 * align_of::<F>()
250249
+ 1024 // trampoline stack frame overhead
251-
<= core::mem::size_of::<Stack<N>>(),
250+
<= size_of::<Stack<N>>(),
252251
"the `rust_entry` closure is too big to fit in the core stack"
253252
);
254253
}
255254

256255
let rust_entry = ManuallyDrop::new(rust_entry);
257256

258257
let stack_start = stack.cast::<u8>();
259-
let align_offfset = stack_start.align_offset(core::mem::align_of::<F>());
258+
let align_offfset = stack_start.align_offset(align_of::<F>());
260259
let entry_ptr = stack_start
261260
.wrapping_add(align_offfset)
262261
.cast::<ManuallyDrop<F>>();

0 commit comments

Comments
 (0)