3 #include "kernel_thread.h"
5 class App_cpu_thread : public Kernel_thread
8 void bootstrap() asm ("call_ap_bootstrap") FIASCO_FASTCALL;
17 #include "delayloop.h"
20 #include "helping_lock.h"
21 #include "kernel_task.h"
22 #include "processor.h"
25 #include "thread_state.h"
27 #include "vmem_alloc.h"
28 #include "spin_lock.h"
33 App_cpu_thread::init_stack()
38 // the kernel bootstrap routine
41 App_cpu_thread::bootstrap()
43 extern Spin_lock _tramp_mp_spinlock;
45 state_change_dirty(0, Thread_ready); // Set myself ready
47 // Setup initial timeslice
48 set_current_sched(sched());
52 // initialize the current_mem_space function to point to the kernel space
53 Kernel_task::kernel_task()->mem_space()->make_current();
55 Mem_unit::tlb_flush();
57 Cpu::cpus.cpu(current_cpu()).set_online(1);
59 _tramp_mp_spinlock.set(1);
61 kernel_context(cpu(), this);
62 Sched_context::rq(cpu()).set_idle(this->sched());
66 Per_cpu_data::run_late_ctors(cpu());
70 printf("CPU[%u]: goes to idle loop\n", cpu());
75 // ------------------------------------------------------------------------
76 IMPLEMENTATION [mp && !kernel_can_exit]:
80 App_cpu_thread::do_app_idle()
86 // ------------------------------------------------------------------------
87 IMPLEMENTATION [mp && kernel_can_exit]:
91 App_cpu_thread::do_app_idle()
99 // Boost this thread's priority to the maximum. Since this thread tears down
100 // all other threads, we want it to run whenever possible to advance as fast
103 sched()->set_prio(255);