Changeset View
Changeset View
Standalone View
Standalone View
head/sys/mips/include/pcpu.h
Show All 33 Lines | |||||
#include <machine/cpufunc.h> | #include <machine/cpufunc.h> | ||||
#include <machine/pte.h> | #include <machine/pte.h> | ||||
#define PCPU_MD_COMMON_FIELDS \ | #define PCPU_MD_COMMON_FIELDS \ | ||||
pd_entry_t *pc_segbase; /* curthread segbase */ \ | pd_entry_t *pc_segbase; /* curthread segbase */ \ | ||||
struct pmap *pc_curpmap; /* pmap of curthread */ \ | struct pmap *pc_curpmap; /* pmap of curthread */ \ | ||||
u_int32_t pc_next_asid; /* next ASID to alloc */ \ | u_int32_t pc_next_asid; /* next ASID to alloc */ \ | ||||
u_int32_t pc_asid_generation; /* current ASID generation */ \ | u_int32_t pc_asid_generation; /* current ASID generation */ \ | ||||
u_int pc_pending_ipis; /* IPIs pending to this CPU */ | u_int pc_pending_ipis; /* IPIs pending to this CPU */ \ | ||||
struct pcpu *pc_self; /* globally-uniqe self pointer */ | |||||
#ifdef __mips_n64 | #ifdef __mips_n64 | ||||
#define PCPU_MD_MIPS64_FIELDS \ | #define PCPU_MD_MIPS64_FIELDS \ | ||||
PCPU_MD_COMMON_FIELDS \ | PCPU_MD_COMMON_FIELDS \ | ||||
char __pad[61] | char __pad[53] | ||||
#else | #else | ||||
#define PCPU_MD_MIPS32_FIELDS \ | #define PCPU_MD_MIPS32_FIELDS \ | ||||
PCPU_MD_COMMON_FIELDS \ | PCPU_MD_COMMON_FIELDS \ | ||||
char __pad[193] | char __pad[189] | ||||
#endif | #endif | ||||
#ifdef __mips_n64 | #ifdef __mips_n64 | ||||
#define PCPU_MD_FIELDS PCPU_MD_MIPS64_FIELDS | #define PCPU_MD_FIELDS PCPU_MD_MIPS64_FIELDS | ||||
#else | #else | ||||
#define PCPU_MD_FIELDS PCPU_MD_MIPS32_FIELDS | #define PCPU_MD_FIELDS PCPU_MD_MIPS32_FIELDS | ||||
#endif | #endif | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
extern char pcpu_space[MAXCPU][PAGE_SIZE * 2]; | extern char pcpu_space[MAXCPU][PAGE_SIZE * 2]; | ||||
#define PCPU_ADDR(cpu) (struct pcpu *)(pcpu_space[(cpu)]) | #define PCPU_ADDR(cpu) (struct pcpu *)(pcpu_space[(cpu)]) | ||||
extern struct pcpu *pcpup; | extern struct pcpu *pcpup; | ||||
#define PCPUP pcpup | #define PCPUP pcpup | ||||
/* | |||||
* Since we use a wired TLB entry to map the same VA to a different | |||||
* physical page for each CPU, get_pcpu() must use the pc_self | |||||
* field to obtain a globally-unique pointer. | |||||
*/ | |||||
#define get_pcpu() (PCPUP->pc_self) | |||||
#define PCPU_ADD(member, value) (PCPUP->pc_ ## member += (value)) | #define PCPU_ADD(member, value) (PCPUP->pc_ ## member += (value)) | ||||
#define PCPU_GET(member) (PCPUP->pc_ ## member) | #define PCPU_GET(member) (PCPUP->pc_ ## member) | ||||
#define PCPU_INC(member) PCPU_ADD(member, 1) | #define PCPU_INC(member) PCPU_ADD(member, 1) | ||||
#define PCPU_PTR(member) (&PCPUP->pc_ ## member) | #define PCPU_PTR(member) (&PCPUP->pc_ ## member) | ||||
#define PCPU_SET(member,value) (PCPUP->pc_ ## member = (value)) | #define PCPU_SET(member,value) (PCPUP->pc_ ## member = (value)) | ||||
#define PCPU_LAZY_INC(member) (++PCPUP->pc_ ## member) | #define PCPU_LAZY_INC(member) (++PCPUP->pc_ ## member) | ||||
Show All 10 Lines |