zodiac

Crates.iozodiac
lib.rszodiac
version0.3.0
created_at2025-08-05 12:08:14.956347+00
updated_at2025-09-10 13:46:49.233562+00
descriptionRust OS framework that offers safe interfaces for kernel development
homepagehttps://github.com/zzjrabbit/racaOS/tree/edition19/zodiac
repositoryhttps://github.com/zzjrabbit/racaOS
max_upload_size
id1781891
size197,265
Zeng Zhenjia (zzjrabbit)

documentation

README

Zodiac

Zodiac is a framework for framekernel, inspired by ostd

Usage

First, you need to add zodiac to your project's Cargo.toml file:

[dependencies]
zodiac = "0.1.0"

Then, you need a main function with the attribute #[zodiac::main] and a panic handler with the attribute #[zodiac::panic_handler]:

#[zodiac::main]
pub fn main() {
    // Your code here
}

#[zodiac::panic_handler]
pub fn panic_handler(info: &PanicInfo) -> ! {
    log::error!("panic: {}", info);
    loop {
        core::hint::spin_loop();
    }
}

And there are other necessary options, which are listed below:

  • allocator
  • scheduler

If you like, you can also specify the logger.

When you want to run user tasks, you can do something like this:


use zodiac::task::{ReturnReason, Task, TaskBuilder, UserContext};

let thread = TaskBuilder::default()
    .entry(thread_entry)
    .data((user_entry, user_stack))
    .build()?;

fn thread_entry() -> ! {
    let mut user_context = {
        let task = Task::current();
        let (entry, stack) = task.data().downcast_ref::<(usize, usize)>().unwrap();

        UserContext::new(*entry, *stack)
    };
    
    loop {
        let return_reason = user_context.excute(// Some clossure that tells if there is a kernel event.);
        
        match return_reason {
            ReturnReason::Syscall => {
                // Handle Syscall
            }
            ReturnReason::Exception(exception) => {
                // Handle Exception
            }
            ReturnReason::KernelEvent => {
                // Handle Kernel Event
            }
        }
    }
}

For more examples, please refer to racaOS.

Roadmap

  • Bootloader: limine
  • Memory Management
  • SMP
  • Interrupt handling
  • Multitask
  • Syscall
  • PCIe
  • MSI & MSI-X
  • IOMMU
Commit count: 10

cargo fmt