ableos_userland/libraries/std/src/entry.rs

26 lines
467 B
Rust
Raw Normal View History

2023-03-09 06:36:35 -06:00
use core::arch::asm;
#[no_mangle]
unsafe extern "C" fn _start() -> ! {
extern "C" {
fn main(argc: isize, argv: *const *const u8) -> isize;
}
// TODO: grab and pass arguments to main
main(0, core::ptr::null());
asm!(
"syscall",
in("rax") 60,
in("rdi") 0,
options(noreturn)
);
}
#[lang = "start"]
fn lang_start<T>(main: fn() -> T, _: isize, _: *const *const u8, _: u8) -> isize {
main();
0
}