Skip to content

Commit 4f5ad03

Browse files
committed
report + documentation
1 parent 304202e commit 4f5ad03

File tree

25 files changed

+58
-1
lines changed

25 files changed

+58
-1
lines changed

docs/report/report.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ toc: true
66
numbersections: true
77
---
88

9+
# Preliminaries
10+
11+
Any reader is strongly encouraged to have the code of the kernel available when reading this report. Rust also provides a **very** well-done documentation tool. The command `make doc` at the root of the repo should build the documentation and open it in the browser. We have put some effort into making a documentation clear and explicit!
12+
913
# Motivation
1014

1115
## Language
@@ -198,4 +202,8 @@ This mode, as well as the file type, is stored inside the header. A directory is
198202

199203
# Reliability
200204

201-
This is sort of the elephant in the room. From the very beginning, we built FerrOS to be a proof of concept of a feature-rich OS that, the code of which remains understandable. In any case we wanted it to be reliable in any way. This means that it should work fine as long as the user follows the guidelines but will panic (i.e. crash on purpose) on multiple occasions. The ustar driver is a great example of that : each step of the ustar pipeline has a lot of data checks that cause the OS to crahs if something invalid gets detected. A real OS would obviously catch this error and returns it to the userprogram, possibly killing it.
205+
This is sort of the elephant in the room. From the very beginning, we built FerrOS to be a proof of concept of a feature-rich OS that, the code of which remains understandable. The goal was not for it to be reliable in any way. This means that it should work fine as long as the user follows the guidelines but will panic (i.e. crash on purpose) on multiple occasions. The ustar driver is a great example of that : each step of the ustar pipeline has a lot of data checks that cause the OS to crahs if something invalid gets detected. A real OS would obviously catch this error and returns it to the userprogram, possibly killing it.
206+
207+
# Conclusion
208+
209+
This project has been a lot of fun and taught us a lot about operating systems, ranging from paging to userspace and standard libraries. Using Rust for this project has been, in our humble opinion, a success, as it enabled us to build some complex structures relatively easily (such as the VFS).

src/allocator/linked_list.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Linked-list logic
2+
13
use super::{align_up, Locked};
24

35
use crate::errorln;

src/allocator/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Heap allocator. This is a clone of the one inside the `librust`
2+
13
//use alloc::alloc::{GlobalAlloc, Layout};
24
use linked_list::LinkedListAllocator;
35
use x86_64::{
@@ -55,6 +57,7 @@ pub fn init(
5557
Ok(())
5658
}
5759

60+
/// Contains locked data
5861
pub struct Locked<A> {
5962
inner: spin::Mutex<A>,
6063
}

src/data_storage/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Contains some custom general-purpose data-structures.
2+
13
pub mod path;
24
pub mod queue;
35
pub mod random;

src/data_storage/path.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Kernelspace representation of paths.
2+
13
use alloc::string::String;
24
use alloc::vec::Vec;
35

src/data_storage/queue.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
//! Here we define a basic bounded queue (fixed size) supporting creation, push and pop
22
3+
/// Maximam size of a queue
34
const MAX_SIZE: usize = 32;
45

56
/// Queue error.

src/data_storage/random.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
//! A very basic pseudo-RNG
2+
3+
/// Initital seed
14
static mut RAND_SEED: u8 = 42_u8;
25

36
/// Returns a pseudo-random `u8`, using a simple and naive algorihm.

src/data_storage/registers.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Data-structures holdign registers states
2+
13
/// Holds the value of a complete set of the `x86-64` GP registers.
24
/// It is used to read from/write into a process' registers during a syscall.
35
#[repr(C)]

src/data_storage/screen.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Abstraction of screen coordinates
2+
13
/// Abstraction for coordinates on the screen. It is only partly useful.
24
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
35
pub struct Coord {

src/filesystem/descriptor/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! All the logic around file descriptors and `OpenFileTable`s
2+
13
use crate::data_storage::path::Path;
24

35
use crate::scheduler::process;

src/filesystem/drivers/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Drivers that can be attached to the `VFS`
2+
13
pub mod clock_driver;
24
pub mod disk_operations;
35
pub mod hardware;

src/filesystem/fifo.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! FIFO used for inter-process communication
2+
13
use super::partition::Partition;
24

35
use crate::data_storage::path::Path;

src/filesystem/fsflags.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Flags
2+
13
#![allow(clippy::upper_case_acronyms)]
24

35
use alloc::collections::BTreeSet;

src/filesystem/host_shell.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! host shell accessed by the serial interface
2+
13
use super::partition::Partition;
24

35
use crate::{data_storage::path::Path, print};

src/filesystem/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! All the logic of the filesystem, ranging from the drivers to the `VFS` pipeline
2+
13
#![allow(dead_code)]
24

35
use crate::data_storage::path::Path;

src/filesystem/partition.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Defines the `Partition` trait, implemented by all drivers and uniting them into a `VFS`!
2+
13
use crate::data_storage::path::Path;
24
use alloc::vec::Vec;
35

src/filesystem/screen_partition.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Give a process access to a screen.
2+
13
use super::partition::Partition;
24
use crate::data_storage::screen::Coord;
35

src/filesystem/test.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! ATA test routines
2+
13
use crate::{print, println};
24
use x86_64::instructions::interrupts::{disable, enable};
35
use x86_64::instructions::port::Port;

src/filesystem/vfs.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Heart of the kernel-user interraction. Defines the logic used by the `VFS`
2+
13
#![allow(clippy::upper_case_acronyms)]
24

35
use alloc::boxed::Box;

src/hardware/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Some basic hardware drivers for use from within the kernel only.
2+
13
pub mod clock;
24
pub mod mouse;
35
pub mod power;

src/keyboard/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Kernel keyboard logic.
2+
13
use crate::println;
24
use conquer_once::spin::OnceCell;
35
use crossbeam_queue::{ArrayQueue, PopError, PushError};

src/programs/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
//! Small kernel-space program examples.
2+
13
pub mod ascii_fluid;
24
pub mod shell;

src/scheduler/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Contains all the logic used to create, manage, switch and kill processes.
2+
13
pub mod process;
24

35
/// Maximum number of co-existing processes.

src/serial.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Serial communication with the host shell. The way the kernel debugs informations.
2+
13
use lazy_static::lazy_static;
24
use spin::Mutex;
35
use uart_16550::SerialPort;

src/sound/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//! Sound driver and logic. Used by the VFS.
2+
13
use lazy_static::lazy_static;
24
use spin::Mutex;
35

0 commit comments

Comments
 (0)