kernel/cpulocals.h: Simplify macros
Change-Id: Ice845fb0743ff686398293cef2620f5ac9c902ad
This commit is contained in:
parent
7eaefc5e7c
commit
733a844ac6
@ -1,3 +1,3 @@
|
|||||||
#include "kernel/kernel.h"
|
#include "kernel/kernel.h"
|
||||||
|
|
||||||
DEFINE_CPULOCAL_VARS;
|
struct __cpu_local_vars __cpu_local_vars CPULOCAL_ARRAY;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#define CPULOCAL_ARRAY [CONFIG_MAX_CPUS]
|
#define CPULOCAL_ARRAY [CONFIG_MAX_CPUS]
|
||||||
|
|
||||||
#define get_cpu_var(cpu, name) CPULOCAL_STRUCT[cpu].name
|
#define get_cpu_var(cpu, name) __cpu_local_vars[cpu].name
|
||||||
#define get_cpu_var_ptr(cpu, name) (&(get_cpu_var(cpu, name)))
|
#define get_cpu_var_ptr(cpu, name) (&(get_cpu_var(cpu, name)))
|
||||||
#define get_cpulocal_var(name) get_cpu_var(cpuid, name)
|
#define get_cpulocal_var(name) get_cpu_var(cpuid, name)
|
||||||
#define get_cpulocal_var_ptr(name) get_cpu_var_ptr(cpuid, name)
|
#define get_cpulocal_var_ptr(name) get_cpu_var_ptr(cpuid, name)
|
||||||
@ -24,69 +24,55 @@
|
|||||||
|
|
||||||
#define CPULOCAL_ARRAY
|
#define CPULOCAL_ARRAY
|
||||||
|
|
||||||
#define get_cpulocal_var(name) CPULOCAL_STRUCT.name
|
#define get_cpulocal_var(name) __cpu_local_vars.name
|
||||||
#define get_cpulocal_var_ptr(name) &(get_cpulocal_var(name))
|
#define get_cpulocal_var_ptr(name) &(get_cpulocal_var(name))
|
||||||
#define get_cpu_var(cpu, name) get_cpulocal_var(name)
|
#define get_cpu_var(cpu, name) get_cpulocal_var(name)
|
||||||
#define get_cpu_var_ptr(cpu, name) get_cpulocal_var_ptr(name)
|
#define get_cpu_var_ptr(cpu, name) get_cpulocal_var_ptr(name)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define DECLARE_CPULOCAL(type, name) type name
|
|
||||||
|
|
||||||
#define CPULOCAL_STRUCT __cpu_local_vars
|
|
||||||
#define ___CPULOCAL_START struct CPULOCAL_STRUCT {
|
|
||||||
#define ___CPULOCAL_END } CPULOCAL_STRUCT CPULOCAL_ARRAY;
|
|
||||||
|
|
||||||
#define DECLARE_CPULOCAL_START extern ___CPULOCAL_START
|
|
||||||
#define DECLARE_CPULOCAL_END ___CPULOCAL_END
|
|
||||||
|
|
||||||
#define DEFINE_CPULOCAL_VARS struct CPULOCAL_STRUCT CPULOCAL_STRUCT CPULOCAL_ARRAY
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The global cpu local variables in use
|
* The global cpu local variables in use
|
||||||
*/
|
*/
|
||||||
DECLARE_CPULOCAL_START
|
extern struct __cpu_local_vars {
|
||||||
|
|
||||||
/* Process scheduling information and the kernel reentry count. */
|
/* Process scheduling information and the kernel reentry count. */
|
||||||
DECLARE_CPULOCAL(struct proc *,proc_ptr);/* pointer to currently running process */
|
struct proc *proc_ptr;/* pointer to currently running process */
|
||||||
DECLARE_CPULOCAL(struct proc *,bill_ptr);/* process to bill for clock ticks */
|
struct proc *bill_ptr;/* process to bill for clock ticks */
|
||||||
DECLARE_CPULOCAL(struct proc ,idle_proc);/* stub for an idle process */
|
struct proc idle_proc;/* stub for an idle process */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* signal whether pagefault is already being handled to detect recursive
|
* signal whether pagefault is already being handled to detect recursive
|
||||||
* pagefaults
|
* pagefaults
|
||||||
*/
|
*/
|
||||||
DECLARE_CPULOCAL(int, pagefault_handled);
|
int pagefault_handled;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* which processpage tables are loaded right now. We need to know this because
|
* which processpage tables are loaded right now. We need to know this because
|
||||||
* some processes are loaded in each process pagetables and don't have their own
|
* some processes are loaded in each process pagetables and don't have their own
|
||||||
* pagetables. Therefore we cannot use the proc_ptr pointer
|
* pagetables. Therefore we cannot use the proc_ptr pointer
|
||||||
*/
|
*/
|
||||||
DECLARE_CPULOCAL(struct proc *, ptproc);
|
struct proc * ptproc;
|
||||||
|
|
||||||
/* CPU private run queues */
|
/* CPU private run queues */
|
||||||
DECLARE_CPULOCAL(struct proc *, run_q_head[NR_SCHED_QUEUES]); /* ptrs to ready list headers */
|
struct proc * run_q_head[NR_SCHED_QUEUES]; /* ptrs to ready list headers */
|
||||||
DECLARE_CPULOCAL(struct proc *, run_q_tail[NR_SCHED_QUEUES]); /* ptrs to ready list tails */
|
struct proc * run_q_tail[NR_SCHED_QUEUES]; /* ptrs to ready list tails */
|
||||||
DECLARE_CPULOCAL(volatile int, cpu_is_idle); /* let the others know that you are idle */
|
int cpu_is_idle; /* let the others know that you are idle */
|
||||||
|
|
||||||
DECLARE_CPULOCAL(volatile int, idle_interrupted); /* to interrupt busy-idle
|
int idle_interrupted; /* to interrupt busy-idle
|
||||||
while profiling */
|
while profiling */
|
||||||
|
|
||||||
DECLARE_CPULOCAL(u64_t ,tsc_ctr_switch); /* when did we switched time accounting */
|
u64_t tsc_ctr_switch; /* when did we switched time accounting */
|
||||||
|
|
||||||
/* last values read from cpu when sending ooq msg to scheduler */
|
/* last values read from cpu when sending ooq msg to scheduler */
|
||||||
DECLARE_CPULOCAL(u64_t, cpu_last_tsc);
|
u64_t cpu_last_tsc;
|
||||||
DECLARE_CPULOCAL(u64_t, cpu_last_idle);
|
u64_t cpu_last_idle;
|
||||||
|
|
||||||
|
|
||||||
DECLARE_CPULOCAL(char ,fpu_presence); /* whether the cpu has FPU or not */
|
char fpu_presence; /* whether the cpu has FPU or not */
|
||||||
DECLARE_CPULOCAL(struct proc * ,fpu_owner); /* who owns the FPU of the local cpu */
|
struct proc * fpu_owner; /* who owns the FPU of the local cpu */
|
||||||
|
|
||||||
DECLARE_CPULOCAL_END
|
} __cpu_local_vars CPULOCAL_ARRAY;
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user