From b39e56b9c4dc032100f8ea5cea0e31a2a972660d Mon Sep 17 00:00:00 2001 From: Quentin Legot Date: Wed, 1 Mar 2023 17:01:02 +0100 Subject: [PATCH] Move system to the right location --- src/kernel/mod.rs | 3 ++- src/kernel/scheduler.rs | 2 +- src/{utility => kernel}/system.rs | 3 +-- src/kernel/thread.rs | 4 ++-- src/utility/mod.rs | 3 +-- 5 files changed, 7 insertions(+), 8 deletions(-) rename src/{utility => kernel}/system.rs (88%) diff --git a/src/kernel/mod.rs b/src/kernel/mod.rs index 135f0a3..bbd9f52 100644 --- a/src/kernel/mod.rs +++ b/src/kernel/mod.rs @@ -1,4 +1,5 @@ mod process; pub mod thread; pub mod scheduler; -pub mod mgerror; \ No newline at end of file +pub mod mgerror; +pub mod system; \ No newline at end of file diff --git a/src/kernel/scheduler.rs b/src/kernel/scheduler.rs index 0e71684..3500f65 100644 --- a/src/kernel/scheduler.rs +++ b/src/kernel/scheduler.rs @@ -2,8 +2,8 @@ use std::sync::Arc; use crate::utility::list::List; use crate::kernel::thread::Thread; -use crate::utility::system::{G_CURRENT_THREAD, G_THREAD_TO_BE_DESTROYED}; +use super::system::{G_CURRENT_THREAD, G_THREAD_TO_BE_DESTROYED}; pub struct Scheduler { ready_list: List> diff --git a/src/utility/system.rs b/src/kernel/system.rs similarity index 88% rename from src/utility/system.rs rename to src/kernel/system.rs index 08dc9bf..5f04b2c 100644 --- a/src/utility/system.rs +++ b/src/kernel/system.rs @@ -2,9 +2,8 @@ use std::{sync::{RwLock, Arc}}; use lazy_static::lazy_static; -use crate::kernel::{thread::Thread, scheduler::Scheduler}; +use crate::{kernel::{thread::Thread, scheduler::Scheduler}, utility::list::List}; -use super::list::List; extern crate lazy_static; lazy_static! { diff --git a/src/kernel/thread.rs b/src/kernel/thread.rs index 7f109df..12d9db4 100644 --- a/src/kernel/thread.rs +++ b/src/kernel/thread.rs @@ -1,7 +1,7 @@ use std::sync::Arc; -use super::{process::Process, mgerror::ErrorCode}; -use crate::{simulator::machine::{NUM_INT_REGS, NUM_FP_REGS, STACK_REG}, utility::system::{ObjectType, G_ALIVE, G_SCHEDULER}, kernel::scheduler}; +use super::{process::Process, mgerror::ErrorCode, system::{ObjectType, G_ALIVE, G_SCHEDULER}}; +use crate::{simulator::machine::{NUM_INT_REGS, NUM_FP_REGS, STACK_REG}}; const SIMULATORSTACKSIZE: usize = 32 * 1024; diff --git a/src/utility/mod.rs b/src/utility/mod.rs index 4b92101..651aed7 100644 --- a/src/utility/mod.rs +++ b/src/utility/mod.rs @@ -1,2 +1 @@ -pub mod list; -pub mod system; \ No newline at end of file +pub mod list; \ No newline at end of file