mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
kernel: services: resume correct context after interrupt
We were resuming the wrong context after returning from an interrupt. This resulted in us resuming context 3 more often than not. This now properly banks the current process context prior to the switch. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
405a9227cf
commit
6b729d9ebc
1 changed files with 2 additions and 2 deletions
|
|
@ -328,6 +328,7 @@ impl SystemServices {
|
||||||
ProcessState::Running(x) => ProcessState::Ready(x),
|
ProcessState::Running(x) => ProcessState::Ready(x),
|
||||||
y => panic!("current process was {:?}, not 'Running(_)'", y),
|
y => panic!("current process was {:?}, not 'Running(_)'", y),
|
||||||
};
|
};
|
||||||
|
current.current_context = current.previous_context;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the new process, and ensure that it is in a state where it's fit
|
// Get the new process, and ensure that it is in a state where it's fit
|
||||||
|
|
@ -393,6 +394,7 @@ impl SystemServices {
|
||||||
ProcessState::Setup(_, _, _) => panic!("process hasn't been set up yet"),
|
ProcessState::Setup(_, _, _) => panic!("process hasn't been set up yet"),
|
||||||
};
|
};
|
||||||
process.state = ProcessState::Running(available_threads);
|
process.state = ProcessState::Running(available_threads);
|
||||||
|
process.previous_context = process.current_context;
|
||||||
process.current_context = IRQ_CONTEXT as u8;
|
process.current_context = IRQ_CONTEXT as u8;
|
||||||
process.mapping.activate();
|
process.mapping.activate();
|
||||||
}
|
}
|
||||||
|
|
@ -593,8 +595,6 @@ impl SystemServices {
|
||||||
|
|
||||||
// Restore the previous context, if one exists.
|
// Restore the previous context, if one exists.
|
||||||
process.set_context_nr(new_context);
|
process.set_context_nr(new_context);
|
||||||
self.processes[self.pid as usize - 1].previous_context =
|
|
||||||
self.processes[self.pid as usize - 1].current_context;
|
|
||||||
self.processes[self.pid as usize - 1].current_context = new_context as u8;
|
self.processes[self.pid as usize - 1].current_context = new_context as u8;
|
||||||
let ctx = process.current_context();
|
let ctx = process.current_context();
|
||||||
println!(
|
println!(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue