diff --git a/Cargo.lock b/Cargo.lock index 3ee7bf6..67719ec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,3 +1,5 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. [[package]] name = "aho-corasick" version = "0.7.3" diff --git a/src/arch/x86_64/interrupt/irq.rs b/src/arch/x86_64/interrupt/irq.rs index c782f42..429ef02 100644 --- a/src/arch/x86_64/interrupt/irq.rs +++ b/src/arch/x86_64/interrupt/irq.rs @@ -1,4 +1,4 @@ -use core::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; +use core::sync::atomic::{AtomicUsize, Ordering}; use context; use context::timeout; @@ -9,7 +9,7 @@ use scheme::debug::debug_input; use time; //resets to 0 in context::switch() -pub static PIT_TICKS: AtomicUsize = ATOMIC_USIZE_INIT; +pub static PIT_TICKS: AtomicUsize = AtomicUsize::new(0); unsafe fn trigger(irq: u8) { extern { diff --git a/src/arch/x86_64/start.rs b/src/arch/x86_64/start.rs index d3ed63f..89bc9e9 100644 --- a/src/arch/x86_64/start.rs +++ b/src/arch/x86_64/start.rs @@ -4,7 +4,7 @@ /// defined in other files inside of the `arch` module use core::slice; -use core::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; +use core::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use allocator; #[cfg(feature = "acpi")] @@ -31,11 +31,11 @@ static mut TBSS_TEST_ZERO: usize = 0; #[thread_local] static mut TDATA_TEST_NONZERO: usize = 0xFFFF_FFFF_FFFF_FFFF; -pub static KERNEL_BASE: AtomicUsize = ATOMIC_USIZE_INIT; -pub static KERNEL_SIZE: AtomicUsize = ATOMIC_USIZE_INIT; -pub static CPU_COUNT: AtomicUsize = ATOMIC_USIZE_INIT; -pub static AP_READY: AtomicBool = ATOMIC_BOOL_INIT; -static BSP_READY: AtomicBool = ATOMIC_BOOL_INIT; +pub static KERNEL_BASE: AtomicUsize = AtomicUsize::new(0); +pub static KERNEL_SIZE: AtomicUsize = AtomicUsize::new(0); +pub static CPU_COUNT: AtomicUsize = AtomicUsize::new(0); +pub static AP_READY: AtomicBool = AtomicBool::new(false); +static BSP_READY: AtomicBool = AtomicBool::new(false); #[repr(packed)] pub struct KernelArgs { diff --git a/src/context/arch/x86_64.rs b/src/context/arch/x86_64.rs index c286ad3..5458a23 100644 --- a/src/context/arch/x86_64.rs +++ b/src/context/arch/x86_64.rs @@ -1,11 +1,11 @@ use core::mem; -use core::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT}; +use core::sync::atomic::AtomicBool; /// This must be used by the kernel to ensure that context switches are done atomically /// Compare and exchange this to true when beginning a context switch on any CPU /// The `Context::switch_to` function will set it back to false, allowing other CPU's to switch /// This must be done, as no locks can be held on the stack during switch -pub static CONTEXT_SWITCH_LOCK: AtomicBool = ATOMIC_BOOL_INIT; +pub static CONTEXT_SWITCH_LOCK: AtomicBool = AtomicBool::new(false); #[derive(Clone, Debug)] pub struct Context { diff --git a/src/event.rs b/src/event.rs index 2e6cf9a..529562b 100644 --- a/src/event.rs +++ b/src/event.rs @@ -1,6 +1,6 @@ use alloc::sync::Arc; use alloc::collections::BTreeMap; -use core::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; +use core::sync::atomic::{AtomicUsize, Ordering}; use spin::{Once, RwLock, RwLockReadGuard, RwLockWriteGuard}; use context; @@ -65,7 +65,7 @@ impl EventQueue { pub type EventQueueList = BTreeMap>; // Next queue id -static NEXT_QUEUE_ID: AtomicUsize = ATOMIC_USIZE_INIT; +static NEXT_QUEUE_ID: AtomicUsize = AtomicUsize::new(0); /// Get next queue id pub fn next_queue_id() -> EventQueueId { diff --git a/src/lib.rs b/src/lib.rs index e0a9969..7e02d4a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -41,7 +41,7 @@ extern crate spin; extern crate slab_allocator; use alloc::vec::Vec; -use core::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; +use core::sync::atomic::{AtomicUsize, Ordering}; use scheme::{FileHandle, SchemeNamespace}; @@ -113,7 +113,7 @@ static ALLOCATOR: allocator::Allocator = allocator::Allocator; /// A unique number that identifies the current CPU - used for scheduling #[thread_local] -static CPU_ID: AtomicUsize = ATOMIC_USIZE_INIT; +static CPU_ID: AtomicUsize = AtomicUsize::new(0); /// Get the current CPU's scheduling ID #[inline(always)] @@ -122,7 +122,7 @@ pub fn cpu_id() -> usize { } /// The count of all CPUs that can have work scheduled -static CPU_COUNT : AtomicUsize = ATOMIC_USIZE_INIT; +static CPU_COUNT : AtomicUsize = AtomicUsize::new(0); /// Get the number of CPUs currently active #[inline(always)] diff --git a/src/scheme/debug.rs b/src/scheme/debug.rs index be93f99..10392cc 100644 --- a/src/scheme/debug.rs +++ b/src/scheme/debug.rs @@ -1,4 +1,4 @@ -use core::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; +use core::sync::atomic::{AtomicUsize, Ordering}; use spin::{Once, RwLock, RwLockReadGuard, RwLockWriteGuard}; use arch::debug::Writer; @@ -18,7 +18,7 @@ fn init_input() -> WaitQueue { WaitQueue::new() } -static NEXT_ID: AtomicUsize = ATOMIC_USIZE_INIT; +static NEXT_ID: AtomicUsize = AtomicUsize::new(0); static HANDLES: Once>> = Once::new(); diff --git a/src/scheme/pipe.rs b/src/scheme/pipe.rs index 8bb6ae7..17d3aee 100644 --- a/src/scheme/pipe.rs +++ b/src/scheme/pipe.rs @@ -1,6 +1,6 @@ use alloc::sync::{Arc, Weak}; use alloc::collections::{BTreeMap, VecDeque}; -use core::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; +use core::sync::atomic::{AtomicUsize, Ordering}; use spin::{Mutex, Once, RwLock, RwLockReadGuard, RwLockWriteGuard}; use event; @@ -13,7 +13,7 @@ use syscall::data::Stat; /// Pipes list pub static PIPE_SCHEME_ID: AtomicSchemeId = ATOMIC_SCHEMEID_INIT; -static PIPE_NEXT_ID: AtomicUsize = ATOMIC_USIZE_INIT; +static PIPE_NEXT_ID: AtomicUsize = AtomicUsize::new(0); static PIPES: Once>, BTreeMap>)>> = Once::new(); /// Initialize pipes, called if needed