Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[closes #265] Intrusive doubly linked list #289

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4dcb43f
Fix: procdump mis-printing & magic number process name length to para…
coolofficials Nov 21, 2020
91a7381
refactor Console
coolofficials Nov 21, 2020
779ac15
name changed
coolofficials Nov 21, 2020
9108c3a
clear ownership of uart
coolofficials Nov 21, 2020
239f597
variable name changed
coolofficials Nov 21, 2020
480b020
specify unsafe block
coolofficials Nov 21, 2020
f0ac9d7
comment fixed
coolofficials Nov 21, 2020
53930a9
specify unsafe block
coolofficials Nov 21, 2020
38f7f15
new line on pattern matching
coolofficials Nov 21, 2020
fa1dd1c
name changed
coolofficials Nov 21, 2020
8d9363e
comment fixed
coolofficials Nov 21, 2020
c02ce31
Commentation for console/terminal/printer/uart.
coolofficials Nov 22, 2020
69fa134
fmt & comment style changed.
coolofficials Nov 22, 2020
72f2a0d
Make comment detailed
coolofficials Nov 22, 2020
38b6dde
commentation grammar fixed
coolofficials Nov 22, 2020
46cacaa
Add more comments.
coolofficials Nov 22, 2020
991ac04
Method name changed to reveal ownership clear
coolofficials Nov 22, 2020
a98abe9
[Fix Error in previous commit]Method name changed to reveal ownership…
coolofficials Nov 22, 2020
5009196
Fix error from previous commit
coolofficials Nov 22, 2020
92d1db3
Minor comment fix to clarify meaning.
coolofficials Nov 23, 2020
e4dfdd5
Grammar fixed
coolofficials Nov 23, 2020
0361330
addressed review for proc.rs
coolofficials Nov 23, 2020
b2c26c4
Printer to ZST
coolofficials Nov 23, 2020
2451fed
ownership modified
coolofficials Nov 23, 2020
427eed5
comment fixed
coolofficials Nov 23, 2020
aa240f8
initialize doubly circular intrusive linked list
coolofficials Nov 23, 2020
497ad55
add memoffset crate for offset_of! macro
coolofficials Nov 23, 2020
1ebc4b8
comment for bug-fix
coolofficials Nov 23, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions kernel-rs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions kernel-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ scopeguard = { version = "1.1.0", default-features = false }
arrayvec = { version = "0.5.2", default-features = false }
cstr_core = { version = "0.2.2", default-features = false }
spin = { version = "0.7.0", default-features = false }
memoffset = "0.6.1"
array-const-fn-init = "0.1.1"

# Compiler options for sysroot packages.
Expand Down
31 changes: 7 additions & 24 deletions kernel-rs/src/arena.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use crate::spinlock::{Spinlock, SpinlockGuard};
use crate::{
ds::list::*,
spinlock::{Spinlock, SpinlockGuard},
};
use core::marker::PhantomData;
use core::mem::{self, ManuallyDrop};
use core::ops::Deref;
Expand Down Expand Up @@ -64,11 +67,6 @@ pub struct ArrayPtr<T> {
_marker: PhantomData<T>,
}

pub struct ListEntry {
prev: *mut Self,
next: *mut Self,
}

#[repr(C)]
pub struct MruEntry<T> {
list_entry: ListEntry,
Expand Down Expand Up @@ -228,15 +226,6 @@ impl<T: 'static + ArenaObject, const CAPACITY: usize> Arena for Spinlock<ArrayAr
}
}

impl ListEntry {
pub const fn new() -> Self {
Self {
prev: ptr::null_mut(),
next: ptr::null_mut(),
}
}
}

impl<T> MruEntry<T> {
pub const fn new(data: T) -> Self {
Self {
Expand All @@ -256,17 +245,11 @@ impl<T, const CAPACITY: usize> MruArena<T, CAPACITY> {
}
}

pub fn init(&mut self) {
self.head.prev = &mut self.head;
self.head.next = &mut self.head;
pub unsafe fn init(&mut self) {
list_init(&mut self.head);

for entry in &mut self.entries {
entry.list_entry.next = self.head.next;
entry.list_entry.prev = &mut self.head;
unsafe {
(*self.head.next).prev = &mut entry.list_entry;
}
self.head.next = &mut entry.list_entry;
list_prepend(&mut self.head, &mut entry.list_entry);
}
}
}
Expand Down
Loading