Drop main() prototype. Syncs with NetBSD-8
[minix.git] / minix / kernel / cpulocals.h
blob588196e5e666238f2cbd4ad448b8e974eb387360
1 /* Implementation of CPU local variables generics */
2 #ifndef __CPULOCALS_H__
3 #define __CPULOCALS_H__
5 #ifndef __ASSEMBLY__
7 #ifdef CONFIG_SMP
9 /* SMP */
11 #define CPULOCAL_ARRAY [CONFIG_MAX_CPUS]
13 #define get_cpu_var(cpu, name) __cpu_local_vars[cpu].name
14 #define get_cpu_var_ptr(cpu, name) (&(get_cpu_var(cpu, name)))
15 #define get_cpulocal_var(name) get_cpu_var(cpuid, name)
16 #define get_cpulocal_var_ptr(name) get_cpu_var_ptr(cpuid, name)
18 /* FIXME - padd the structure so that items in the array do not share cacheline
19 * with other cpus */
21 #else
23 /* single CPU */
25 #define CPULOCAL_ARRAY
27 #define get_cpulocal_var(name) __cpu_local_vars.name
28 #define get_cpulocal_var_ptr(name) &(get_cpulocal_var(name))
29 #define get_cpu_var(cpu, name) get_cpulocal_var(name)
30 #define get_cpu_var_ptr(cpu, name) get_cpulocal_var_ptr(name)
32 #endif
35 * The global cpu local variables in use
37 extern struct __cpu_local_vars {
39 /* Process scheduling information and the kernel reentry count. */
40 struct proc *proc_ptr;/* pointer to currently running process */
41 struct proc *bill_ptr;/* process to bill for clock ticks */
42 struct proc idle_proc;/* stub for an idle process */
44 /*
45 * signal whether pagefault is already being handled to detect recursive
46 * pagefaults
48 int pagefault_handled;
51 * which processpage tables are loaded right now. We need to know this because
52 * some processes are loaded in each process pagetables and don't have their own
53 * pagetables. Therefore we cannot use the proc_ptr pointer
55 struct proc * ptproc;
57 /* CPU private run queues */
58 struct proc * run_q_head[NR_SCHED_QUEUES]; /* ptrs to ready list headers */
59 struct proc * run_q_tail[NR_SCHED_QUEUES]; /* ptrs to ready list tails */
60 int cpu_is_idle; /* let the others know that you are idle */
62 int idle_interrupted; /* to interrupt busy-idle
63 while profiling */
65 u64_t tsc_ctr_switch; /* when did we switched time accounting */
67 /* last values read from cpu when sending ooq msg to scheduler */
68 u64_t cpu_last_tsc;
69 u64_t cpu_last_idle;
72 char fpu_presence; /* whether the cpu has FPU or not */
73 struct proc * fpu_owner; /* who owns the FPU of the local cpu */
75 } __cpu_local_vars CPULOCAL_ARRAY;
77 #endif /* __ASSEMBLY__ */
79 #endif /* __CPULOCALS_H__ */