forked from AbleOS/ableos_userland
26 lines
467 B
Rust
26 lines
467 B
Rust
|
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
|
||
|
}
|