d600be874c
Fix TSS Also change to .{} syntax where appropriate. Added the SS segment Fixed spelling Refactoring GDT Multitasking working for now WIP scheduler Refactored Bitmap a bit WIP still Task switching working Handlers return the stack pointer that will be used to restore the tasks stack, normal handlers will return the same stack pointer it was called with where task switching will return the stack pointer of the next task and restore its state using the interrupt stub. Initial scheduler done Created a stage 2 init task Change u32 to usize Move Task to arch specific WIP WIP2 Removed esp from task, replaced with stack_pointer Removed the debug logs Fixed init task stack Change pickNextTask to pointer manipulation This allows less allocations so faster switching Temporary enable interrupts for some runtime tests PIT and RTC need interrupts enabled to run their runtime tests Renamed schedule => pickNextTask, comptime bitmap for pids not task init And some other stuff: No pub for the task anymore Use the leak detector allocator Fmt Fix unit tests And some other stuff :P PR review Moved Task out of arch and have the stack init in the arch file Mocking clean up Removed commented code Renamed createTask to scheduleTask where the user will have to provide a task to schedule Removed redundant pub in log runtime test Removed global allocator for scheduler Cleaner assembly in paging Fmt Added new Scheduler test mode Added new test mode to CI Removed one of the prints Added doc comment, task test for i386 Removed test WIP Runtime tests work Have a global set in one task and reacted to in another. Also test that local variables are preserved after a task switch. Removed new lines Increased line length Move the allocation of the bool above the task creation |
||
---|---|---|
.github/workflows | ||
grub | ||
src | ||
test | ||
.gitignore | ||
build.zig | ||
hello.jpg | ||
makeiso.sh | ||
README.md |
Pluto
Pluto is a kernel written almost entirely in Zig and supports x86, with aarch64 and x64 backends being planned.
Goals
- Should be written in Zig as much as possible. Assembly should only be used where required for functionality or performance reasons.
- Light and performant. The kernel should be usable both on embedded and desktop class CPUs, made possible by it being lightweight and modular.
- Basic utilities will be written in Zig. This includes a basic text editor and shell, and will be part of the filesystem external to the kernel itself.
- Easy to port. The kernel is oblivious to the underlying architecture, meaning that ports only need to implement the defined interface and they should work without a hitch.
All of these goals will benefit from the features of Zig.
Build
Requires a master build of Zig (downloaded or built from source) xorriso and the grub tools (such as grub-mkrescue). A qemu-system binary compatible with your chosen target is required to run the kernel (e.g. qemu-system-i386).
zig build
Run
zig build run
or if you want to wait for a gdb connection:
zig build debug-run
Debug
Launch a gdb-multiarch instance and connect to qemu.
zig build debug
Unit testing
Run the unit tests.
zig build test
Runtime testing
Run the runtime tests.
zig build rt-test -Dtest-mode=<MODE>
Available test modes:
None
: This is the default, this will run the OS normally.Initialisation
: Run the OS's initialisation runtime tests to ensure the OS is properly set up.Panic
: Run the panic runtime test.
Options
-D[build-mode]=
: Boolean (defaultfalse
).- build: Build a certain build mode (release-safe, release-fast, release-small). Don't set in order to use the debug build mode.
- test: Test a certain build mode (release-safe, release-fast, release-small). Don't set in order to use the debug build mode.
-Dtarget=
: String (defaulti386-freestanding
). The standard target options for building with zig. Currently supported targets:i386-freestanding
-Ddisable-display
: Boolean (defaultfalse
)- This disables the display output of QEMU.
Contribution
We welcome all contributions, be it bug reports, feature suggestions or pull requests. We follow the style mandated by zig fmt so make sure you've run zig fmt
on your code before submitting it.
We also like to order a file's members (public after non-public):
- imports
- type definitions
- constants
- variables
- inline functions
- functions
- entry point/init function
More styling information is available on the wiki