1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#![feature(lang_items, start)]
#![no_std]
extern "C"{
pub fn __neutron_syscall(num: u32, p1: u32, p2: u32, p3: u32, p4: u32, p5: u32, p6: u32) -> u32;
pub fn __neutron_syscall_short(num: u32, p1: u32, p2: u32, p3: u32) -> u32;
pub fn __testbench_syscall(num: u32, p1: u32, p2: u32, p3: u32, p4: u32, p5: u32, p6: u32) -> u32;
pub fn __testbench_syscall_short(num: u32, p1: u32, p2: u32, p3: u32) -> u32;
pub fn __exit(exit_code: u32) -> !;
}
extern "Rust"{
fn on_call() -> u32;
fn on_create() -> u32;
}
pub fn main(){}
#[start]
#[no_mangle]
pub extern "C" fn _neutron_main() -> u32 {
main();
unsafe{
let is_create_address: usize = 0x70000000 + 8;
let is_create = is_create_address as *const u32;
return if *is_create > 0{
on_create()
}else{
on_call()
}
}
}
#[panic_handler]
pub fn _neutron_panic_handler(_info: &core::panic::PanicInfo) -> ! {
unsafe{
__exit(8 + 1 + 2);
}
}