1 /* 2 * Copyright 2002-2005, Haiku Inc. All rights reserved. 3 * Distributed under the terms of the MIT 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 // ToDo: align manually on CPU cache lines if possible 28 uint32 align[16]; 29 } cpu_ent; 30 31 /** 32 * Defined in core/cpu.c 33 */ 34 extern cpu_ent cpu[MAX_BOOT_CPUS]; 35 36 37 #ifdef __cplusplus 38 extern "C" { 39 #endif 40 41 status_t cpu_preboot_init(struct kernel_args *args); 42 status_t cpu_init(struct kernel_args *args); 43 status_t cpu_init_post_vm(struct kernel_args *args); 44 45 cpu_ent *get_cpu_struct(void); 46 extern inline cpu_ent *get_cpu_struct(void) { return &cpu[smp_get_current_cpu()]; } 47 48 void _user_clear_caches(void *address, size_t length, uint32 flags); 49 50 #ifdef __cplusplus 51 } 52 #endif 53 54 #endif /* _KERNEL_CPU_H */ 55