tg-syscall
System call definitions and interfaces for the rCore tutorial operating system.
Overview
This crate provides system call number definitions and a framework for implementing system calls in the rCore tutorial kernel. System call numbers are generated from Musl Libc for RISC-V source code.
Features
- System call number definitions: Generated from Musl Libc for RISC-V
- Syscall framework: Trait-based system call implementation
- User and kernel modes: Separate features for user-space and kernel-space usage
- no_std compatible: Designed for bare-metal environments
Usage
Kernel side (with kernel feature)
use ;
// Initialize syscall handlers
init_io;
init_process;
init_scheduling;
// Handle syscalls
let result = handle;
User side (with user feature)
use ;
// Make system calls
write;
exit;
Features
kernel- Enable kernel-side syscall handling interfacesuser- Enable user-space syscall wrappers
Supported System Calls
Standard POSIX-compatible system calls including:
- I/O:
read,write,open,close - Process:
fork,exec,exit,wait,getpid - Signal:
kill,sigaction,sigprocmask,sigreturn - Thread:
thread_create,gettid,waittid - Scheduling:
sched_yield - Time:
clock_gettime - Synchronization:
semaphore_*,mutex_*,condvar_*
License
Licensed under either of MIT license or Apache License, Version 2.0 at your option.