1 /* Implementation of CPU local variables generics */
2 #ifndef __CPULOCALS_H__
3 #define __CPULOCALS_H__
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
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)
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 */
45 * signal whether pagefault is already being handled to detect recursive
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
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
65 u64_t tsc_ctr_switch
; /* when did we switched time accounting */
67 /* last values read from cpu when sending ooq msg to scheduler */
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__ */