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 "spin_lock.h"
32 App_cpu_thread::init_stack()
33 { return _kernel_sp; }
35 // the kernel bootstrap routine
38 App_cpu_thread::bootstrap()
40 extern Spin_lock<Mword> _tramp_mp_spinlock;
42 state_change_dirty(0, Thread_ready); // Set myself ready
44 // Setup initial timeslice
45 set_current_sched(sched());
49 // initialize the current_mem_space function to point to the kernel space
50 Kernel_task::kernel_task()->mem_space()->make_current();
52 Mem_unit::tlb_flush();
54 Cpu::cpus.cpu(current_cpu()).set_online(1);
56 _tramp_mp_spinlock.set(1);
58 kernel_context(cpu(), this);
59 Sched_context::rq(cpu()).set_idle(this->sched());
63 Per_cpu_data::run_late_ctors(cpu());
67 printf("CPU[%u]: goes to idle loop\n", cpu());
72 // ------------------------------------------------------------------------
73 IMPLEMENTATION [mp && !kernel_can_exit]:
77 App_cpu_thread::do_app_idle()
83 // ------------------------------------------------------------------------
84 IMPLEMENTATION [mp && kernel_can_exit]:
88 App_cpu_thread::do_app_idle()
96 // Boost this thread's priority to the maximum. Since this thread tears down
97 // all other threads, we want it to run whenever possible to advance as fast
100 sched()->set_prio(255);