feat(userspace-rt): add runtime crate with entry point, panic handler, and allocator re-export

Snake and hello apps now use extern crate userspace_rt — no more boilerplate assembly or panic handlers in app code.
This commit is contained in:
2026-10-18 04:04:52 +02:00
parent e092fa4ae5
commit 29434805a6
9 changed files with 58 additions and 70 deletions

View File

@@ -0,0 +1,8 @@
[package]
name = "userspace-rt"
version = "0.1.0"
edition = "2024"
[dependencies]
types = { workspace = true }
userspace = { workspace = true }

View File

@@ -0,0 +1,2 @@
#[cfg(all(target_arch = "riscv64", target_os = "none"))]
mod riscv;

View File

@@ -0,0 +1,13 @@
use core::arch::global_asm;
global_asm!(
r#"
.section .text.entry
.globl _start
_start:
call main
li a7, 16
ecall
j _start
"#
);

View File

@@ -0,0 +1,12 @@
#![no_std]
mod arch;
pub use userspace::syscall;
pub use userspace::allocator::KosAllocator;
#[cfg(target_os = "none")]
#[panic_handler]
fn panic(_: &core::panic::PanicInfo) -> ! {
userspace::syscall::exit();
}