From 46ee790ed7447f68fc985f50d188005bcf2d53d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Fita?= <4925040+michalfita@users.noreply.github.com> Date: Thu, 24 Mar 2022 22:09:55 +0000 Subject: [PATCH] [Closes #107] Wrap `SpinLock` in `Arc<>` --- kernel/process/process.rs | 8 ++++---- runtime/lib.rs | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/kernel/process/process.rs b/kernel/process/process.rs index faf56bef..1e89b1d4 100644 --- a/kernel/process/process.rs +++ b/kernel/process/process.rs @@ -117,7 +117,7 @@ pub struct Process { vm: AtomicRefCell>>>, opened_files: SpinLock, root_fs: Arc>, - signals: SpinLock, + signals: Arc>, signaled_frame: AtomicCell>, sigset: SpinLock, } @@ -141,7 +141,7 @@ impl Process { pid: PId::new(0), root_fs: INITIAL_ROOT_FS.clone(), opened_files: SpinLock::new(OpenedFileTable::new()), - signals: SpinLock::new(SignalDelivery::new()), + signals: Arc::new(SpinLock::new(SignalDelivery::new())), signaled_frame: AtomicCell::new(None), sigset: SpinLock::new(SigSet::ZERO), }); @@ -202,7 +202,7 @@ impl Process { vm: AtomicRefCell::new(Some(Arc::new(SpinLock::new(entry.vm)))), opened_files: SpinLock::new(opened_files), root_fs, - signals: SpinLock::new(SignalDelivery::new()), + signals: Arc::new(SpinLock::new(SignalDelivery::new())), signaled_frame: AtomicCell::new(None), sigset: SpinLock::new(SigSet::ZERO), }); @@ -515,7 +515,7 @@ impl Process { opened_files: SpinLock::new(opened_files), root_fs: parent.root_fs().clone(), arch, - signals: SpinLock::new(SignalDelivery::new()), + signals: Arc::new(SpinLock::new(SignalDelivery::new())), // TODO: #88 has to address this signaled_frame: AtomicCell::new(None), sigset: SpinLock::new(*sig_set), }); diff --git a/runtime/lib.rs b/runtime/lib.rs index e3db0e59..3d4d9b5c 100644 --- a/runtime/lib.rs +++ b/runtime/lib.rs @@ -24,6 +24,7 @@ pub mod spinlock; mod x64; pub mod arch { + #[cfg(target_arch = "x86_64")] pub use super::x64::{ enable_irq, halt, idle, read_clock_counter, semihosting_halt, x64_specific, Backtrace, PageFaultReason, PageTable, PtRegs, SavedInterruptStatus, SemihostingExitStatus, @@ -88,7 +89,7 @@ impl Handler for NopHandler { _a5: usize, _a6: usize, _n: usize, - _frame: *mut x64::PtRegs, + _frame: *mut arch::PtRegs, ) -> isize { 0 }