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