1use crate::{sched, time};
4
5unsafe extern "C" {
6 fn app_main() -> ();
8}
9
10extern "C" fn app_main_entry(_ctx: *mut core::ffi::c_void) {
11 unsafe { app_main() }
12}
13
14pub fn init_app() {
15 let attrs = sched::thread::Attributes {
16 entry: app_main_entry,
17 ctx: core::ptr::null_mut(),
18 fin: None,
19 attrs: None,
20 };
21
22 sched::with(|sched| {
23 if let Ok(uid) = sched.create_thread(Some(sched::task::KERNEL_TASK), &attrs) {
24 if sched.enqueue(time::tick(), uid).is_err() {
25 panic!("failed to enqueue init thread.");
26 }
27 } else {
28 panic!("failed to create init task.");
29 }
30 })
31}