diff options
author | peter <peter@FreeBSD.org> | 1998-04-06 15:48:30 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1998-04-06 15:48:30 +0000 |
commit | 32a92c71b637e2d51d71d20da0945f9295f23059 (patch) | |
tree | 940a7e53b1bf2bb15c42d8e1f02c95dc80536bbc /sys | |
parent | 1a4b1c65502f06a93b8cba93485474e187943839 (diff) | |
download | FreeBSD-src-32a92c71b637e2d51d71d20da0945f9295f23059.zip FreeBSD-src-32a92c71b637e2d51d71d20da0945f9295f23059.tar.gz |
Use real types for the SMP pages being allocated rather than arrays of
ints. Remove some no longer needed casts. Initialize the per-cpu
global data area using the structs rather than knowing too much about
layout, alignment, etc.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/amd64/amd64/mp_machdep.c | 28 | ||||
-rw-r--r-- | sys/amd64/amd64/mptable.c | 28 | ||||
-rw-r--r-- | sys/amd64/include/mptable.h | 28 | ||||
-rw-r--r-- | sys/i386/i386/mp_machdep.c | 28 | ||||
-rw-r--r-- | sys/i386/i386/mptable.c | 28 | ||||
-rw-r--r-- | sys/i386/include/mptable.h | 28 | ||||
-rw-r--r-- | sys/kern/subr_smp.c | 28 |
7 files changed, 77 insertions, 119 deletions
diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index d658002..62f17ba 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mp_machdep.c,v 1.71 1998/04/01 21:07:35 tegge Exp $ + * $Id: mp_machdep.c,v 1.72 1998/04/06 08:25:30 phk Exp $ */ #include "opt_smp.h" @@ -66,6 +66,7 @@ #include <machine/tss.h> #include <machine/specialreg.h> #include <machine/cputypes.h> +#include <machine/globaldata.h> #include <i386/i386/cons.h> /* cngetc() */ @@ -1651,7 +1652,7 @@ start_all_aps(u_int boot_addr) u_long mpbioswarmvec; pd_entry_t *newptd; pt_entry_t *newpt; - int *newpp; + struct globaldata *gd; char *stack; pd_entry_t *myPTD; @@ -1704,10 +1705,10 @@ start_all_aps(u_int boot_addr) newptd[PTDPTDI] = (pd_entry_t)(PG_V | PG_RW | vtophys(newptd)); /* allocate a new private data page */ - newpp = (int *)kmem_alloc(kernel_map, PAGE_SIZE); + gd = (struct globaldata *)kmem_alloc(kernel_map, PAGE_SIZE); /* wire it into the private page table page */ - newpt[0] = (pt_entry_t)(PG_V | PG_RW | vtophys(newpp)); + newpt[0] = (pt_entry_t)(PG_V | PG_RW | vtophys(gd)); /* wire the ptp into itself for access */ newpt[1] = (pt_entry_t)(PG_V | PG_RW | vtophys(newpt)); @@ -1729,19 +1730,12 @@ start_all_aps(u_int boot_addr) newpt[5 + UPAGES] = 0; /* *prv_CMAP3 */ /* prime data page for it to use */ - newpp[0] = x; /* cpuid */ - newpp[1] = 0; /* curproc */ - newpp[2] = 0; /* curpcb */ - newpp[3] = 0; /* npxproc */ - newpp[4] = 0; /* runtime.tv_sec */ - newpp[5] = 0; /* runtime.tv_usec */ - newpp[6] = x << 24; /* cpu_lockid */ - newpp[7] = 0; /* other_cpus */ - newpp[8] = (int)myPTD; /* my_idlePTD */ - newpp[9] = 0; /* ss_tpr */ - newpp[10] = (int)&newpt[3 + UPAGES]; /* prv_CMAP1 */ - newpp[11] = (int)&newpt[4 + UPAGES]; /* prv_CMAP2 */ - newpp[12] = (int)&newpt[5 + UPAGES]; /* prv_CMAP3 */ + gd->cpuid = x; + gd->cpu_lockid = x << 24; + gd->my_idlePTD = myPTD; + gd->prv_CMAP1 = &newpt[3 + UPAGES]; + gd->prv_CMAP2 = &newpt[4 + UPAGES]; + gd->prv_CMAP3 = &newpt[5 + UPAGES]; /* setup a vector to our boot code */ *((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET; diff --git a/sys/amd64/amd64/mptable.c b/sys/amd64/amd64/mptable.c index d658002..62f17ba 100644 --- a/sys/amd64/amd64/mptable.c +++ b/sys/amd64/amd64/mptable.c @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mp_machdep.c,v 1.71 1998/04/01 21:07:35 tegge Exp $ + * $Id: mp_machdep.c,v 1.72 1998/04/06 08:25:30 phk Exp $ */ #include "opt_smp.h" @@ -66,6 +66,7 @@ #include <machine/tss.h> #include <machine/specialreg.h> #include <machine/cputypes.h> +#include <machine/globaldata.h> #include <i386/i386/cons.h> /* cngetc() */ @@ -1651,7 +1652,7 @@ start_all_aps(u_int boot_addr) u_long mpbioswarmvec; pd_entry_t *newptd; pt_entry_t *newpt; - int *newpp; + struct globaldata *gd; char *stack; pd_entry_t *myPTD; @@ -1704,10 +1705,10 @@ start_all_aps(u_int boot_addr) newptd[PTDPTDI] = (pd_entry_t)(PG_V | PG_RW | vtophys(newptd)); /* allocate a new private data page */ - newpp = (int *)kmem_alloc(kernel_map, PAGE_SIZE); + gd = (struct globaldata *)kmem_alloc(kernel_map, PAGE_SIZE); /* wire it into the private page table page */ - newpt[0] = (pt_entry_t)(PG_V | PG_RW | vtophys(newpp)); + newpt[0] = (pt_entry_t)(PG_V | PG_RW | vtophys(gd)); /* wire the ptp into itself for access */ newpt[1] = (pt_entry_t)(PG_V | PG_RW | vtophys(newpt)); @@ -1729,19 +1730,12 @@ start_all_aps(u_int boot_addr) newpt[5 + UPAGES] = 0; /* *prv_CMAP3 */ /* prime data page for it to use */ - newpp[0] = x; /* cpuid */ - newpp[1] = 0; /* curproc */ - newpp[2] = 0; /* curpcb */ - newpp[3] = 0; /* npxproc */ - newpp[4] = 0; /* runtime.tv_sec */ - newpp[5] = 0; /* runtime.tv_usec */ - newpp[6] = x << 24; /* cpu_lockid */ - newpp[7] = 0; /* other_cpus */ - newpp[8] = (int)myPTD; /* my_idlePTD */ - newpp[9] = 0; /* ss_tpr */ - newpp[10] = (int)&newpt[3 + UPAGES]; /* prv_CMAP1 */ - newpp[11] = (int)&newpt[4 + UPAGES]; /* prv_CMAP2 */ - newpp[12] = (int)&newpt[5 + UPAGES]; /* prv_CMAP3 */ + gd->cpuid = x; + gd->cpu_lockid = x << 24; + gd->my_idlePTD = myPTD; + gd->prv_CMAP1 = &newpt[3 + UPAGES]; + gd->prv_CMAP2 = &newpt[4 + UPAGES]; + gd->prv_CMAP3 = &newpt[5 + UPAGES]; /* setup a vector to our boot code */ *((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET; diff --git a/sys/amd64/include/mptable.h b/sys/amd64/include/mptable.h index d658002..62f17ba 100644 --- a/sys/amd64/include/mptable.h +++ b/sys/amd64/include/mptable.h @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mp_machdep.c,v 1.71 1998/04/01 21:07:35 tegge Exp $ + * $Id: mp_machdep.c,v 1.72 1998/04/06 08:25:30 phk Exp $ */ #include "opt_smp.h" @@ -66,6 +66,7 @@ #include <machine/tss.h> #include <machine/specialreg.h> #include <machine/cputypes.h> +#include <machine/globaldata.h> #include <i386/i386/cons.h> /* cngetc() */ @@ -1651,7 +1652,7 @@ start_all_aps(u_int boot_addr) u_long mpbioswarmvec; pd_entry_t *newptd; pt_entry_t *newpt; - int *newpp; + struct globaldata *gd; char *stack; pd_entry_t *myPTD; @@ -1704,10 +1705,10 @@ start_all_aps(u_int boot_addr) newptd[PTDPTDI] = (pd_entry_t)(PG_V | PG_RW | vtophys(newptd)); /* allocate a new private data page */ - newpp = (int *)kmem_alloc(kernel_map, PAGE_SIZE); + gd = (struct globaldata *)kmem_alloc(kernel_map, PAGE_SIZE); /* wire it into the private page table page */ - newpt[0] = (pt_entry_t)(PG_V | PG_RW | vtophys(newpp)); + newpt[0] = (pt_entry_t)(PG_V | PG_RW | vtophys(gd)); /* wire the ptp into itself for access */ newpt[1] = (pt_entry_t)(PG_V | PG_RW | vtophys(newpt)); @@ -1729,19 +1730,12 @@ start_all_aps(u_int boot_addr) newpt[5 + UPAGES] = 0; /* *prv_CMAP3 */ /* prime data page for it to use */ - newpp[0] = x; /* cpuid */ - newpp[1] = 0; /* curproc */ - newpp[2] = 0; /* curpcb */ - newpp[3] = 0; /* npxproc */ - newpp[4] = 0; /* runtime.tv_sec */ - newpp[5] = 0; /* runtime.tv_usec */ - newpp[6] = x << 24; /* cpu_lockid */ - newpp[7] = 0; /* other_cpus */ - newpp[8] = (int)myPTD; /* my_idlePTD */ - newpp[9] = 0; /* ss_tpr */ - newpp[10] = (int)&newpt[3 + UPAGES]; /* prv_CMAP1 */ - newpp[11] = (int)&newpt[4 + UPAGES]; /* prv_CMAP2 */ - newpp[12] = (int)&newpt[5 + UPAGES]; /* prv_CMAP3 */ + gd->cpuid = x; + gd->cpu_lockid = x << 24; + gd->my_idlePTD = myPTD; + gd->prv_CMAP1 = &newpt[3 + UPAGES]; + gd->prv_CMAP2 = &newpt[4 + UPAGES]; + gd->prv_CMAP3 = &newpt[5 + UPAGES]; /* setup a vector to our boot code */ *((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET; diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index d658002..62f17ba 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mp_machdep.c,v 1.71 1998/04/01 21:07:35 tegge Exp $ + * $Id: mp_machdep.c,v 1.72 1998/04/06 08:25:30 phk Exp $ */ #include "opt_smp.h" @@ -66,6 +66,7 @@ #include <machine/tss.h> #include <machine/specialreg.h> #include <machine/cputypes.h> +#include <machine/globaldata.h> #include <i386/i386/cons.h> /* cngetc() */ @@ -1651,7 +1652,7 @@ start_all_aps(u_int boot_addr) u_long mpbioswarmvec; pd_entry_t *newptd; pt_entry_t *newpt; - int *newpp; + struct globaldata *gd; char *stack; pd_entry_t *myPTD; @@ -1704,10 +1705,10 @@ start_all_aps(u_int boot_addr) newptd[PTDPTDI] = (pd_entry_t)(PG_V | PG_RW | vtophys(newptd)); /* allocate a new private data page */ - newpp = (int *)kmem_alloc(kernel_map, PAGE_SIZE); + gd = (struct globaldata *)kmem_alloc(kernel_map, PAGE_SIZE); /* wire it into the private page table page */ - newpt[0] = (pt_entry_t)(PG_V | PG_RW | vtophys(newpp)); + newpt[0] = (pt_entry_t)(PG_V | PG_RW | vtophys(gd)); /* wire the ptp into itself for access */ newpt[1] = (pt_entry_t)(PG_V | PG_RW | vtophys(newpt)); @@ -1729,19 +1730,12 @@ start_all_aps(u_int boot_addr) newpt[5 + UPAGES] = 0; /* *prv_CMAP3 */ /* prime data page for it to use */ - newpp[0] = x; /* cpuid */ - newpp[1] = 0; /* curproc */ - newpp[2] = 0; /* curpcb */ - newpp[3] = 0; /* npxproc */ - newpp[4] = 0; /* runtime.tv_sec */ - newpp[5] = 0; /* runtime.tv_usec */ - newpp[6] = x << 24; /* cpu_lockid */ - newpp[7] = 0; /* other_cpus */ - newpp[8] = (int)myPTD; /* my_idlePTD */ - newpp[9] = 0; /* ss_tpr */ - newpp[10] = (int)&newpt[3 + UPAGES]; /* prv_CMAP1 */ - newpp[11] = (int)&newpt[4 + UPAGES]; /* prv_CMAP2 */ - newpp[12] = (int)&newpt[5 + UPAGES]; /* prv_CMAP3 */ + gd->cpuid = x; + gd->cpu_lockid = x << 24; + gd->my_idlePTD = myPTD; + gd->prv_CMAP1 = &newpt[3 + UPAGES]; + gd->prv_CMAP2 = &newpt[4 + UPAGES]; + gd->prv_CMAP3 = &newpt[5 + UPAGES]; /* setup a vector to our boot code */ *((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET; diff --git a/sys/i386/i386/mptable.c b/sys/i386/i386/mptable.c index d658002..62f17ba 100644 --- a/sys/i386/i386/mptable.c +++ b/sys/i386/i386/mptable.c @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mp_machdep.c,v 1.71 1998/04/01 21:07:35 tegge Exp $ + * $Id: mp_machdep.c,v 1.72 1998/04/06 08:25:30 phk Exp $ */ #include "opt_smp.h" @@ -66,6 +66,7 @@ #include <machine/tss.h> #include <machine/specialreg.h> #include <machine/cputypes.h> +#include <machine/globaldata.h> #include <i386/i386/cons.h> /* cngetc() */ @@ -1651,7 +1652,7 @@ start_all_aps(u_int boot_addr) u_long mpbioswarmvec; pd_entry_t *newptd; pt_entry_t *newpt; - int *newpp; + struct globaldata *gd; char *stack; pd_entry_t *myPTD; @@ -1704,10 +1705,10 @@ start_all_aps(u_int boot_addr) newptd[PTDPTDI] = (pd_entry_t)(PG_V | PG_RW | vtophys(newptd)); /* allocate a new private data page */ - newpp = (int *)kmem_alloc(kernel_map, PAGE_SIZE); + gd = (struct globaldata *)kmem_alloc(kernel_map, PAGE_SIZE); /* wire it into the private page table page */ - newpt[0] = (pt_entry_t)(PG_V | PG_RW | vtophys(newpp)); + newpt[0] = (pt_entry_t)(PG_V | PG_RW | vtophys(gd)); /* wire the ptp into itself for access */ newpt[1] = (pt_entry_t)(PG_V | PG_RW | vtophys(newpt)); @@ -1729,19 +1730,12 @@ start_all_aps(u_int boot_addr) newpt[5 + UPAGES] = 0; /* *prv_CMAP3 */ /* prime data page for it to use */ - newpp[0] = x; /* cpuid */ - newpp[1] = 0; /* curproc */ - newpp[2] = 0; /* curpcb */ - newpp[3] = 0; /* npxproc */ - newpp[4] = 0; /* runtime.tv_sec */ - newpp[5] = 0; /* runtime.tv_usec */ - newpp[6] = x << 24; /* cpu_lockid */ - newpp[7] = 0; /* other_cpus */ - newpp[8] = (int)myPTD; /* my_idlePTD */ - newpp[9] = 0; /* ss_tpr */ - newpp[10] = (int)&newpt[3 + UPAGES]; /* prv_CMAP1 */ - newpp[11] = (int)&newpt[4 + UPAGES]; /* prv_CMAP2 */ - newpp[12] = (int)&newpt[5 + UPAGES]; /* prv_CMAP3 */ + gd->cpuid = x; + gd->cpu_lockid = x << 24; + gd->my_idlePTD = myPTD; + gd->prv_CMAP1 = &newpt[3 + UPAGES]; + gd->prv_CMAP2 = &newpt[4 + UPAGES]; + gd->prv_CMAP3 = &newpt[5 + UPAGES]; /* setup a vector to our boot code */ *((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET; diff --git a/sys/i386/include/mptable.h b/sys/i386/include/mptable.h index d658002..62f17ba 100644 --- a/sys/i386/include/mptable.h +++ b/sys/i386/include/mptable.h @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mp_machdep.c,v 1.71 1998/04/01 21:07:35 tegge Exp $ + * $Id: mp_machdep.c,v 1.72 1998/04/06 08:25:30 phk Exp $ */ #include "opt_smp.h" @@ -66,6 +66,7 @@ #include <machine/tss.h> #include <machine/specialreg.h> #include <machine/cputypes.h> +#include <machine/globaldata.h> #include <i386/i386/cons.h> /* cngetc() */ @@ -1651,7 +1652,7 @@ start_all_aps(u_int boot_addr) u_long mpbioswarmvec; pd_entry_t *newptd; pt_entry_t *newpt; - int *newpp; + struct globaldata *gd; char *stack; pd_entry_t *myPTD; @@ -1704,10 +1705,10 @@ start_all_aps(u_int boot_addr) newptd[PTDPTDI] = (pd_entry_t)(PG_V | PG_RW | vtophys(newptd)); /* allocate a new private data page */ - newpp = (int *)kmem_alloc(kernel_map, PAGE_SIZE); + gd = (struct globaldata *)kmem_alloc(kernel_map, PAGE_SIZE); /* wire it into the private page table page */ - newpt[0] = (pt_entry_t)(PG_V | PG_RW | vtophys(newpp)); + newpt[0] = (pt_entry_t)(PG_V | PG_RW | vtophys(gd)); /* wire the ptp into itself for access */ newpt[1] = (pt_entry_t)(PG_V | PG_RW | vtophys(newpt)); @@ -1729,19 +1730,12 @@ start_all_aps(u_int boot_addr) newpt[5 + UPAGES] = 0; /* *prv_CMAP3 */ /* prime data page for it to use */ - newpp[0] = x; /* cpuid */ - newpp[1] = 0; /* curproc */ - newpp[2] = 0; /* curpcb */ - newpp[3] = 0; /* npxproc */ - newpp[4] = 0; /* runtime.tv_sec */ - newpp[5] = 0; /* runtime.tv_usec */ - newpp[6] = x << 24; /* cpu_lockid */ - newpp[7] = 0; /* other_cpus */ - newpp[8] = (int)myPTD; /* my_idlePTD */ - newpp[9] = 0; /* ss_tpr */ - newpp[10] = (int)&newpt[3 + UPAGES]; /* prv_CMAP1 */ - newpp[11] = (int)&newpt[4 + UPAGES]; /* prv_CMAP2 */ - newpp[12] = (int)&newpt[5 + UPAGES]; /* prv_CMAP3 */ + gd->cpuid = x; + gd->cpu_lockid = x << 24; + gd->my_idlePTD = myPTD; + gd->prv_CMAP1 = &newpt[3 + UPAGES]; + gd->prv_CMAP2 = &newpt[4 + UPAGES]; + gd->prv_CMAP3 = &newpt[5 + UPAGES]; /* setup a vector to our boot code */ *((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET; diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c index d658002..62f17ba 100644 --- a/sys/kern/subr_smp.c +++ b/sys/kern/subr_smp.c @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: mp_machdep.c,v 1.71 1998/04/01 21:07:35 tegge Exp $ + * $Id: mp_machdep.c,v 1.72 1998/04/06 08:25:30 phk Exp $ */ #include "opt_smp.h" @@ -66,6 +66,7 @@ #include <machine/tss.h> #include <machine/specialreg.h> #include <machine/cputypes.h> +#include <machine/globaldata.h> #include <i386/i386/cons.h> /* cngetc() */ @@ -1651,7 +1652,7 @@ start_all_aps(u_int boot_addr) u_long mpbioswarmvec; pd_entry_t *newptd; pt_entry_t *newpt; - int *newpp; + struct globaldata *gd; char *stack; pd_entry_t *myPTD; @@ -1704,10 +1705,10 @@ start_all_aps(u_int boot_addr) newptd[PTDPTDI] = (pd_entry_t)(PG_V | PG_RW | vtophys(newptd)); /* allocate a new private data page */ - newpp = (int *)kmem_alloc(kernel_map, PAGE_SIZE); + gd = (struct globaldata *)kmem_alloc(kernel_map, PAGE_SIZE); /* wire it into the private page table page */ - newpt[0] = (pt_entry_t)(PG_V | PG_RW | vtophys(newpp)); + newpt[0] = (pt_entry_t)(PG_V | PG_RW | vtophys(gd)); /* wire the ptp into itself for access */ newpt[1] = (pt_entry_t)(PG_V | PG_RW | vtophys(newpt)); @@ -1729,19 +1730,12 @@ start_all_aps(u_int boot_addr) newpt[5 + UPAGES] = 0; /* *prv_CMAP3 */ /* prime data page for it to use */ - newpp[0] = x; /* cpuid */ - newpp[1] = 0; /* curproc */ - newpp[2] = 0; /* curpcb */ - newpp[3] = 0; /* npxproc */ - newpp[4] = 0; /* runtime.tv_sec */ - newpp[5] = 0; /* runtime.tv_usec */ - newpp[6] = x << 24; /* cpu_lockid */ - newpp[7] = 0; /* other_cpus */ - newpp[8] = (int)myPTD; /* my_idlePTD */ - newpp[9] = 0; /* ss_tpr */ - newpp[10] = (int)&newpt[3 + UPAGES]; /* prv_CMAP1 */ - newpp[11] = (int)&newpt[4 + UPAGES]; /* prv_CMAP2 */ - newpp[12] = (int)&newpt[5 + UPAGES]; /* prv_CMAP3 */ + gd->cpuid = x; + gd->cpu_lockid = x << 24; + gd->my_idlePTD = myPTD; + gd->prv_CMAP1 = &newpt[3 + UPAGES]; + gd->prv_CMAP2 = &newpt[4 + UPAGES]; + gd->prv_CMAP3 = &newpt[5 + UPAGES]; /* setup a vector to our boot code */ *((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET; |