1 /* 2 * Copyright 2008, Dustin Howett, dustin.howett@gmail.com. All rights reserved. 3 * Copyright 2004-2010, Axel Dörfler, axeld@pinc-software.de. 4 * Distributed under the terms of the MIT License. 5 * 6 * Copyright 2001, Travis Geiselbrecht. All rights reserved. 7 * Distributed under the terms of the NewOS License. 8 */ 9 10 11 #include "smp.h" 12 13 #include <string.h> 14 15 #include <KernelExport.h> 16 17 #include <kernel.h> 18 #include <safemode.h> 19 #include <boot/platform.h> 20 #include <boot/stage2.h> 21 #include <boot/menu.h> 22 23 #include "arch_smp.h" 24 25 26 #define NO_SMP 0 27 28 //#define TRACE_SMP 29 #ifdef TRACE_SMP 30 # define TRACE(x) dprintf x 31 #else 32 # define TRACE(x) ; 33 #endif 34 35 36 int 37 smp_get_current_cpu(void) 38 { 39 return arch_smp_get_current_cpu(); 40 } 41 42 43 void 44 smp_init_other_cpus(void) 45 { 46 arch_smp_init_other_cpus(); 47 } 48 49 50 void 51 smp_boot_other_cpus(uint32 pml4, uint64 kernel_entry) 52 { 53 if (gKernelArgs.num_cpus < 2) 54 return; 55 56 arch_smp_boot_other_cpus(pml4, kernel_entry); 57 } 58 59 60 void 61 smp_add_safemode_menus(Menu *menu) 62 { 63 arch_smp_add_safemode_menus(menu); 64 } 65 66 67 void 68 smp_init(void) 69 { 70 #if NO_SMP 71 gKernelArgs.num_cpus = 1; 72 return; 73 #endif 74 75 arch_smp_init(); 76 } 77