MCPcopy Create free account
hub / github.com/chyyuu/os_kernel_lab / _start

Function _start

user/src/lib.rs:42–62  ·  view source on GitHub ↗
(argc: usize, argv: usize)

Source from the content-addressed store, hash-verified

40#[no_mangle]
41#[link_section = ".text.entry"]
42pub extern "C" fn _start(argc: usize, argv: usize) -> ! {
43 unsafe {
44 HEAP.lock()
45 .init(HEAP_SPACE.as_ptr() as usize, USER_HEAP_SIZE);
46 }
47 let mut v: Vec<&'static str> = Vec::new();
48 for i in 0..argc {
49 let str_start =
50 unsafe { ((argv + i * core::mem::size_of::<usize>()) as *const usize).read_volatile() };
51 let len = (0usize..)
52 .find(|i| unsafe { ((str_start + *i) as *const u8).read_volatile() == 0 })
53 .unwrap();
54 v.push(
55 core::str::from_utf8(unsafe {
56 core::slice::from_raw_parts(str_start as *const u8, len)
57 })
58 .unwrap(),
59 );
60 }
61 exit(main(argc, v.as_slice()));
62}
63
64#[linkage = "weak"]
65#[no_mangle]

Callers

nothing calls this directly

Calls 6

exitFunction · 0.85
lockMethod · 0.80
findMethod · 0.80
mainFunction · 0.70
initMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected