Skip to content

Commit

Permalink
add restart part
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhiyuanSue committed Dec 11, 2024
1 parent ac9f519 commit 96a47a8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
4 changes: 3 additions & 1 deletion kernel/src/syscall/invocation/invoke_tcb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ pub fn invoke_tcb_write_registers(

if resumeTarget != 0 {
// cancel_ipc(dest);
dest.cancel_ipc();
if dest.is_stopped(){
dest.cancel_ipc();
}
dest.restart();
}
if dest.is_current() {
Expand Down
16 changes: 11 additions & 5 deletions sel4_task/src/tcb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ use sel4_vspace::{
setCurrentUserVSpaceRoot, ttbr_new,
};
use sel4_vspace::{pptr_t, set_vm_root};

#[cfg(feature="KERNEL_MCS")]
use crate::ksCurSC;
use crate::prio_t;
use crate::tcb_queue::tcb_queue_t;
use sel4_common::sel4_config::*;
Expand Down Expand Up @@ -539,10 +540,15 @@ impl tcb_t {
if self.is_stopped() {
#[cfg(feature = "KERNEL_MCS")]
{
// TODO: MCS
// #ifdef CONFIG_KERNEL_MCS
// reply_remove_tcb(tptr);
// #else
// MCS
set_thread_state(self, ThreadState::ThreadStateRestart);
if convert_to_mut_type_ref::<sched_context_t>(self.tcbSchedContext).sc_sporadic() && self.tcbSchedContext != unsafe{ksCurSC}{
convert_to_mut_type_ref::<sched_context_t>(self.tcbSchedContext).refill_unblock_check();
}
convert_to_mut_type_ref::<sched_context_t>(self.tcbSchedContext).schedContext_resume();
if self.is_schedulable(){
possible_switch_to(self);
}
}
#[cfg(not(feature = "KERNEL_MCS"))]
{
Expand Down

0 comments on commit 96a47a8

Please sign in to comment.