feat: userspace round-trip — syscall stubs, ecall dispatch, U-mode entry and exit on QEMU
This commit is contained in:
14
crates/apps/hello/Cargo.toml
Normal file
14
crates/apps/hello/Cargo.toml
Normal file
@@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "hello"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
userspace = { workspace = true }
|
||||
|
||||
[profile.release]
|
||||
panic = "abort"
|
||||
opt-level = "s"
|
||||
|
||||
[profile.dev]
|
||||
panic = "abort"
|
||||
24
crates/apps/hello/src/main.rs
Normal file
24
crates/apps/hello/src/main.rs
Normal file
@@ -0,0 +1,24 @@
|
||||
#![no_std]
|
||||
#![no_main]
|
||||
|
||||
use core::arch::global_asm;
|
||||
|
||||
global_asm!(
|
||||
r#"
|
||||
.section .text.entry
|
||||
.globl _start
|
||||
_start:
|
||||
call main
|
||||
j _start
|
||||
"#
|
||||
);
|
||||
|
||||
#[unsafe(no_mangle)]
|
||||
extern "C" fn main() -> ! {
|
||||
userspace::syscall::exit();
|
||||
}
|
||||
|
||||
#[panic_handler]
|
||||
fn panic(_: &core::panic::PanicInfo) -> ! {
|
||||
loop {}
|
||||
}
|
||||
Reference in New Issue
Block a user