mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-27 19:33:23 +00:00
refactor process implementation
This commit is contained in:
@ -38,6 +38,21 @@ pub struct CpuContext {
|
||||
/// trap information, this field is all zero when it is syscall
|
||||
pub trap_information: TrapInformation,
|
||||
}
|
||||
|
||||
impl CpuContext {
|
||||
pub fn set_rax(&mut self, rax: u64) {
|
||||
self.gp_regs.rax = rax;
|
||||
}
|
||||
|
||||
pub fn set_rsp(&mut self, rsp: u64) {
|
||||
self.gp_regs.rsp = rsp;
|
||||
}
|
||||
|
||||
pub fn set_rip(&mut self, rip: u64) {
|
||||
self.gp_regs.rip = rip;
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Copy, Debug)]
|
||||
#[repr(C)]
|
||||
pub struct TrapInformation {
|
||||
|
@ -1,6 +1,5 @@
|
||||
use super::{page_table::PageTable, *};
|
||||
use crate::prelude::*;
|
||||
use crate::vm::VmIo;
|
||||
use crate::{
|
||||
config::PAGE_SIZE,
|
||||
mm::address::is_aligned,
|
||||
|
@ -5,7 +5,8 @@ mod scheduler;
|
||||
#[allow(clippy::module_inception)]
|
||||
mod task;
|
||||
|
||||
pub(crate) use self::processor::{get_idle_task_cx_ptr, schedule};
|
||||
pub(crate) use self::processor::get_idle_task_cx_ptr;
|
||||
pub use self::processor::schedule;
|
||||
pub use self::scheduler::{set_scheduler, Scheduler};
|
||||
pub(crate) use self::task::context_switch;
|
||||
pub(crate) use self::task::TaskContext;
|
||||
|
@ -222,7 +222,7 @@ impl Task {
|
||||
Ok(Arc::new(result))
|
||||
}
|
||||
|
||||
pub fn send_to_scheduler(self: &Arc<Self>) {
|
||||
pub fn run(self: &Arc<Self>) {
|
||||
switch_to_task(self.clone());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user