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 Cpu::cpus.cpu(current_cpu()).set_online(1);
57 _tramp_mp_spinlock.set(1);
59 kernel_context(cpu(), this);
60 Sched_context::rq(cpu()).set_idle(this->sched());
66 printf("CPU[%u]: goes to idle loop\n", cpu());
71 // ------------------------------------------------------------------------
72 IMPLEMENTATION [mp && !kernel_can_exit]:
76 App_cpu_thread::do_app_idle()
82 // ------------------------------------------------------------------------
83 IMPLEMENTATION [mp && kernel_can_exit]:
87 App_cpu_thread::do_app_idle()
95 // Boost this thread's priority to the maximum. Since this thread tears down
96 // all other threads, we want it to run whenever possible to advance as fast
99 sched()->set_prio(255);