Crate os

source · [−]
Expand description

The main module and entrypoint

Various facilities of the kernels are implemented as submodules. The most important ones are:

  • trap: Handles all cases of switching from userspace to the kernel
  • task: Task management
  • syscall: System call handling and implementation
  • mm: Address map using SV39
  • sync: Wrap a static data structure inside it so that we are able to access it without any unsafe.
  • fs: Separate user from file system with some structures

The operating system also starts in this module. Kernel code starts executing from entry.asm, after which rust_main() is called to initialize various pieces of functionality. (See its source code for details.)

We then call task::run_tasks() and for the first time go to userspace.

Modules

board 🔒
config 🔒

Constants in the kernel

console 🔒
drivers 🔒

block/bus/chardev/gpu/input/plic device driver

fs 🔒

File trait & inode(dir, file, pipe, stdin, stdout)

lang_items 🔒

The panic handler and backtrace

Global logger

mm 🔒

Memory management implementation

net 🔒
sbi 🔒

SBI call wrappers

sync 🔒

Synchronization and interior mutability primitives

syscall 🔒

Implementation of syscalls

task 🔒

Implementation of process management mechanism

timer 🔒

RISC-V timer-related functionality

trap 🔒

Trap handling functionality

Macros

Print! to the host console using the format string and arguments.

Println! to the host console using the format string and arguments.

Structs

The global variable to control the non-blocking access of devices

Functions

clear_bss 🔒

the rust entry-point of os