Skip to content

Commit 28d59f8

Browse files
committed
actually fix bugs.
1 parent 04b7156 commit 28d59f8

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

machine/arm/src/sched.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ pub struct ArmStack {
6060
/// The top of the stack (highest address).
6161
/// Safety: NonNull<u32> can safely be covariant over u32.
6262
top: NonNull<u32>,
63-
/// The current offset from the top of the stack (in 4 byte steps).
63+
/// The current offset from the top of the stack
6464
sp: StackPtr,
65-
/// The size of the stack (in 4 byte steps).
65+
/// The size of the stack
6666
size: NonZero<usize>,
6767
}
6868

@@ -161,15 +161,10 @@ impl ArmStack {
161161
Self::push(&mut write_index, EXEC_RETURN_THREAD_PSP);
162162

163163
// R12 (dummy), R11 - R10
164-
for _ in 0..3 {
164+
for _ in 0..4 {
165165
Self::push(&mut write_index, 0);
166166
}
167167

168-
// R9, fixed
169-
let r9: u32;
170-
core::arch::asm!("mov {}, r9", out(reg) r9);
171-
Self::push(&mut write_index, r9);
172-
173168
// R8 - R4
174169
for _ in 0..5 {
175170
Self::push(&mut write_index, 0);
@@ -224,7 +219,7 @@ impl hal_api::stack::Stacklike for ArmStack {
224219
Err(hal_api::Error::OutOfBoundsPtr(
225220
ptr as usize,
226221
Range {
227-
start: self.top.as_ptr() as usize - self.size.get() * size_of::<u32>(),
222+
start: self.top.as_ptr() as usize - self.size.get(),
228223
end: self.top.as_ptr() as usize,
229224
},
230225
))

0 commit comments

Comments
 (0)