3 * Shared main startup/shutdown code
13 IMPLEMENTATION[ia32,ux]:
20 #include "kernel_task.h"
21 #include "kernel_thread.h"
30 Cpu const &cpu = *Cpu::boot_cpu();
32 // caution: no stack variables in this function because we're going
33 // to change the stack pointer!
35 cpu.show_cache_tlb_info("");
37 printf ("\nFreeing init code/data: %lu bytes (%lu pages)\n\n",
38 (Address)(&Mem_layout::initcall_end - &Mem_layout::initcall_start),
39 (Address)(&Mem_layout::initcall_end - &Mem_layout::initcall_start
40 >> Config::PAGE_SHIFT));
42 // Perform architecture specific initialization
45 // create kernel thread
46 static Kernel_thread *kernel = new (Ram_quota::root) Kernel_thread;
48 Task *const ktask = Kernel_task::kernel_task();
49 check(kernel->bind(ktask, User<Utcb>::Ptr(0)));
51 // switch to stack of kernel thread and bootstrap the kernel
53 (" movl %%esp, %0 \n\t" // save stack pointer in safe variable
54 " movl %%esi, %%esp \n\t" // switch stack
55 " call call_bootstrap \n\t" // bootstrap kernel thread
57 "=a" (dummy), "=c" (dummy), "=d" (dummy)
58 : "a"(kernel), "S" (kernel->init_stack()));
62 //------------------------------------------------------------------------
63 IMPLEMENTATION[(ia32,ux) && mp]:
65 #include "kernel_thread.h"
68 main_switch_ap_cpu_stack(Kernel_thread *kernel)
72 // switch to stack of kernel thread and bootstrap the kernel
74 (" movl %%esi, %%esp \n\t" // switch stack
75 " call call_ap_bootstrap \n\t" // bootstrap kernel thread
76 : "=a" (dummy), "=c" (dummy), "=d" (dummy)
77 : "a"(kernel), "S" (kernel->init_stack()));