Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/pcpu.h
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
#include <sys/queue.h> | #include <sys/queue.h> | ||||
#include <sys/_rmlock.h> | #include <sys/_rmlock.h> | ||||
#include <sys/resource.h> | #include <sys/resource.h> | ||||
#include <machine/pcpu.h> | #include <machine/pcpu.h> | ||||
#define DPCPU_SETNAME "set_pcpu" | #define DPCPU_SETNAME "set_pcpu" | ||||
#define DPCPU_SYMPREFIX "pcpu_entry_" | #define DPCPU_SYMPREFIX "pcpu_entry_" | ||||
#ifdef _KERNEL | #if defined(_KERNEL) || defined(_KERNEL_UT) | ||||
/* | /* | ||||
* Define a set for pcpu data. | * Define a set for pcpu data. | ||||
*/ | */ | ||||
extern uintptr_t *__start_set_pcpu; | extern uintptr_t *__start_set_pcpu; | ||||
#ifndef _KERNEL_UT | |||||
imp: same, etc | |||||
__GLOBL(__start_set_pcpu); | __GLOBL(__start_set_pcpu); | ||||
#endif | |||||
extern uintptr_t *__stop_set_pcpu; | extern uintptr_t *__stop_set_pcpu; | ||||
#ifndef _KERNEL_UT | |||||
__GLOBL(__stop_set_pcpu); | __GLOBL(__stop_set_pcpu); | ||||
#endif | |||||
/* | /* | ||||
* Array of dynamic pcpu base offsets. Indexed by id. | * Array of dynamic pcpu base offsets. Indexed by id. | ||||
*/ | */ | ||||
extern uintptr_t dpcpu_off[]; | extern uintptr_t dpcpu_off[]; | ||||
/* | /* | ||||
* Convenience defines. | * Convenience defines. | ||||
▲ Show 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | struct pcpu { | ||||
* (e.g., lsof, part of gtop) define _KERNEL and include this | * (e.g., lsof, part of gtop) define _KERNEL and include this | ||||
* header. While strictly speaking this is wrong, there's no | * header. While strictly speaking this is wrong, there's no | ||||
* reason not to keep the offsets of the MI fields constant | * reason not to keep the offsets of the MI fields constant | ||||
* if only to make kernel debugging easier. | * if only to make kernel debugging easier. | ||||
*/ | */ | ||||
PCPU_MD_FIELDS; | PCPU_MD_FIELDS; | ||||
} __aligned(CACHE_LINE_SIZE); | } __aligned(CACHE_LINE_SIZE); | ||||
#ifdef _KERNEL | #if defined(_KERNEL) || defined(_KERNEL_UT) | ||||
STAILQ_HEAD(cpuhead, pcpu); | STAILQ_HEAD(cpuhead, pcpu); | ||||
extern struct cpuhead cpuhead; | extern struct cpuhead cpuhead; | ||||
extern struct pcpu *cpuid_to_pcpu[]; | extern struct pcpu *cpuid_to_pcpu[]; | ||||
#define curcpu PCPU_GET(cpuid) | #define curcpu PCPU_GET(cpuid) | ||||
#define curvidata PCPU_GET(vidata) | #define curvidata PCPU_GET(vidata) | ||||
▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | |||||
void *dpcpu_alloc(int size); | void *dpcpu_alloc(int size); | ||||
void dpcpu_copy(void *s, int size); | void dpcpu_copy(void *s, int size); | ||||
void dpcpu_free(void *s, int size); | void dpcpu_free(void *s, int size); | ||||
void dpcpu_init(void *dpcpu, int cpuid); | void dpcpu_init(void *dpcpu, int cpuid); | ||||
void pcpu_destroy(struct pcpu *pcpu); | void pcpu_destroy(struct pcpu *pcpu); | ||||
struct pcpu *pcpu_find(u_int cpuid); | struct pcpu *pcpu_find(u_int cpuid); | ||||
void pcpu_init(struct pcpu *pcpu, int cpuid, size_t size); | void pcpu_init(struct pcpu *pcpu, int cpuid, size_t size); | ||||
#endif /* _KERNEL */ | #endif /* _KERNEL || _KERNEL_UT */ | ||||
#endif /* !_SYS_PCPU_H_ */ | #endif /* !_SYS_PCPU_H_ */ |
same, etc