1 /* 2 ** Copyright 2002-2004, The Haiku Team. All rights reserved. 3 ** Distributed under the terms of the Haiku License. 4 ** 5 ** Copyright 2002, Travis Geiselbrecht. All rights reserved. 6 ** Distributed under the terms of the NewOS License. 7 */ 8 #ifndef _KERNEL_CPU_H 9 #define _KERNEL_CPU_H 10 11 12 #include <smp.h> 13 #include <timer.h> 14 #include <boot/kernel_args.h> 15 16 17 /* CPU local data structure */ 18 19 typedef union cpu_ent { 20 struct { 21 int cpu_num; 22 23 // thread.c: used to force a reschedule at quantum expiration time 24 int preempted; 25 timer quantum_timer; 26 } info; 27 uint32 align[16]; 28 } cpu_ent; 29 30 /** 31 * Defined in core/cpu.c 32 */ 33 extern cpu_ent cpu[MAX_BOOT_CPUS]; 34 35 36 #ifdef __cplusplus 37 extern "C" { 38 #endif 39 40 status_t cpu_preboot_init(struct kernel_args *args); 41 status_t cpu_init(struct kernel_args *args); 42 status_t cpu_init_post_vm(struct kernel_args *args); 43 44 cpu_ent *get_cpu_struct(void); 45 46 extern inline cpu_ent *get_cpu_struct(void) { return &cpu[smp_get_current_cpu()]; } 47 48 #ifdef __cplusplus 49 } 50 #endif 51 52 #endif /* _KERNEL_CPU_H */ 53