summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2008-08-19 19:53:52 +0000
committerjhb <jhb@FreeBSD.org>2008-08-19 19:53:52 +0000
commitd90774443d556bbfad2e78eaba79c93230484234 (patch)
tree54a78b309ff5605f1b1c38a78d05a129df9f9940 /sys
parent6c10b95f591e34da2c498e8f2bccb35a4219ef75 (diff)
downloadFreeBSD-src-d90774443d556bbfad2e78eaba79c93230484234.zip
FreeBSD-src-d90774443d556bbfad2e78eaba79c93230484234.tar.gz
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
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/include/pcpu.h4
-rw-r--r--sys/arm/include/pcpu.h4
-rw-r--r--sys/i386/include/pcpu.h5
-rw-r--r--sys/ia64/include/pcpu.h4
-rw-r--r--sys/mips/include/pcpu.h5
-rw-r--r--sys/powerpc/include/pcpu.h3
-rw-r--r--sys/sparc64/include/pcpu.h4
-rw-r--r--sys/sun4v/include/pcpu.h5
-rw-r--r--sys/sys/pcpu.h8
-rw-r--r--sys/sys/types.h2
10 files changed, 26 insertions, 18 deletions
diff --git a/sys/amd64/include/pcpu.h b/sys/amd64/include/pcpu.h
index 444109e..fe811c5 100644
--- a/sys/amd64/include/pcpu.h
+++ b/sys/amd64/include/pcpu.h
@@ -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;
diff --git a/sys/arm/include/pcpu.h b/sys/arm/include/pcpu.h
index 8388ba6..387035c 100644
--- a/sys/arm/include/pcpu.h
+++ b/sys/arm/include/pcpu.h
@@ -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;
diff --git a/sys/i386/include/pcpu.h b/sys/i386/include/pcpu.h
index ea8ff46..5690e86 100644
--- a/sys/i386/include/pcpu.h
+++ b/sys/i386/include/pcpu.h
@@ -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;
diff --git a/sys/ia64/include/pcpu.h b/sys/ia64/include/pcpu.h
index d641816..c63573b 100644
--- a/sys/ia64/include/pcpu.h
+++ b/sys/ia64/include/pcpu.h
@@ -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");
diff --git a/sys/mips/include/pcpu.h b/sys/mips/include/pcpu.h
index fb2951b..5fe2b22 100644
--- a/sys/mips/include/pcpu.h
+++ b/sys/mips/include/pcpu.h
@@ -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)
diff --git a/sys/powerpc/include/pcpu.h b/sys/powerpc/include/pcpu.h
index af9e54b..fba4c8f 100644
--- a/sys/powerpc/include/pcpu.h
+++ b/sys/powerpc/include/pcpu.h
@@ -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)
diff --git a/sys/sparc64/include/pcpu.h b/sys/sparc64/include/pcpu.h
index 04f5ee6..91c1e5d 100644
--- a/sys/sparc64/include/pcpu.h
+++ b/sys/sparc64/include/pcpu.h
@@ -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;
diff --git a/sys/sun4v/include/pcpu.h b/sys/sun4v/include/pcpu.h
index beb0789..b88ddbb 100644
--- a/sys/sun4v/include/pcpu.h
+++ b/sys/sun4v/include/pcpu.h
@@ -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));
diff --git a/sys/sys/pcpu.h b/sys/sys/pcpu.h
index df73985..5633bf0 100644
--- a/sys/sys/pcpu.h
+++ b/sys/sys/pcpu.h
@@ -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_ */
diff --git a/sys/sys/types.h b/sys/sys/types.h
index ed0e3a9..929407f 100644
--- a/sys/sys/types.h
+++ b/sys/sys/types.h
@@ -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;
OpenPOWER on IntegriCloud