summaryrefslogtreecommitdiffstats
path: root/sys/ia64/include
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-12-11 23:33:44 +0000
committerjhb <jhb@FreeBSD.org>2001-12-11 23:33:44 +0000
commit21b6b26912b00bb37f9f16080ba7d49241814935 (patch)
treec785835e70070309148a72c55669ff0bf043a20a /sys/ia64/include
parent279222ba62c185d7d7ec09017bb3e7760fd333f0 (diff)
downloadFreeBSD-src-21b6b26912b00bb37f9f16080ba7d49241814935.zip
FreeBSD-src-21b6b26912b00bb37f9f16080ba7d49241814935.tar.gz
Overhaul the per-CPU support a bit:
- The MI portions of struct globaldata have been consolidated into a MI struct pcpu. The MD per-CPU data are specified via a macro defined in machine/pcpu.h. A macro was chosen over a struct mdpcpu so that the interface would be cleaner (PCPU_GET(my_md_field) vs. PCPU_GET(md.md_my_md_field)). - All references to globaldata are changed to pcpu instead. In a UP kernel, this data was stored as global variables which is where the original name came from. In an SMP world this data is per-CPU and ideally private to each CPU outside of the context of debuggers. This also included combining machine/globaldata.h and machine/globals.h into machine/pcpu.h. - The pointer to the thread using the FPU on i386 was renamed from npxthread to fpcurthread to be identical with other architectures. - Make the show pcpu ddb command MI with a MD callout to display MD fields. - The globaldata_register() function was renamed to pcpu_init() and now init's MI fields of a struct pcpu in addition to registering it with the internal array and list. - A pcpu_destroy() function was added to remove a struct pcpu from the internal array and list. Tested on: alpha, i386 Reviewed by: peter, jake
Diffstat (limited to 'sys/ia64/include')
-rw-r--r--sys/ia64/include/globaldata.h73
-rw-r--r--sys/ia64/include/globals.h51
-rw-r--r--sys/ia64/include/mutex.h2
-rw-r--r--sys/ia64/include/pcpu.h48
-rw-r--r--sys/ia64/include/proc.h3
5 files changed, 14 insertions, 163 deletions
diff --git a/sys/ia64/include/globaldata.h b/sys/ia64/include/globaldata.h
deleted file mode 100644
index 4190c00..0000000
--- a/sys/ia64/include/globaldata.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*-
- * Copyright (c) 1999 Luoqi Chen <luoqi@freebsd.org>
- * Copyright (c) Peter Wemm <peter@netplex.com.au>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef _MACHINE_GLOBALDATA_H_
-#define _MACHINE_GLOBALDATA_H_
-
-#ifdef _KERNEL
-
-#include <sys/queue.h>
-
-/*
- * This structure maps out the global data that needs to be kept on a
- * per-cpu basis. genassym uses this to generate offsets for the assembler
- * code, which also provides external symbols so that C can get at them as
- * though they were really globals. This structure is pointed to by
- * the per-cpu system value (see alpha_pal_rdval() and alpha_pal_wrval()).
- * Inside the kernel, the globally reserved register t7 is used to
- * point at the globaldata structure.
- */
-struct globaldata {
- struct thread *gd_curthread; /* current thread */
- struct thread *gd_idlethread; /* idle thread */
- struct thread *gd_fpcurthread; /* fp state owner */
- struct pcb *gd_curpcb; /* current pcb */
- struct timeval gd_switchtime;
- int gd_switchticks;
- u_int gd_cpuid; /* this cpu number */
- u_int gd_other_cpus; /* all other cpus */
- u_int64_t gd_pending_ipis; /* pending IPI events */
- struct pmap *gd_current_pmap; /* which pmap is active */
- u_int32_t gd_next_asn; /* next ASN to allocate */
- u_int32_t gd_current_asngen; /* ASN rollover check */
-
- SLIST_ENTRY(globaldata) gd_allcpu;
- struct lock_list_entry *gd_spinlocks;
-#ifdef KTR_PERCPU
- int gd_ktr_idx; /* Index into trace table */
- char *gd_ktr_buf;
- char gd_ktr_buf_data[0];
-#endif
-};
-
-void globaldata_init(struct globaldata *pcpu, int cpuid, size_t sz);
-
-#endif /* _KERNEL */
-
-#endif /* !_MACHINE_GLOBALDATA_H_ */
diff --git a/sys/ia64/include/globals.h b/sys/ia64/include/globals.h
deleted file mode 100644
index 366d89b..0000000
--- a/sys/ia64/include/globals.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*-
- * Copyright (c) 1999 Luoqi Chen <luoqi@freebsd.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD$
- */
-
-#ifndef _MACHINE_GLOBALS_H_
-#define _MACHINE_GLOBALS_H_
-
-#ifdef _KERNEL
-#include <machine/globaldata.h>
-
-register struct globaldata *globalp __asm__("r13");
-
-#define GLOBALP globalp
-
-#define PCPU_GET(member) (GLOBALP->gd_ ## member)
-#define PCPU_PTR(member) (&GLOBALP->gd_ ## member)
-#define PCPU_SET(member,value) (GLOBALP->gd_ ## member = (value))
-
-#define curthread PCPU_GET(curthread)
-#define CURPROC (curthread->td_proc)
-#define curproc (curthread->td_proc)
-#define curksegrp (curthread->td_ksegrp)
-#define curkse (curthread->td_kse)
-
-#endif /* _KERNEL */
-
-#endif /* !_MACHINE_GLOBALS_H_ */
diff --git a/sys/ia64/include/mutex.h b/sys/ia64/include/mutex.h
index 6581d70..b14d7ae 100644
--- a/sys/ia64/include/mutex.h
+++ b/sys/ia64/include/mutex.h
@@ -49,7 +49,7 @@
*/
#define MTX_ENTER(lck, rPSR, rOLD, rNEW, rLCK) \
mov rPSR=psr ; \
- mov rNEW=globalp ; \
+ mov rNEW=pcpup ; \
addl rLCK=@ltoff(lck),gp ;; \
ld8 rLCK=[rLCK] ;; \
add rLCK=MTX_LOCK,rLCK ;; \
diff --git a/sys/ia64/include/pcpu.h b/sys/ia64/include/pcpu.h
index 4190c00..0c6111d 100644
--- a/sys/ia64/include/pcpu.h
+++ b/sys/ia64/include/pcpu.h
@@ -27,47 +27,25 @@
* $FreeBSD$
*/
-#ifndef _MACHINE_GLOBALDATA_H_
-#define _MACHINE_GLOBALDATA_H_
+#ifndef _MACHINE_PCPU_H_
+#define _MACHINE_PCPU_H_
#ifdef _KERNEL
-#include <sys/queue.h>
+#define PCPU_MD_FIELDS \
+ u_int64_t pc_pending_ipis; /* pending IPIs */ \
+ struct pmap *pc_current_pmap; /* active pmap */ \
+ u_int32_t pc_next_asn; /* next ASN to alloc */ \
+ u_int32_t pc_current_asngen /* ASN rollover check */
-/*
- * This structure maps out the global data that needs to be kept on a
- * per-cpu basis. genassym uses this to generate offsets for the assembler
- * code, which also provides external symbols so that C can get at them as
- * though they were really globals. This structure is pointed to by
- * the per-cpu system value (see alpha_pal_rdval() and alpha_pal_wrval()).
- * Inside the kernel, the globally reserved register t7 is used to
- * point at the globaldata structure.
- */
-struct globaldata {
- struct thread *gd_curthread; /* current thread */
- struct thread *gd_idlethread; /* idle thread */
- struct thread *gd_fpcurthread; /* fp state owner */
- struct pcb *gd_curpcb; /* current pcb */
- struct timeval gd_switchtime;
- int gd_switchticks;
- u_int gd_cpuid; /* this cpu number */
- u_int gd_other_cpus; /* all other cpus */
- u_int64_t gd_pending_ipis; /* pending IPI events */
- struct pmap *gd_current_pmap; /* which pmap is active */
- u_int32_t gd_next_asn; /* next ASN to allocate */
- u_int32_t gd_current_asngen; /* ASN rollover check */
+struct pcpu;
- SLIST_ENTRY(globaldata) gd_allcpu;
- struct lock_list_entry *gd_spinlocks;
-#ifdef KTR_PERCPU
- int gd_ktr_idx; /* Index into trace table */
- char *gd_ktr_buf;
- char gd_ktr_buf_data[0];
-#endif
-};
+register struct pcpu *pcpup __asm__("r13");
-void globaldata_init(struct globaldata *pcpu, int cpuid, size_t sz);
+#define PCPU_GET(member) (pcpup->pc_ ## member)
+#define PCPU_PTR(member) (&pcpup->pc_ ## member)
+#define PCPU_SET(member,value) (pcpup->pc_ ## member = (value))
#endif /* _KERNEL */
-#endif /* !_MACHINE_GLOBALDATA_H_ */
+#endif /* !_MACHINE_PCPU_H_ */
diff --git a/sys/ia64/include/proc.h b/sys/ia64/include/proc.h
index a9b6bfe..c9ae251 100644
--- a/sys/ia64/include/proc.h
+++ b/sys/ia64/include/proc.h
@@ -31,9 +31,6 @@
#ifndef _MACHINE_PROC_H_
#define _MACHINE_PROC_H_
-#include <machine/globaldata.h>
-#include <machine/globals.h>
-
/*
* Machine-dependent part of the proc struct for the Alpha.
*/
OpenPOWER on IntegriCloud