diff options
author | jhb <jhb@FreeBSD.org> | 2001-12-11 23:33:44 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-12-11 23:33:44 +0000 |
commit | 21b6b26912b00bb37f9f16080ba7d49241814935 (patch) | |
tree | c785835e70070309148a72c55669ff0bf043a20a /sys/pc98 | |
parent | 279222ba62c185d7d7ec09017bb3e7760fd333f0 (diff) | |
download | FreeBSD-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/pc98')
-rw-r--r-- | sys/pc98/i386/machdep.c | 17 | ||||
-rw-r--r-- | sys/pc98/pc98/machdep.c | 17 |
2 files changed, 16 insertions, 18 deletions
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index 6c05881..f1775ad 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -104,7 +104,6 @@ #include <machine/pc/bios.h> #include <machine/pcb_ext.h> /* pcb.h included via sys/user.h */ #include <machine/proc.h> -#include <machine/globals.h> #ifdef PERFMON #include <machine/perfmon.h> #endif @@ -220,7 +219,7 @@ struct kva_md_info kmi; static struct trapframe proc0_tf; #ifndef SMP -static struct globaldata __globaldata; +static struct pcpu __pcpu; #endif struct mtx sched_lock; @@ -275,7 +274,7 @@ cpu_startup(dummy) bufinit(); vm_pager_bufferinit(); - globaldata_register(GLOBALDATA); + pcpu_init(GLOBALDATA, 0, sizeof(struct pcpu)); #ifndef SMP /* For SMP, we delay the cpu_setregs() until after SMP startup. */ cpu_setregs(); @@ -1774,15 +1773,15 @@ init386(first) atop(sizeof(struct privatespace) - 1); gdt_segs[GPRIV_SEL].ssd_base = (int) &SMP_prvspace[0]; gdt_segs[GPROC0_SEL].ssd_base = - (int) &SMP_prvspace[0].globaldata.gd_common_tss; - SMP_prvspace[0].globaldata.gd_prvspace = &SMP_prvspace[0].globaldata; + (int) &SMP_prvspace[0].pcpu.pc_common_tss; + SMP_prvspace[0].pcpu.pc_prvspace = &SMP_prvspace[0].pcpu; #else gdt_segs[GPRIV_SEL].ssd_limit = - atop(sizeof(struct globaldata) - 1); - gdt_segs[GPRIV_SEL].ssd_base = (int) &__globaldata; + atop(sizeof(struct pcpu) - 1); + gdt_segs[GPRIV_SEL].ssd_base = (int) &__pcpu; gdt_segs[GPROC0_SEL].ssd_base = - (int) &__globaldata.gd_common_tss; - __globaldata.gd_prvspace = &__globaldata; + (int) &__pcpu.pc_common_tss; + __pcpu.pc_prvspace = &__pcpu; #endif for (x = 0; x < NGDT; x++) { diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 6c05881..f1775ad 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -104,7 +104,6 @@ #include <machine/pc/bios.h> #include <machine/pcb_ext.h> /* pcb.h included via sys/user.h */ #include <machine/proc.h> -#include <machine/globals.h> #ifdef PERFMON #include <machine/perfmon.h> #endif @@ -220,7 +219,7 @@ struct kva_md_info kmi; static struct trapframe proc0_tf; #ifndef SMP -static struct globaldata __globaldata; +static struct pcpu __pcpu; #endif struct mtx sched_lock; @@ -275,7 +274,7 @@ cpu_startup(dummy) bufinit(); vm_pager_bufferinit(); - globaldata_register(GLOBALDATA); + pcpu_init(GLOBALDATA, 0, sizeof(struct pcpu)); #ifndef SMP /* For SMP, we delay the cpu_setregs() until after SMP startup. */ cpu_setregs(); @@ -1774,15 +1773,15 @@ init386(first) atop(sizeof(struct privatespace) - 1); gdt_segs[GPRIV_SEL].ssd_base = (int) &SMP_prvspace[0]; gdt_segs[GPROC0_SEL].ssd_base = - (int) &SMP_prvspace[0].globaldata.gd_common_tss; - SMP_prvspace[0].globaldata.gd_prvspace = &SMP_prvspace[0].globaldata; + (int) &SMP_prvspace[0].pcpu.pc_common_tss; + SMP_prvspace[0].pcpu.pc_prvspace = &SMP_prvspace[0].pcpu; #else gdt_segs[GPRIV_SEL].ssd_limit = - atop(sizeof(struct globaldata) - 1); - gdt_segs[GPRIV_SEL].ssd_base = (int) &__globaldata; + atop(sizeof(struct pcpu) - 1); + gdt_segs[GPRIV_SEL].ssd_base = (int) &__pcpu; gdt_segs[GPROC0_SEL].ssd_base = - (int) &__globaldata.gd_common_tss; - __globaldata.gd_prvspace = &__globaldata; + (int) &__pcpu.pc_common_tss; + __pcpu.pc_prvspace = &__pcpu; #endif for (x = 0; x < NGDT; x++) { |