3 EXTENSION class Kernel_thread
6 static int init_done();
9 static int free_initcall_section_done;
16 #include "boot_info.h"
20 #include "mem_layout.h"
22 #include "trap_state.h"
25 int Kernel_thread::free_initcall_section_done;
29 Kernel_thread::init_done()
31 return free_initcall_section_done;
34 IMPLEMENT inline NEEDS [<unistd.h>, <sys/mman.h>, "mem_layout.h"]
36 Kernel_thread::free_initcall_section()
38 munmap((void*)&Mem_layout::initcall_start,
39 &Mem_layout::initcall_end - &Mem_layout::initcall_start);
40 free_initcall_section_done = 1;
45 Kernel_thread::bootstrap_arch()
47 // install slow trap handler
48 nested_trap_handler = Trap_state::base_handler;
49 Trap_state::base_handler = thread_handle_trap;
51 if (Boot_info::jdb_cmd())
52 kdb_ke_sequence(Boot_info::jdb_cmd());
54 if (Boot_info::wait())
62 Kernel_thread::arch_exit()
64 fflush(0); // Flush output stream
65 Pic::irq_prov_shutdown(); // atexit calls are not run with _exit
66 _exit(0); // Don't call destructors
69 //--------------------------------------------------------------------------
73 Kernel_thread::boot_app_cpus()
77 //--------------------------------------------------------------------------
81 Kernel_thread::boot_app_cpus()
83 printf("MP: launching APs...\n");
86 extern char _tramp_mp_entry[];
87 printf("new child: %d [%d]\n",
88 Emulation::spawn_cpu_thread((Address)_tramp_mp_entry),