Crate rusty_mos

Source
Expand description

The MOS operation system written in Rust. The origin OS is written in C and is for BUAA OS Course.

This version of MOS is independently completed by kai_Ker.

The C-Version of MOS is developed and continuously improved by the OS course team. I express my sincere gratitude to the teachers and *S.T.A.R.*s who have continuously contributed to the MOS and to out course.

Beyond the origin functions, this version of MOS also has a buddy system allocator and a multi-pages shared memory pool.

The MOS itself has the design concept of microkernel. The fork and the file system are done mainly in the user space. The MOS uses a page-memory management to organize the virtual memories.

Modules§

  • Things related to the architecture. Mipsel here is.
  • Define constants used in the kernel.
  • Kernel library. Only used in kernel mode.
  • Memory management. Including the page-memory model and the TLB related handlers. A global allocator will be provided as well.
  • Envs manegement and the scheduler. Also support the elf_loader tools.
  • Kernel independent utils like link list or bit map.

Macros§

  • Spawn the index of the given envid.
  • Gen a mask from the $h-bit (MSB) to $l-bit (LSB) with 1.
  • Get the virtual address (in kernel segment) from the physical address
  • Get the physical address of the virtual address in kernel segment
  • Get the Page Directory Offset from the virtual address
  • Get the Page Number from the physical address
  • Get the address(or the frame number etc.) from the page table entry (PTE)
  • Get the Page Table Offset from the virtual address
  • Round-up to the specified fractor.
  • Round-down to the specified fractor.
  • Debug Formatted Print: with no new-line at the end. Will perform nothing in release profile.
  • Debug Formatted Print: with a new-line at the end. Will perform nothing in release profile.
  • Get the page object of the phisical address.
  • Get the kernel virtual address of the page object.
  • Get the physical address of the page object.
  • Get the page number through the page object.
  • Formatted Print: with no new-line at the end.
  • Formatted Print: with a new-line at the end.
  • Get the physical address of the given virtual address. This macro will look up the page table to do the transmition.

Statics§

  • Global Buddy Allocator. Can only alloc up to 32 KB at once.