| Crates.io | zodiac |
| lib.rs | zodiac |
| version | 0.3.0 |
| created_at | 2025-08-05 12:08:14.956347+00 |
| updated_at | 2025-09-10 13:46:49.233562+00 |
| description | Rust OS framework that offers safe interfaces for kernel development |
| homepage | https://github.com/zzjrabbit/racaOS/tree/edition19/zodiac |
| repository | https://github.com/zzjrabbit/racaOS |
| max_upload_size | |
| id | 1781891 |
| size | 197,265 |
Zodiac is a framework for framekernel, inspired by ostd
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:
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.