Export 'struct pcpu' to userland w/o requiring _KERNEL. A few ports

already define _KERNEL to get to this and I'm about to add hooks to
libkvm to access per-CPU data.

MFC after:	1 week
This commit is contained in:
John Baldwin 2008-08-19 19:53:52 +00:00
parent e5bfdc768a
commit 70d12a18f2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=181875
10 changed files with 26 additions and 18 deletions

View File

@ -33,8 +33,6 @@
#error "sys/cdefs.h is a prerequisite for this file"
#endif
#ifdef _KERNEL
/*
* The SMP parts are setup in pmap.c and locore.s for the BSP, and
* mp_machdep.c sets up the data for the AP's to "see" when they awake.
@ -52,6 +50,8 @@
u_int pc_apic_id; \
u_int pc_acpi_id /* ACPI CPU id */
#ifdef _KERNEL
#ifdef lint
extern struct pcpu *pcpup;

View File

@ -38,6 +38,8 @@
struct vmspace;
#endif /* _KERNEL */
/*
* Inside the kernel, the globally reserved register g7 is used to
* point at the globaldata structure.
@ -45,6 +47,8 @@ struct vmspace;
#define PCPU_MD_FIELDS \
struct pcup *pc_prvspace;
#ifdef _KERNEL
struct pcb;
struct pcpu;

View File

@ -33,8 +33,6 @@
#error "sys/cdefs.h is a prerequisite for this file"
#endif
#ifdef _KERNEL
#include <machine/segments.h>
#include <machine/tss.h>
@ -82,6 +80,9 @@
int pc_private_tss /* Flag indicating private tss */
#endif
#ifdef _KERNEL
#ifdef lint
extern struct pcpu *pcpup;

View File

@ -30,8 +30,6 @@
#ifndef _MACHINE_PCPU_H_
#define _MACHINE_PCPU_H_
#ifdef _KERNEL
#include <machine/pcb.h>
#define PCPU_MD_FIELDS \
@ -43,6 +41,8 @@
uint32_t pc_awake:1; /* CPU is awake? */ \
uint32_t pc_acpi_id /* ACPI CPU id. */
#ifdef _KERNEL
struct pcpu;
register struct pcpu *pcpup __asm__("r13");

View File

@ -31,9 +31,8 @@
#ifndef _MACHINE_PCPU_H_
#define _MACHINE_PCPU_H_
#ifdef _KERNEL
#include <machine/pte.h>
#define PCPU_MD_FIELDS \
pd_entry_t *pc_segbase; /* curthread segbase */ \
struct pmap *pc_curpmap; /* pmap of curthread */ \
@ -42,6 +41,8 @@
u_int pc_pending_ipis; /* the IPIs pending to this CPU */ \
void *pc_boot_stack;
#ifdef _KERNEL
#ifdef SMP
static __inline struct pcpu*
get_pcpup(void)

View File

@ -30,7 +30,6 @@
#ifndef _MACHINE_PCPU_H_
#define _MACHINE_PCPU_H_
#ifdef _KERNEL
#include <machine/cpufunc.h>
struct pmap;
@ -117,6 +116,8 @@ struct pmap;
int pc_md_placeholder
#endif
#ifdef _KERNEL
#define pcpup ((struct pcpu *) powerpc_get_pcpup())
#define PCPU_GET(member) (pcpup->pc_ ## member)

View File

@ -30,8 +30,6 @@
#ifndef _MACHINE_PCPU_H_
#define _MACHINE_PCPU_H_
#ifdef _KERNEL
#include <machine/asmacros.h>
#include <machine/frame.h>
#include <machine/intr_machdep.h>
@ -59,6 +57,8 @@ struct pmap;
u_int pc_tlb_ctx_max; \
u_int pc_tlb_ctx_min
#ifdef _KERNEL
struct pcb;
struct pcpu;

View File

@ -30,8 +30,6 @@
#ifndef _MACHINE_PCPU_H_
#define _MACHINE_PCPU_H_
#ifdef _KERNEL
#include <machine/asmacros.h>
#include <machine/frame.h>
#include <machine/intr_machdep.h>
@ -82,6 +80,9 @@ struct pmap;
* be L2 cache aligned - they're surrounded by per-cpu data, so there is
* no possibility of false sharing, but this might help in reducing misses
*/
#ifdef _KERNEL
struct pcpu;
register struct pcpu *pcpup __asm__(__XSTRING(PCPU_REG));

View File

@ -33,10 +33,6 @@
#ifndef _SYS_PCPU_H_
#define _SYS_PCPU_H_
#ifndef _KERNEL
#error "no user-serviceable parts inside"
#endif
#ifdef LOCORE
#error "no assembler-serviceable parts inside"
#endif
@ -106,6 +102,8 @@ struct pcpu {
PCPU_MD_FIELDS;
};
#ifdef _KERNEL
SLIST_HEAD(cpuhead, pcpu);
extern struct cpuhead cpuhead;
@ -133,4 +131,6 @@ void pcpu_destroy(struct pcpu *pcpu);
struct pcpu *pcpu_find(u_int cpuid);
void pcpu_init(struct pcpu *pcpu, int cpuid, size_t size);
#endif /* _KERNEL */
#endif /* !_SYS_PCPU_H_ */

View File

@ -143,6 +143,7 @@ typedef __clockid_t clockid_t;
#define _CLOCKID_T_DECLARED
#endif
typedef __cpumask_t cpumask_t;
typedef __critical_t critical_t; /* Critical section value */
typedef __int64_t daddr_t; /* disk address */
@ -278,7 +279,6 @@ typedef __vm_size_t vm_size_t;
#ifdef _KERNEL
typedef int boolean_t;
typedef __cpumask_t cpumask_t;
typedef struct device *device_t;
typedef __intfptr_t intfptr_t;