This is a small hobby OS to play around with stuff I have never done before... it's not intended to be functional, useful, secure, or reliable. It is meant to be approximately fun to implement.
If you want to see the latest things I am up to, check out the dev branch on
this repo. Generally, master should compile and run.
Start on librs (the equivalent of libc for this project).
user/src/main.rs as an example userspace program.cargo xbuild --target target.jsonPaging
memory::paging::map_regionZero-copy message passing for IPC. To send a message,
I am toying with the idea of not having processes at all, just DAGs of continuations which may or may not choose to pass on their capabilities.
Currently its a little over 1500 LOC (not including comments + whitespace + dependencies). Not bad!
The kernel itself is continuation-based, rather than using something like kthreads. In the first pass, I am just making things work. Later, I might go back and make it efficient.
No timer-based preemption in kernelspace or userspace (though timer
interrupts do occur so that timers can work). No locks, no multi-threading in
userspace. Every process is single-threaded and continuation-based. Each
Continuation can return a set of additional continuations to be run in any
order, an error, or nothing. Continuations can also wait for events, such as
I/O or another process's termination.
Single address space. Everything lives in the same address space. Page table entry bits are used to disable certain portions of the address space for some continuations.
Small kernel heap for dynamic memory allocation.
Buddy allocator for physical frame allocation.
Buddy allocator for virtual address space regions.
Simple capability system for managing access to resources in the system, such as memory regions.
Switching to usermode and back.
System calls via syscall and sysret instructions.
Loading a position-independent ELF binary as a user-mode task, running it, and exiting via a syscall.
Now that I have a mostly functioning basic kernel, I can start playing around with stuff!
rust, nightly
rustc 1.45.0-nightly (99cb9ccb9 2020-05-11)llvm-tools-preview rust distribution component via rustup component add llvm-tools-preview
cargo xbuild and cargo bootimage via cargo install cargo-xbuild bootimage
build-essentials and standard utils: gcc, make, ld, objcopy, dd
qemu to run
To build and run
$ cd os2/user
$ cargo xbuild --target x86_64-unknown-elf.json --release
$ cd ../kernel
$ bootimage runbootimage can optionally be passed --release for optimized builds.