Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
redox-os
kernel
Commits
f042bd5d
Verified
Commit
f042bd5d
authored
Apr 07, 2019
by
Jeremy Soller
Browse files
Update for new rust
parent
ff2ad432
Changes
8
Hide whitespace changes
Inline
Side-by-side
Cargo.lock
View file @
f042bd5d
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "aho-corasick"
version = "0.7.3"
...
...
src/arch/x86_64/interrupt/irq.rs
View file @
f042bd5d
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
=
A
TOMIC_USIZE_INIT
;
pub
static
PIT_TICKS
:
AtomicUsize
=
A
tomicUsize
::
new
(
0
)
;
unsafe
fn
trigger
(
irq
:
u8
)
{
extern
{
...
...
src/arch/x86_64/start.rs
View file @
f042bd5d
...
...
@@ -4,7 +4,7 @@
/// defined in other files inside of the `arch` module
use
core
::
slice
;
use
core
::
sync
::
atomic
::{
AtomicBool
,
A
TOMIC_BOOL_INIT
,
AtomicUsize
,
ATOMIC_USIZE_INIT
,
Ordering
};
use
core
::
sync
::
atomic
::{
AtomicBool
,
A
tomicUsize
,
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
=
A
TOMIC_USIZE_INIT
;
pub
static
KERNEL_SIZE
:
AtomicUsize
=
A
TOMIC_USIZE_INIT
;
pub
static
CPU_COUNT
:
AtomicUsize
=
A
TOMIC_USIZE_INIT
;
pub
static
AP_READY
:
AtomicBool
=
A
TOMIC_BOOL_INIT
;
static
BSP_READY
:
AtomicBool
=
A
TOMIC_BOOL_INIT
;
pub
static
KERNEL_BASE
:
AtomicUsize
=
A
tomicUsize
::
new
(
0
)
;
pub
static
KERNEL_SIZE
:
AtomicUsize
=
A
tomicUsize
::
new
(
0
)
;
pub
static
CPU_COUNT
:
AtomicUsize
=
A
tomicUsize
::
new
(
0
)
;
pub
static
AP_READY
:
AtomicBool
=
A
tomicBool
::
new
(
false
)
;
static
BSP_READY
:
AtomicBool
=
A
tomicBool
::
new
(
false
)
;
#[repr(packed)]
pub
struct
KernelArgs
{
...
...
src/context/arch/x86_64.rs
View file @
f042bd5d
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
=
A
TOMIC_BOOL_INIT
;
pub
static
CONTEXT_SWITCH_LOCK
:
AtomicBool
=
A
tomicBool
::
new
(
false
)
;
#[derive(Clone,
Debug)]
pub
struct
Context
{
...
...
src/event.rs
View file @
f042bd5d
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
<
EventQueueId
,
Arc
<
EventQueue
>>
;
// Next queue id
static
NEXT_QUEUE_ID
:
AtomicUsize
=
A
TOMIC_USIZE_INIT
;
static
NEXT_QUEUE_ID
:
AtomicUsize
=
A
tomicUsize
::
new
(
0
)
;
/// Get next queue id
pub
fn
next_queue_id
()
->
EventQueueId
{
...
...
src/lib.rs
View file @
f042bd5d
...
...
@@ -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
=
A
TOMIC_USIZE_INIT
;
static
CPU_ID
:
AtomicUsize
=
A
tomicUsize
::
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
=
A
TOMIC_USIZE_INIT
;
static
CPU_COUNT
:
AtomicUsize
=
A
tomicUsize
::
new
(
0
)
;
/// Get the number of CPUs currently active
#[inline(always)]
...
...
src/scheme/debug.rs
View file @
f042bd5d
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<u8> {
WaitQueue
::
new
()
}
static
NEXT_ID
:
AtomicUsize
=
A
TOMIC_USIZE_INIT
;
static
NEXT_ID
:
AtomicUsize
=
A
tomicUsize
::
new
(
0
)
;
static
HANDLES
:
Once
<
RwLock
<
BTreeMap
<
usize
,
usize
>>>
=
Once
::
new
();
...
...
src/scheme/pipe.rs
View file @
f042bd5d
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
=
A
TOMIC_USIZE_INIT
;
static
PIPE_NEXT_ID
:
AtomicUsize
=
A
tomicUsize
::
new
(
0
)
;
static
PIPES
:
Once
<
RwLock
<
(
BTreeMap
<
usize
,
Arc
<
PipeRead
>>
,
BTreeMap
<
usize
,
Arc
<
PipeWrite
>>
)
>>
=
Once
::
new
();
/// Initialize pipes, called if needed
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment