mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-16 10:20:30 +00:00
Add support for more than 1 page of idle process stack on SMP systems.
This commit is contained in:
parent
804cd17e21
commit
a65247e12c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=29655
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
|
||||
* $Id: locore.s,v 1.5 1997/09/02 04:38:32 smp Exp smp $
|
||||
* $Id: locore.s,v 1.97 1997/09/07 22:03:46 fsmp Exp $
|
||||
*
|
||||
* originally from: locore.s, by William F. Jolitz
|
||||
*
|
||||
@ -96,10 +96,10 @@
|
||||
.set _SMP_prvpt,_SMP_prvstart + PAGE_SIZE
|
||||
.set _lapic,_SMP_prvstart + (2 * PAGE_SIZE)
|
||||
.set _idlestack,_SMP_prvstart + (3 * PAGE_SIZE)
|
||||
.set _idlestack_top,_SMP_prvstart + (4 * PAGE_SIZE)
|
||||
.set _prv_CPAGE1,_SMP_prvstart + (4 * PAGE_SIZE)
|
||||
.set _prv_CPAGE2,_SMP_prvstart + (5 * PAGE_SIZE)
|
||||
.set _prv_CPAGE3,_SMP_prvstart + (6 * PAGE_SIZE)
|
||||
.set _idlestack_top,_SMP_prvstart + (5 * PAGE_SIZE)
|
||||
.set _prv_CPAGE1,_SMP_prvstart + (5 * PAGE_SIZE)
|
||||
.set _prv_CPAGE2,_SMP_prvstart + (6 * PAGE_SIZE)
|
||||
.set _prv_CPAGE3,_SMP_prvstart + (7 * PAGE_SIZE)
|
||||
.set _SMP_ioapic,_SMP_prvstart + (16 * PAGE_SIZE)
|
||||
|
||||
.globl _cpuid,_curproc,_curpcb,_npxproc,_runtime,_cpu_lockid
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
|
||||
* $Id: locore.s,v 1.5 1997/09/02 04:38:32 smp Exp smp $
|
||||
* $Id: locore.s,v 1.97 1997/09/07 22:03:46 fsmp Exp $
|
||||
*
|
||||
* originally from: locore.s, by William F. Jolitz
|
||||
*
|
||||
@ -96,10 +96,10 @@
|
||||
.set _SMP_prvpt,_SMP_prvstart + PAGE_SIZE
|
||||
.set _lapic,_SMP_prvstart + (2 * PAGE_SIZE)
|
||||
.set _idlestack,_SMP_prvstart + (3 * PAGE_SIZE)
|
||||
.set _idlestack_top,_SMP_prvstart + (4 * PAGE_SIZE)
|
||||
.set _prv_CPAGE1,_SMP_prvstart + (4 * PAGE_SIZE)
|
||||
.set _prv_CPAGE2,_SMP_prvstart + (5 * PAGE_SIZE)
|
||||
.set _prv_CPAGE3,_SMP_prvstart + (6 * PAGE_SIZE)
|
||||
.set _idlestack_top,_SMP_prvstart + (5 * PAGE_SIZE)
|
||||
.set _prv_CPAGE1,_SMP_prvstart + (5 * PAGE_SIZE)
|
||||
.set _prv_CPAGE2,_SMP_prvstart + (6 * PAGE_SIZE)
|
||||
.set _prv_CPAGE3,_SMP_prvstart + (7 * PAGE_SIZE)
|
||||
.set _SMP_ioapic,_SMP_prvstart + (16 * PAGE_SIZE)
|
||||
|
||||
.globl _cpuid,_curproc,_curpcb,_npxproc,_runtime,_cpu_lockid
|
||||
|
@ -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.38 1997/09/05 20:23:34 smp Exp smp $
|
||||
* $Id: mp_machdep.c,v 1.52 1997/09/07 22:03:59 fsmp Exp $
|
||||
*/
|
||||
|
||||
#include "opt_smp.h"
|
||||
@ -222,6 +222,7 @@ int mp_napics; /* # of IO APICs */
|
||||
int boot_cpu_id; /* designated BSP */
|
||||
vm_offset_t cpu_apic_address;
|
||||
vm_offset_t io_apic_address[NAPICID]; /* NAPICID is more than enough */
|
||||
extern int nkpt;
|
||||
|
||||
u_int32_t cpu_apic_versions[NCPU];
|
||||
u_int32_t io_apic_versions[NAPIC];
|
||||
@ -1510,7 +1511,9 @@ start_all_aps(u_int boot_addr)
|
||||
u_long mpbioswarmvec;
|
||||
pd_entry_t *newptd;
|
||||
pt_entry_t *newpt;
|
||||
int *newpp, *stack;
|
||||
int *newpp;
|
||||
char *stack;
|
||||
pd_entry_t *myPTD;
|
||||
|
||||
POSTCODE(START_ALL_APS_POST);
|
||||
|
||||
@ -1549,7 +1552,7 @@ start_all_aps(u_int boot_addr)
|
||||
((u_long)KPTphys & PG_FRAME));
|
||||
|
||||
/* store PTD for this AP's boot sequence */
|
||||
bootPTD = (pd_entry_t *)vtophys(newptd);
|
||||
myPTD = (pd_entry_t *)vtophys(newptd);
|
||||
|
||||
/* alloc new page table page */
|
||||
newpt = (pt_entry_t *)(kmem_alloc(kernel_map, PAGE_SIZE));
|
||||
@ -1577,12 +1580,13 @@ start_all_aps(u_int boot_addr)
|
||||
newpt[i] = SMP_prvpt[i];
|
||||
|
||||
/* allocate and set up an idle stack data page */
|
||||
stack = (int *)kmem_alloc(kernel_map, PAGE_SIZE);
|
||||
newpt[3] = (pt_entry_t)(PG_V | PG_RW | vtophys(stack));
|
||||
stack = (char *)kmem_alloc(kernel_map, UPAGES*PAGE_SIZE);
|
||||
for (i = 0; i < UPAGES; i++)
|
||||
newpt[i + 3] = (pt_entry_t)(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
newpt[4] = 0; /* *prv_CMAP1 */
|
||||
newpt[5] = 0; /* *prv_CMAP2 */
|
||||
newpt[6] = 0; /* *prv_CMAP3 */
|
||||
newpt[5] = 0; /* *prv_CMAP1 */
|
||||
newpt[6] = 0; /* *prv_CMAP2 */
|
||||
newpt[7] = 0; /* *prv_CMAP3 */
|
||||
|
||||
/* prime data page for it to use */
|
||||
newpp[0] = x; /* cpuid */
|
||||
@ -1593,11 +1597,11 @@ start_all_aps(u_int boot_addr)
|
||||
newpp[5] = 0; /* runtime.tv_usec */
|
||||
newpp[6] = x << 24; /* cpu_lockid */
|
||||
newpp[7] = 0; /* other_cpus */
|
||||
newpp[8] = (int)bootPTD; /* my_idlePTD */
|
||||
newpp[8] = (int)myPTD; /* my_idlePTD */
|
||||
newpp[9] = 0; /* ss_tpr */
|
||||
newpp[10] = (int)&newpt[4]; /* prv_CMAP1 */
|
||||
newpp[11] = (int)&newpt[5]; /* prv_CMAP2 */
|
||||
newpp[12] = (int)&newpt[6]; /* prv_CMAP3 */
|
||||
newpp[10] = (int)&newpt[5]; /* prv_CMAP1 */
|
||||
newpp[11] = (int)&newpt[6]; /* prv_CMAP2 */
|
||||
newpp[12] = (int)&newpt[7]; /* prv_CMAP3 */
|
||||
|
||||
/* setup a vector to our boot code */
|
||||
*((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET;
|
||||
@ -1605,6 +1609,7 @@ start_all_aps(u_int boot_addr)
|
||||
outb(CMOS_REG, BIOS_RESET);
|
||||
outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */
|
||||
|
||||
bootPTD = myPTD;
|
||||
/* attempt to start the Application Processor */
|
||||
CHECK_INIT(99); /* setup checkpoints */
|
||||
if (!start_ap(x, boot_addr)) {
|
||||
@ -1651,11 +1656,16 @@ start_all_aps(u_int boot_addr)
|
||||
my_idlePTD = (pd_entry_t *)vtophys(newptd);
|
||||
|
||||
/* Allocate and setup BSP idle stack */
|
||||
stack = (int *)kmem_alloc(kernel_map, PAGE_SIZE);
|
||||
SMP_prvpt[3] = (pt_entry_t)(PG_V | PG_RW | vtophys(stack));
|
||||
stack = (char *)kmem_alloc(kernel_map, UPAGES * PAGE_SIZE);
|
||||
for (i = 0; i < UPAGES; i++)
|
||||
SMP_prvpt[i + 3] = (pt_entry_t)(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
pmap_set_opt_bsp();
|
||||
|
||||
for (i = 0; i < mp_ncpus; i++) {
|
||||
bcopy( (int *) PTD + KPTDI, (int *) IdlePTDS[i] + KPTDI, NKPDE * sizeof (int));
|
||||
}
|
||||
|
||||
/* number of APs actually started */
|
||||
return mp_ncpus - 1;
|
||||
}
|
||||
|
@ -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.38 1997/09/05 20:23:34 smp Exp smp $
|
||||
* $Id: mp_machdep.c,v 1.52 1997/09/07 22:03:59 fsmp Exp $
|
||||
*/
|
||||
|
||||
#include "opt_smp.h"
|
||||
@ -222,6 +222,7 @@ int mp_napics; /* # of IO APICs */
|
||||
int boot_cpu_id; /* designated BSP */
|
||||
vm_offset_t cpu_apic_address;
|
||||
vm_offset_t io_apic_address[NAPICID]; /* NAPICID is more than enough */
|
||||
extern int nkpt;
|
||||
|
||||
u_int32_t cpu_apic_versions[NCPU];
|
||||
u_int32_t io_apic_versions[NAPIC];
|
||||
@ -1510,7 +1511,9 @@ start_all_aps(u_int boot_addr)
|
||||
u_long mpbioswarmvec;
|
||||
pd_entry_t *newptd;
|
||||
pt_entry_t *newpt;
|
||||
int *newpp, *stack;
|
||||
int *newpp;
|
||||
char *stack;
|
||||
pd_entry_t *myPTD;
|
||||
|
||||
POSTCODE(START_ALL_APS_POST);
|
||||
|
||||
@ -1549,7 +1552,7 @@ start_all_aps(u_int boot_addr)
|
||||
((u_long)KPTphys & PG_FRAME));
|
||||
|
||||
/* store PTD for this AP's boot sequence */
|
||||
bootPTD = (pd_entry_t *)vtophys(newptd);
|
||||
myPTD = (pd_entry_t *)vtophys(newptd);
|
||||
|
||||
/* alloc new page table page */
|
||||
newpt = (pt_entry_t *)(kmem_alloc(kernel_map, PAGE_SIZE));
|
||||
@ -1577,12 +1580,13 @@ start_all_aps(u_int boot_addr)
|
||||
newpt[i] = SMP_prvpt[i];
|
||||
|
||||
/* allocate and set up an idle stack data page */
|
||||
stack = (int *)kmem_alloc(kernel_map, PAGE_SIZE);
|
||||
newpt[3] = (pt_entry_t)(PG_V | PG_RW | vtophys(stack));
|
||||
stack = (char *)kmem_alloc(kernel_map, UPAGES*PAGE_SIZE);
|
||||
for (i = 0; i < UPAGES; i++)
|
||||
newpt[i + 3] = (pt_entry_t)(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
newpt[4] = 0; /* *prv_CMAP1 */
|
||||
newpt[5] = 0; /* *prv_CMAP2 */
|
||||
newpt[6] = 0; /* *prv_CMAP3 */
|
||||
newpt[5] = 0; /* *prv_CMAP1 */
|
||||
newpt[6] = 0; /* *prv_CMAP2 */
|
||||
newpt[7] = 0; /* *prv_CMAP3 */
|
||||
|
||||
/* prime data page for it to use */
|
||||
newpp[0] = x; /* cpuid */
|
||||
@ -1593,11 +1597,11 @@ start_all_aps(u_int boot_addr)
|
||||
newpp[5] = 0; /* runtime.tv_usec */
|
||||
newpp[6] = x << 24; /* cpu_lockid */
|
||||
newpp[7] = 0; /* other_cpus */
|
||||
newpp[8] = (int)bootPTD; /* my_idlePTD */
|
||||
newpp[8] = (int)myPTD; /* my_idlePTD */
|
||||
newpp[9] = 0; /* ss_tpr */
|
||||
newpp[10] = (int)&newpt[4]; /* prv_CMAP1 */
|
||||
newpp[11] = (int)&newpt[5]; /* prv_CMAP2 */
|
||||
newpp[12] = (int)&newpt[6]; /* prv_CMAP3 */
|
||||
newpp[10] = (int)&newpt[5]; /* prv_CMAP1 */
|
||||
newpp[11] = (int)&newpt[6]; /* prv_CMAP2 */
|
||||
newpp[12] = (int)&newpt[7]; /* prv_CMAP3 */
|
||||
|
||||
/* setup a vector to our boot code */
|
||||
*((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET;
|
||||
@ -1605,6 +1609,7 @@ start_all_aps(u_int boot_addr)
|
||||
outb(CMOS_REG, BIOS_RESET);
|
||||
outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */
|
||||
|
||||
bootPTD = myPTD;
|
||||
/* attempt to start the Application Processor */
|
||||
CHECK_INIT(99); /* setup checkpoints */
|
||||
if (!start_ap(x, boot_addr)) {
|
||||
@ -1651,11 +1656,16 @@ start_all_aps(u_int boot_addr)
|
||||
my_idlePTD = (pd_entry_t *)vtophys(newptd);
|
||||
|
||||
/* Allocate and setup BSP idle stack */
|
||||
stack = (int *)kmem_alloc(kernel_map, PAGE_SIZE);
|
||||
SMP_prvpt[3] = (pt_entry_t)(PG_V | PG_RW | vtophys(stack));
|
||||
stack = (char *)kmem_alloc(kernel_map, UPAGES * PAGE_SIZE);
|
||||
for (i = 0; i < UPAGES; i++)
|
||||
SMP_prvpt[i + 3] = (pt_entry_t)(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
pmap_set_opt_bsp();
|
||||
|
||||
for (i = 0; i < mp_ncpus; i++) {
|
||||
bcopy( (int *) PTD + KPTDI, (int *) IdlePTDS[i] + KPTDI, NKPDE * sizeof (int));
|
||||
}
|
||||
|
||||
/* number of APs actually started */
|
||||
return mp_ncpus - 1;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)pmap.c 7.7 (Berkeley) 5/12/91
|
||||
* $Id: pmap.c,v 1.160 1997/08/26 18:10:32 peter Exp $
|
||||
* $Id: pmap.c,v 1.161 1997/09/07 01:15:13 dyson Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -146,6 +146,7 @@ static int protection_codes[8];
|
||||
|
||||
static struct pmap kernel_pmap_store;
|
||||
pmap_t kernel_pmap;
|
||||
extern pd_entry_t my_idlePTD;
|
||||
|
||||
vm_offset_t avail_start; /* PA of first available physical page */
|
||||
vm_offset_t avail_end; /* PA of last available physical page */
|
||||
@ -157,8 +158,7 @@ int pgeflag; /* PG_G or-in */
|
||||
int pseflag; /* PG_PS or-in */
|
||||
int pv_npg;
|
||||
|
||||
static int nkpt;
|
||||
static vm_page_t nkpg;
|
||||
int nkpt;
|
||||
vm_offset_t kernel_vm_end;
|
||||
|
||||
extern vm_offset_t clean_sva, clean_eva;
|
||||
@ -438,9 +438,9 @@ pmap_bootstrap(firstaddr, loadaddr)
|
||||
}
|
||||
|
||||
/* BSP does this itself, AP's get it pre-set */
|
||||
prv_CMAP1 = (pt_entry_t *)&SMP_prvpt[4];
|
||||
prv_CMAP2 = (pt_entry_t *)&SMP_prvpt[5];
|
||||
prv_CMAP3 = (pt_entry_t *)&SMP_prvpt[6];
|
||||
prv_CMAP1 = (pt_entry_t *)&SMP_prvpt[5];
|
||||
prv_CMAP2 = (pt_entry_t *)&SMP_prvpt[6];
|
||||
prv_CMAP3 = (pt_entry_t *)&SMP_prvpt[7];
|
||||
#endif
|
||||
|
||||
invltlb();
|
||||
@ -1427,9 +1427,13 @@ pmap_growkernel(vm_offset_t addr)
|
||||
struct proc *p;
|
||||
struct pmap *pmap;
|
||||
int s;
|
||||
vm_offset_t ptpkva, ptppaddr;
|
||||
vm_page_t nkpg;
|
||||
#ifdef SMP
|
||||
int i;
|
||||
#endif
|
||||
pd_entry_t newpdir;
|
||||
vm_pindex_t ptpidx;
|
||||
|
||||
s = splhigh();
|
||||
if (kernel_vm_end == 0) {
|
||||
@ -1447,38 +1451,37 @@ pmap_growkernel(vm_offset_t addr)
|
||||
continue;
|
||||
}
|
||||
++nkpt;
|
||||
if (!nkpg) {
|
||||
vm_offset_t ptpkva = (vm_offset_t) vtopte(addr);
|
||||
/*
|
||||
* This index is bogus, but out of the way
|
||||
*/
|
||||
vm_pindex_t ptpidx = (ptpkva >> PAGE_SHIFT);
|
||||
nkpg = vm_page_alloc(kernel_object,
|
||||
ptpidx, VM_ALLOC_SYSTEM);
|
||||
if (!nkpg)
|
||||
panic("pmap_growkernel: no memory to grow kernel");
|
||||
vm_page_wire(nkpg);
|
||||
vm_page_remove(nkpg);
|
||||
pmap_zero_page(VM_PAGE_TO_PHYS(nkpg));
|
||||
}
|
||||
pdir_pde(PTD, kernel_vm_end) = (pd_entry_t) (VM_PAGE_TO_PHYS(nkpg) | PG_V | PG_RW | pgeflag);
|
||||
ptpkva = (vm_offset_t) vtopte(addr);
|
||||
ptpidx = (ptpkva >> PAGE_SHIFT);
|
||||
/*
|
||||
* This index is bogus, but out of the way
|
||||
*/
|
||||
nkpg = vm_page_alloc(kernel_object,
|
||||
ptpidx, VM_ALLOC_SYSTEM);
|
||||
if (!nkpg)
|
||||
panic("pmap_growkernel: no memory to grow kernel");
|
||||
|
||||
vm_page_wire(nkpg);
|
||||
vm_page_remove(nkpg);
|
||||
ptppaddr = VM_PAGE_TO_PHYS(nkpg);
|
||||
pmap_zero_page(ptppaddr);
|
||||
newpdir = (pd_entry_t) (ptppaddr | PG_V | PG_RW);
|
||||
pdir_pde(PTD, kernel_vm_end) = newpdir;
|
||||
|
||||
#ifdef SMP
|
||||
for (i = 0; i < mp_ncpus; i++) {
|
||||
if (IdlePTDS[i])
|
||||
pdir_pde(IdlePTDS[i], kernel_vm_end) = (pd_entry_t) (VM_PAGE_TO_PHYS(nkpg) | PG_V | PG_RW | pgeflag);
|
||||
pdir_pde(IdlePTDS[i], kernel_vm_end) = newpdir;
|
||||
}
|
||||
#endif
|
||||
|
||||
nkpg = NULL;
|
||||
|
||||
for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
|
||||
if (p->p_vmspace) {
|
||||
pmap = &p->p_vmspace->vm_pmap;
|
||||
*pmap_pde(pmap, kernel_vm_end) = pdir_pde(PTD, kernel_vm_end);
|
||||
*pmap_pde(pmap, kernel_vm_end) = newpdir;
|
||||
}
|
||||
}
|
||||
*pmap_pde(kernel_pmap, kernel_vm_end) = pdir_pde(PTD, kernel_vm_end);
|
||||
*pmap_pde(kernel_pmap, kernel_vm_end) = newpdir;
|
||||
kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1);
|
||||
}
|
||||
splx(s);
|
||||
@ -1996,8 +1999,28 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_offset_t pa, vm_prot_t prot,
|
||||
* In the case that a page table page is not
|
||||
* resident, we are creating it here.
|
||||
*/
|
||||
if (va < UPT_MIN_ADDRESS)
|
||||
if (va < UPT_MIN_ADDRESS) {
|
||||
mpte = pmap_allocpte(pmap, va);
|
||||
}
|
||||
#if 0 && defined(PMAP_DIAGNOSTIC)
|
||||
else {
|
||||
vm_offset_t *pdeaddr = (vm_offset_t *)pmap_pde(pmap, va);
|
||||
if (((origpte = (vm_offset_t) *pdeaddr) & PG_V) == 0) {
|
||||
panic("pmap_enter: invalid kernel page table page(0), pdir=%p, pde=%p, va=%p\n",
|
||||
pmap->pm_pdir[PTDPTDI], origpte, va);
|
||||
}
|
||||
if (smp_active) {
|
||||
pdeaddr = (vm_offset_t *) IdlePTDS[cpuid];
|
||||
if (((newpte = pdeaddr[va >> PDRSHIFT]) & PG_V) == 0) {
|
||||
if ((vm_offset_t) my_idlePTD != (vm_offset_t) vtophys(pdeaddr))
|
||||
printf("pde mismatch: %x, %x\n", my_idlePTD, pdeaddr);
|
||||
printf("cpuid: %d, pdeaddr: 0x%x\n", cpuid, pdeaddr);
|
||||
panic("pmap_enter: invalid kernel page table page(1), pdir=%p, npde=%p, pde=%p, va=%p\n",
|
||||
pmap->pm_pdir[PTDPTDI], newpte, origpte, va);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
pte = pmap_pte(pmap, va);
|
||||
/*
|
||||
|
@ -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.38 1997/09/05 20:23:34 smp Exp smp $
|
||||
* $Id: mp_machdep.c,v 1.52 1997/09/07 22:03:59 fsmp Exp $
|
||||
*/
|
||||
|
||||
#include "opt_smp.h"
|
||||
@ -222,6 +222,7 @@ int mp_napics; /* # of IO APICs */
|
||||
int boot_cpu_id; /* designated BSP */
|
||||
vm_offset_t cpu_apic_address;
|
||||
vm_offset_t io_apic_address[NAPICID]; /* NAPICID is more than enough */
|
||||
extern int nkpt;
|
||||
|
||||
u_int32_t cpu_apic_versions[NCPU];
|
||||
u_int32_t io_apic_versions[NAPIC];
|
||||
@ -1510,7 +1511,9 @@ start_all_aps(u_int boot_addr)
|
||||
u_long mpbioswarmvec;
|
||||
pd_entry_t *newptd;
|
||||
pt_entry_t *newpt;
|
||||
int *newpp, *stack;
|
||||
int *newpp;
|
||||
char *stack;
|
||||
pd_entry_t *myPTD;
|
||||
|
||||
POSTCODE(START_ALL_APS_POST);
|
||||
|
||||
@ -1549,7 +1552,7 @@ start_all_aps(u_int boot_addr)
|
||||
((u_long)KPTphys & PG_FRAME));
|
||||
|
||||
/* store PTD for this AP's boot sequence */
|
||||
bootPTD = (pd_entry_t *)vtophys(newptd);
|
||||
myPTD = (pd_entry_t *)vtophys(newptd);
|
||||
|
||||
/* alloc new page table page */
|
||||
newpt = (pt_entry_t *)(kmem_alloc(kernel_map, PAGE_SIZE));
|
||||
@ -1577,12 +1580,13 @@ start_all_aps(u_int boot_addr)
|
||||
newpt[i] = SMP_prvpt[i];
|
||||
|
||||
/* allocate and set up an idle stack data page */
|
||||
stack = (int *)kmem_alloc(kernel_map, PAGE_SIZE);
|
||||
newpt[3] = (pt_entry_t)(PG_V | PG_RW | vtophys(stack));
|
||||
stack = (char *)kmem_alloc(kernel_map, UPAGES*PAGE_SIZE);
|
||||
for (i = 0; i < UPAGES; i++)
|
||||
newpt[i + 3] = (pt_entry_t)(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
newpt[4] = 0; /* *prv_CMAP1 */
|
||||
newpt[5] = 0; /* *prv_CMAP2 */
|
||||
newpt[6] = 0; /* *prv_CMAP3 */
|
||||
newpt[5] = 0; /* *prv_CMAP1 */
|
||||
newpt[6] = 0; /* *prv_CMAP2 */
|
||||
newpt[7] = 0; /* *prv_CMAP3 */
|
||||
|
||||
/* prime data page for it to use */
|
||||
newpp[0] = x; /* cpuid */
|
||||
@ -1593,11 +1597,11 @@ start_all_aps(u_int boot_addr)
|
||||
newpp[5] = 0; /* runtime.tv_usec */
|
||||
newpp[6] = x << 24; /* cpu_lockid */
|
||||
newpp[7] = 0; /* other_cpus */
|
||||
newpp[8] = (int)bootPTD; /* my_idlePTD */
|
||||
newpp[8] = (int)myPTD; /* my_idlePTD */
|
||||
newpp[9] = 0; /* ss_tpr */
|
||||
newpp[10] = (int)&newpt[4]; /* prv_CMAP1 */
|
||||
newpp[11] = (int)&newpt[5]; /* prv_CMAP2 */
|
||||
newpp[12] = (int)&newpt[6]; /* prv_CMAP3 */
|
||||
newpp[10] = (int)&newpt[5]; /* prv_CMAP1 */
|
||||
newpp[11] = (int)&newpt[6]; /* prv_CMAP2 */
|
||||
newpp[12] = (int)&newpt[7]; /* prv_CMAP3 */
|
||||
|
||||
/* setup a vector to our boot code */
|
||||
*((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET;
|
||||
@ -1605,6 +1609,7 @@ start_all_aps(u_int boot_addr)
|
||||
outb(CMOS_REG, BIOS_RESET);
|
||||
outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */
|
||||
|
||||
bootPTD = myPTD;
|
||||
/* attempt to start the Application Processor */
|
||||
CHECK_INIT(99); /* setup checkpoints */
|
||||
if (!start_ap(x, boot_addr)) {
|
||||
@ -1651,11 +1656,16 @@ start_all_aps(u_int boot_addr)
|
||||
my_idlePTD = (pd_entry_t *)vtophys(newptd);
|
||||
|
||||
/* Allocate and setup BSP idle stack */
|
||||
stack = (int *)kmem_alloc(kernel_map, PAGE_SIZE);
|
||||
SMP_prvpt[3] = (pt_entry_t)(PG_V | PG_RW | vtophys(stack));
|
||||
stack = (char *)kmem_alloc(kernel_map, UPAGES * PAGE_SIZE);
|
||||
for (i = 0; i < UPAGES; i++)
|
||||
SMP_prvpt[i + 3] = (pt_entry_t)(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
pmap_set_opt_bsp();
|
||||
|
||||
for (i = 0; i < mp_ncpus; i++) {
|
||||
bcopy( (int *) PTD + KPTDI, (int *) IdlePTDS[i] + KPTDI, NKPDE * sizeof (int));
|
||||
}
|
||||
|
||||
/* number of APs actually started */
|
||||
return mp_ncpus - 1;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)locore.s 7.3 (Berkeley) 5/13/91
|
||||
* $Id: locore.s,v 1.5 1997/09/02 04:38:32 smp Exp smp $
|
||||
* $Id: locore.s,v 1.97 1997/09/07 22:03:46 fsmp Exp $
|
||||
*
|
||||
* originally from: locore.s, by William F. Jolitz
|
||||
*
|
||||
@ -96,10 +96,10 @@
|
||||
.set _SMP_prvpt,_SMP_prvstart + PAGE_SIZE
|
||||
.set _lapic,_SMP_prvstart + (2 * PAGE_SIZE)
|
||||
.set _idlestack,_SMP_prvstart + (3 * PAGE_SIZE)
|
||||
.set _idlestack_top,_SMP_prvstart + (4 * PAGE_SIZE)
|
||||
.set _prv_CPAGE1,_SMP_prvstart + (4 * PAGE_SIZE)
|
||||
.set _prv_CPAGE2,_SMP_prvstart + (5 * PAGE_SIZE)
|
||||
.set _prv_CPAGE3,_SMP_prvstart + (6 * PAGE_SIZE)
|
||||
.set _idlestack_top,_SMP_prvstart + (5 * PAGE_SIZE)
|
||||
.set _prv_CPAGE1,_SMP_prvstart + (5 * PAGE_SIZE)
|
||||
.set _prv_CPAGE2,_SMP_prvstart + (6 * PAGE_SIZE)
|
||||
.set _prv_CPAGE3,_SMP_prvstart + (7 * PAGE_SIZE)
|
||||
.set _SMP_ioapic,_SMP_prvstart + (16 * PAGE_SIZE)
|
||||
|
||||
.globl _cpuid,_curproc,_curpcb,_npxproc,_runtime,_cpu_lockid
|
||||
|
@ -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.38 1997/09/05 20:23:34 smp Exp smp $
|
||||
* $Id: mp_machdep.c,v 1.52 1997/09/07 22:03:59 fsmp Exp $
|
||||
*/
|
||||
|
||||
#include "opt_smp.h"
|
||||
@ -222,6 +222,7 @@ int mp_napics; /* # of IO APICs */
|
||||
int boot_cpu_id; /* designated BSP */
|
||||
vm_offset_t cpu_apic_address;
|
||||
vm_offset_t io_apic_address[NAPICID]; /* NAPICID is more than enough */
|
||||
extern int nkpt;
|
||||
|
||||
u_int32_t cpu_apic_versions[NCPU];
|
||||
u_int32_t io_apic_versions[NAPIC];
|
||||
@ -1510,7 +1511,9 @@ start_all_aps(u_int boot_addr)
|
||||
u_long mpbioswarmvec;
|
||||
pd_entry_t *newptd;
|
||||
pt_entry_t *newpt;
|
||||
int *newpp, *stack;
|
||||
int *newpp;
|
||||
char *stack;
|
||||
pd_entry_t *myPTD;
|
||||
|
||||
POSTCODE(START_ALL_APS_POST);
|
||||
|
||||
@ -1549,7 +1552,7 @@ start_all_aps(u_int boot_addr)
|
||||
((u_long)KPTphys & PG_FRAME));
|
||||
|
||||
/* store PTD for this AP's boot sequence */
|
||||
bootPTD = (pd_entry_t *)vtophys(newptd);
|
||||
myPTD = (pd_entry_t *)vtophys(newptd);
|
||||
|
||||
/* alloc new page table page */
|
||||
newpt = (pt_entry_t *)(kmem_alloc(kernel_map, PAGE_SIZE));
|
||||
@ -1577,12 +1580,13 @@ start_all_aps(u_int boot_addr)
|
||||
newpt[i] = SMP_prvpt[i];
|
||||
|
||||
/* allocate and set up an idle stack data page */
|
||||
stack = (int *)kmem_alloc(kernel_map, PAGE_SIZE);
|
||||
newpt[3] = (pt_entry_t)(PG_V | PG_RW | vtophys(stack));
|
||||
stack = (char *)kmem_alloc(kernel_map, UPAGES*PAGE_SIZE);
|
||||
for (i = 0; i < UPAGES; i++)
|
||||
newpt[i + 3] = (pt_entry_t)(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
newpt[4] = 0; /* *prv_CMAP1 */
|
||||
newpt[5] = 0; /* *prv_CMAP2 */
|
||||
newpt[6] = 0; /* *prv_CMAP3 */
|
||||
newpt[5] = 0; /* *prv_CMAP1 */
|
||||
newpt[6] = 0; /* *prv_CMAP2 */
|
||||
newpt[7] = 0; /* *prv_CMAP3 */
|
||||
|
||||
/* prime data page for it to use */
|
||||
newpp[0] = x; /* cpuid */
|
||||
@ -1593,11 +1597,11 @@ start_all_aps(u_int boot_addr)
|
||||
newpp[5] = 0; /* runtime.tv_usec */
|
||||
newpp[6] = x << 24; /* cpu_lockid */
|
||||
newpp[7] = 0; /* other_cpus */
|
||||
newpp[8] = (int)bootPTD; /* my_idlePTD */
|
||||
newpp[8] = (int)myPTD; /* my_idlePTD */
|
||||
newpp[9] = 0; /* ss_tpr */
|
||||
newpp[10] = (int)&newpt[4]; /* prv_CMAP1 */
|
||||
newpp[11] = (int)&newpt[5]; /* prv_CMAP2 */
|
||||
newpp[12] = (int)&newpt[6]; /* prv_CMAP3 */
|
||||
newpp[10] = (int)&newpt[5]; /* prv_CMAP1 */
|
||||
newpp[11] = (int)&newpt[6]; /* prv_CMAP2 */
|
||||
newpp[12] = (int)&newpt[7]; /* prv_CMAP3 */
|
||||
|
||||
/* setup a vector to our boot code */
|
||||
*((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET;
|
||||
@ -1605,6 +1609,7 @@ start_all_aps(u_int boot_addr)
|
||||
outb(CMOS_REG, BIOS_RESET);
|
||||
outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */
|
||||
|
||||
bootPTD = myPTD;
|
||||
/* attempt to start the Application Processor */
|
||||
CHECK_INIT(99); /* setup checkpoints */
|
||||
if (!start_ap(x, boot_addr)) {
|
||||
@ -1651,11 +1656,16 @@ start_all_aps(u_int boot_addr)
|
||||
my_idlePTD = (pd_entry_t *)vtophys(newptd);
|
||||
|
||||
/* Allocate and setup BSP idle stack */
|
||||
stack = (int *)kmem_alloc(kernel_map, PAGE_SIZE);
|
||||
SMP_prvpt[3] = (pt_entry_t)(PG_V | PG_RW | vtophys(stack));
|
||||
stack = (char *)kmem_alloc(kernel_map, UPAGES * PAGE_SIZE);
|
||||
for (i = 0; i < UPAGES; i++)
|
||||
SMP_prvpt[i + 3] = (pt_entry_t)(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
pmap_set_opt_bsp();
|
||||
|
||||
for (i = 0; i < mp_ncpus; i++) {
|
||||
bcopy( (int *) PTD + KPTDI, (int *) IdlePTDS[i] + KPTDI, NKPDE * sizeof (int));
|
||||
}
|
||||
|
||||
/* number of APs actually started */
|
||||
return mp_ncpus - 1;
|
||||
}
|
||||
|
@ -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.38 1997/09/05 20:23:34 smp Exp smp $
|
||||
* $Id: mp_machdep.c,v 1.52 1997/09/07 22:03:59 fsmp Exp $
|
||||
*/
|
||||
|
||||
#include "opt_smp.h"
|
||||
@ -222,6 +222,7 @@ int mp_napics; /* # of IO APICs */
|
||||
int boot_cpu_id; /* designated BSP */
|
||||
vm_offset_t cpu_apic_address;
|
||||
vm_offset_t io_apic_address[NAPICID]; /* NAPICID is more than enough */
|
||||
extern int nkpt;
|
||||
|
||||
u_int32_t cpu_apic_versions[NCPU];
|
||||
u_int32_t io_apic_versions[NAPIC];
|
||||
@ -1510,7 +1511,9 @@ start_all_aps(u_int boot_addr)
|
||||
u_long mpbioswarmvec;
|
||||
pd_entry_t *newptd;
|
||||
pt_entry_t *newpt;
|
||||
int *newpp, *stack;
|
||||
int *newpp;
|
||||
char *stack;
|
||||
pd_entry_t *myPTD;
|
||||
|
||||
POSTCODE(START_ALL_APS_POST);
|
||||
|
||||
@ -1549,7 +1552,7 @@ start_all_aps(u_int boot_addr)
|
||||
((u_long)KPTphys & PG_FRAME));
|
||||
|
||||
/* store PTD for this AP's boot sequence */
|
||||
bootPTD = (pd_entry_t *)vtophys(newptd);
|
||||
myPTD = (pd_entry_t *)vtophys(newptd);
|
||||
|
||||
/* alloc new page table page */
|
||||
newpt = (pt_entry_t *)(kmem_alloc(kernel_map, PAGE_SIZE));
|
||||
@ -1577,12 +1580,13 @@ start_all_aps(u_int boot_addr)
|
||||
newpt[i] = SMP_prvpt[i];
|
||||
|
||||
/* allocate and set up an idle stack data page */
|
||||
stack = (int *)kmem_alloc(kernel_map, PAGE_SIZE);
|
||||
newpt[3] = (pt_entry_t)(PG_V | PG_RW | vtophys(stack));
|
||||
stack = (char *)kmem_alloc(kernel_map, UPAGES*PAGE_SIZE);
|
||||
for (i = 0; i < UPAGES; i++)
|
||||
newpt[i + 3] = (pt_entry_t)(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
newpt[4] = 0; /* *prv_CMAP1 */
|
||||
newpt[5] = 0; /* *prv_CMAP2 */
|
||||
newpt[6] = 0; /* *prv_CMAP3 */
|
||||
newpt[5] = 0; /* *prv_CMAP1 */
|
||||
newpt[6] = 0; /* *prv_CMAP2 */
|
||||
newpt[7] = 0; /* *prv_CMAP3 */
|
||||
|
||||
/* prime data page for it to use */
|
||||
newpp[0] = x; /* cpuid */
|
||||
@ -1593,11 +1597,11 @@ start_all_aps(u_int boot_addr)
|
||||
newpp[5] = 0; /* runtime.tv_usec */
|
||||
newpp[6] = x << 24; /* cpu_lockid */
|
||||
newpp[7] = 0; /* other_cpus */
|
||||
newpp[8] = (int)bootPTD; /* my_idlePTD */
|
||||
newpp[8] = (int)myPTD; /* my_idlePTD */
|
||||
newpp[9] = 0; /* ss_tpr */
|
||||
newpp[10] = (int)&newpt[4]; /* prv_CMAP1 */
|
||||
newpp[11] = (int)&newpt[5]; /* prv_CMAP2 */
|
||||
newpp[12] = (int)&newpt[6]; /* prv_CMAP3 */
|
||||
newpp[10] = (int)&newpt[5]; /* prv_CMAP1 */
|
||||
newpp[11] = (int)&newpt[6]; /* prv_CMAP2 */
|
||||
newpp[12] = (int)&newpt[7]; /* prv_CMAP3 */
|
||||
|
||||
/* setup a vector to our boot code */
|
||||
*((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET;
|
||||
@ -1605,6 +1609,7 @@ start_all_aps(u_int boot_addr)
|
||||
outb(CMOS_REG, BIOS_RESET);
|
||||
outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */
|
||||
|
||||
bootPTD = myPTD;
|
||||
/* attempt to start the Application Processor */
|
||||
CHECK_INIT(99); /* setup checkpoints */
|
||||
if (!start_ap(x, boot_addr)) {
|
||||
@ -1651,11 +1656,16 @@ start_all_aps(u_int boot_addr)
|
||||
my_idlePTD = (pd_entry_t *)vtophys(newptd);
|
||||
|
||||
/* Allocate and setup BSP idle stack */
|
||||
stack = (int *)kmem_alloc(kernel_map, PAGE_SIZE);
|
||||
SMP_prvpt[3] = (pt_entry_t)(PG_V | PG_RW | vtophys(stack));
|
||||
stack = (char *)kmem_alloc(kernel_map, UPAGES * PAGE_SIZE);
|
||||
for (i = 0; i < UPAGES; i++)
|
||||
SMP_prvpt[i + 3] = (pt_entry_t)(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
pmap_set_opt_bsp();
|
||||
|
||||
for (i = 0; i < mp_ncpus; i++) {
|
||||
bcopy( (int *) PTD + KPTDI, (int *) IdlePTDS[i] + KPTDI, NKPDE * sizeof (int));
|
||||
}
|
||||
|
||||
/* number of APs actually started */
|
||||
return mp_ncpus - 1;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)pmap.c 7.7 (Berkeley) 5/12/91
|
||||
* $Id: pmap.c,v 1.160 1997/08/26 18:10:32 peter Exp $
|
||||
* $Id: pmap.c,v 1.161 1997/09/07 01:15:13 dyson Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -146,6 +146,7 @@ static int protection_codes[8];
|
||||
|
||||
static struct pmap kernel_pmap_store;
|
||||
pmap_t kernel_pmap;
|
||||
extern pd_entry_t my_idlePTD;
|
||||
|
||||
vm_offset_t avail_start; /* PA of first available physical page */
|
||||
vm_offset_t avail_end; /* PA of last available physical page */
|
||||
@ -157,8 +158,7 @@ int pgeflag; /* PG_G or-in */
|
||||
int pseflag; /* PG_PS or-in */
|
||||
int pv_npg;
|
||||
|
||||
static int nkpt;
|
||||
static vm_page_t nkpg;
|
||||
int nkpt;
|
||||
vm_offset_t kernel_vm_end;
|
||||
|
||||
extern vm_offset_t clean_sva, clean_eva;
|
||||
@ -438,9 +438,9 @@ pmap_bootstrap(firstaddr, loadaddr)
|
||||
}
|
||||
|
||||
/* BSP does this itself, AP's get it pre-set */
|
||||
prv_CMAP1 = (pt_entry_t *)&SMP_prvpt[4];
|
||||
prv_CMAP2 = (pt_entry_t *)&SMP_prvpt[5];
|
||||
prv_CMAP3 = (pt_entry_t *)&SMP_prvpt[6];
|
||||
prv_CMAP1 = (pt_entry_t *)&SMP_prvpt[5];
|
||||
prv_CMAP2 = (pt_entry_t *)&SMP_prvpt[6];
|
||||
prv_CMAP3 = (pt_entry_t *)&SMP_prvpt[7];
|
||||
#endif
|
||||
|
||||
invltlb();
|
||||
@ -1427,9 +1427,13 @@ pmap_growkernel(vm_offset_t addr)
|
||||
struct proc *p;
|
||||
struct pmap *pmap;
|
||||
int s;
|
||||
vm_offset_t ptpkva, ptppaddr;
|
||||
vm_page_t nkpg;
|
||||
#ifdef SMP
|
||||
int i;
|
||||
#endif
|
||||
pd_entry_t newpdir;
|
||||
vm_pindex_t ptpidx;
|
||||
|
||||
s = splhigh();
|
||||
if (kernel_vm_end == 0) {
|
||||
@ -1447,38 +1451,37 @@ pmap_growkernel(vm_offset_t addr)
|
||||
continue;
|
||||
}
|
||||
++nkpt;
|
||||
if (!nkpg) {
|
||||
vm_offset_t ptpkva = (vm_offset_t) vtopte(addr);
|
||||
/*
|
||||
* This index is bogus, but out of the way
|
||||
*/
|
||||
vm_pindex_t ptpidx = (ptpkva >> PAGE_SHIFT);
|
||||
nkpg = vm_page_alloc(kernel_object,
|
||||
ptpidx, VM_ALLOC_SYSTEM);
|
||||
if (!nkpg)
|
||||
panic("pmap_growkernel: no memory to grow kernel");
|
||||
vm_page_wire(nkpg);
|
||||
vm_page_remove(nkpg);
|
||||
pmap_zero_page(VM_PAGE_TO_PHYS(nkpg));
|
||||
}
|
||||
pdir_pde(PTD, kernel_vm_end) = (pd_entry_t) (VM_PAGE_TO_PHYS(nkpg) | PG_V | PG_RW | pgeflag);
|
||||
ptpkva = (vm_offset_t) vtopte(addr);
|
||||
ptpidx = (ptpkva >> PAGE_SHIFT);
|
||||
/*
|
||||
* This index is bogus, but out of the way
|
||||
*/
|
||||
nkpg = vm_page_alloc(kernel_object,
|
||||
ptpidx, VM_ALLOC_SYSTEM);
|
||||
if (!nkpg)
|
||||
panic("pmap_growkernel: no memory to grow kernel");
|
||||
|
||||
vm_page_wire(nkpg);
|
||||
vm_page_remove(nkpg);
|
||||
ptppaddr = VM_PAGE_TO_PHYS(nkpg);
|
||||
pmap_zero_page(ptppaddr);
|
||||
newpdir = (pd_entry_t) (ptppaddr | PG_V | PG_RW);
|
||||
pdir_pde(PTD, kernel_vm_end) = newpdir;
|
||||
|
||||
#ifdef SMP
|
||||
for (i = 0; i < mp_ncpus; i++) {
|
||||
if (IdlePTDS[i])
|
||||
pdir_pde(IdlePTDS[i], kernel_vm_end) = (pd_entry_t) (VM_PAGE_TO_PHYS(nkpg) | PG_V | PG_RW | pgeflag);
|
||||
pdir_pde(IdlePTDS[i], kernel_vm_end) = newpdir;
|
||||
}
|
||||
#endif
|
||||
|
||||
nkpg = NULL;
|
||||
|
||||
for (p = allproc.lh_first; p != 0; p = p->p_list.le_next) {
|
||||
if (p->p_vmspace) {
|
||||
pmap = &p->p_vmspace->vm_pmap;
|
||||
*pmap_pde(pmap, kernel_vm_end) = pdir_pde(PTD, kernel_vm_end);
|
||||
*pmap_pde(pmap, kernel_vm_end) = newpdir;
|
||||
}
|
||||
}
|
||||
*pmap_pde(kernel_pmap, kernel_vm_end) = pdir_pde(PTD, kernel_vm_end);
|
||||
*pmap_pde(kernel_pmap, kernel_vm_end) = newpdir;
|
||||
kernel_vm_end = (kernel_vm_end + PAGE_SIZE * NPTEPG) & ~(PAGE_SIZE * NPTEPG - 1);
|
||||
}
|
||||
splx(s);
|
||||
@ -1996,8 +1999,28 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_offset_t pa, vm_prot_t prot,
|
||||
* In the case that a page table page is not
|
||||
* resident, we are creating it here.
|
||||
*/
|
||||
if (va < UPT_MIN_ADDRESS)
|
||||
if (va < UPT_MIN_ADDRESS) {
|
||||
mpte = pmap_allocpte(pmap, va);
|
||||
}
|
||||
#if 0 && defined(PMAP_DIAGNOSTIC)
|
||||
else {
|
||||
vm_offset_t *pdeaddr = (vm_offset_t *)pmap_pde(pmap, va);
|
||||
if (((origpte = (vm_offset_t) *pdeaddr) & PG_V) == 0) {
|
||||
panic("pmap_enter: invalid kernel page table page(0), pdir=%p, pde=%p, va=%p\n",
|
||||
pmap->pm_pdir[PTDPTDI], origpte, va);
|
||||
}
|
||||
if (smp_active) {
|
||||
pdeaddr = (vm_offset_t *) IdlePTDS[cpuid];
|
||||
if (((newpte = pdeaddr[va >> PDRSHIFT]) & PG_V) == 0) {
|
||||
if ((vm_offset_t) my_idlePTD != (vm_offset_t) vtophys(pdeaddr))
|
||||
printf("pde mismatch: %x, %x\n", my_idlePTD, pdeaddr);
|
||||
printf("cpuid: %d, pdeaddr: 0x%x\n", cpuid, pdeaddr);
|
||||
panic("pmap_enter: invalid kernel page table page(1), pdir=%p, npde=%p, pde=%p, va=%p\n",
|
||||
pmap->pm_pdir[PTDPTDI], newpte, origpte, va);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
pte = pmap_pte(pmap, va);
|
||||
/*
|
||||
|
@ -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.38 1997/09/05 20:23:34 smp Exp smp $
|
||||
* $Id: mp_machdep.c,v 1.52 1997/09/07 22:03:59 fsmp Exp $
|
||||
*/
|
||||
|
||||
#include "opt_smp.h"
|
||||
@ -222,6 +222,7 @@ int mp_napics; /* # of IO APICs */
|
||||
int boot_cpu_id; /* designated BSP */
|
||||
vm_offset_t cpu_apic_address;
|
||||
vm_offset_t io_apic_address[NAPICID]; /* NAPICID is more than enough */
|
||||
extern int nkpt;
|
||||
|
||||
u_int32_t cpu_apic_versions[NCPU];
|
||||
u_int32_t io_apic_versions[NAPIC];
|
||||
@ -1510,7 +1511,9 @@ start_all_aps(u_int boot_addr)
|
||||
u_long mpbioswarmvec;
|
||||
pd_entry_t *newptd;
|
||||
pt_entry_t *newpt;
|
||||
int *newpp, *stack;
|
||||
int *newpp;
|
||||
char *stack;
|
||||
pd_entry_t *myPTD;
|
||||
|
||||
POSTCODE(START_ALL_APS_POST);
|
||||
|
||||
@ -1549,7 +1552,7 @@ start_all_aps(u_int boot_addr)
|
||||
((u_long)KPTphys & PG_FRAME));
|
||||
|
||||
/* store PTD for this AP's boot sequence */
|
||||
bootPTD = (pd_entry_t *)vtophys(newptd);
|
||||
myPTD = (pd_entry_t *)vtophys(newptd);
|
||||
|
||||
/* alloc new page table page */
|
||||
newpt = (pt_entry_t *)(kmem_alloc(kernel_map, PAGE_SIZE));
|
||||
@ -1577,12 +1580,13 @@ start_all_aps(u_int boot_addr)
|
||||
newpt[i] = SMP_prvpt[i];
|
||||
|
||||
/* allocate and set up an idle stack data page */
|
||||
stack = (int *)kmem_alloc(kernel_map, PAGE_SIZE);
|
||||
newpt[3] = (pt_entry_t)(PG_V | PG_RW | vtophys(stack));
|
||||
stack = (char *)kmem_alloc(kernel_map, UPAGES*PAGE_SIZE);
|
||||
for (i = 0; i < UPAGES; i++)
|
||||
newpt[i + 3] = (pt_entry_t)(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
newpt[4] = 0; /* *prv_CMAP1 */
|
||||
newpt[5] = 0; /* *prv_CMAP2 */
|
||||
newpt[6] = 0; /* *prv_CMAP3 */
|
||||
newpt[5] = 0; /* *prv_CMAP1 */
|
||||
newpt[6] = 0; /* *prv_CMAP2 */
|
||||
newpt[7] = 0; /* *prv_CMAP3 */
|
||||
|
||||
/* prime data page for it to use */
|
||||
newpp[0] = x; /* cpuid */
|
||||
@ -1593,11 +1597,11 @@ start_all_aps(u_int boot_addr)
|
||||
newpp[5] = 0; /* runtime.tv_usec */
|
||||
newpp[6] = x << 24; /* cpu_lockid */
|
||||
newpp[7] = 0; /* other_cpus */
|
||||
newpp[8] = (int)bootPTD; /* my_idlePTD */
|
||||
newpp[8] = (int)myPTD; /* my_idlePTD */
|
||||
newpp[9] = 0; /* ss_tpr */
|
||||
newpp[10] = (int)&newpt[4]; /* prv_CMAP1 */
|
||||
newpp[11] = (int)&newpt[5]; /* prv_CMAP2 */
|
||||
newpp[12] = (int)&newpt[6]; /* prv_CMAP3 */
|
||||
newpp[10] = (int)&newpt[5]; /* prv_CMAP1 */
|
||||
newpp[11] = (int)&newpt[6]; /* prv_CMAP2 */
|
||||
newpp[12] = (int)&newpt[7]; /* prv_CMAP3 */
|
||||
|
||||
/* setup a vector to our boot code */
|
||||
*((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET;
|
||||
@ -1605,6 +1609,7 @@ start_all_aps(u_int boot_addr)
|
||||
outb(CMOS_REG, BIOS_RESET);
|
||||
outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */
|
||||
|
||||
bootPTD = myPTD;
|
||||
/* attempt to start the Application Processor */
|
||||
CHECK_INIT(99); /* setup checkpoints */
|
||||
if (!start_ap(x, boot_addr)) {
|
||||
@ -1651,11 +1656,16 @@ start_all_aps(u_int boot_addr)
|
||||
my_idlePTD = (pd_entry_t *)vtophys(newptd);
|
||||
|
||||
/* Allocate and setup BSP idle stack */
|
||||
stack = (int *)kmem_alloc(kernel_map, PAGE_SIZE);
|
||||
SMP_prvpt[3] = (pt_entry_t)(PG_V | PG_RW | vtophys(stack));
|
||||
stack = (char *)kmem_alloc(kernel_map, UPAGES * PAGE_SIZE);
|
||||
for (i = 0; i < UPAGES; i++)
|
||||
SMP_prvpt[i + 3] = (pt_entry_t)(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
pmap_set_opt_bsp();
|
||||
|
||||
for (i = 0; i < mp_ncpus; i++) {
|
||||
bcopy( (int *) PTD + KPTDI, (int *) IdlePTDS[i] + KPTDI, NKPDE * sizeof (int));
|
||||
}
|
||||
|
||||
/* number of APs actually started */
|
||||
return mp_ncpus - 1;
|
||||
}
|
||||
|
@ -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.38 1997/09/05 20:23:34 smp Exp smp $
|
||||
* $Id: mp_machdep.c,v 1.52 1997/09/07 22:03:59 fsmp Exp $
|
||||
*/
|
||||
|
||||
#include "opt_smp.h"
|
||||
@ -222,6 +222,7 @@ int mp_napics; /* # of IO APICs */
|
||||
int boot_cpu_id; /* designated BSP */
|
||||
vm_offset_t cpu_apic_address;
|
||||
vm_offset_t io_apic_address[NAPICID]; /* NAPICID is more than enough */
|
||||
extern int nkpt;
|
||||
|
||||
u_int32_t cpu_apic_versions[NCPU];
|
||||
u_int32_t io_apic_versions[NAPIC];
|
||||
@ -1510,7 +1511,9 @@ start_all_aps(u_int boot_addr)
|
||||
u_long mpbioswarmvec;
|
||||
pd_entry_t *newptd;
|
||||
pt_entry_t *newpt;
|
||||
int *newpp, *stack;
|
||||
int *newpp;
|
||||
char *stack;
|
||||
pd_entry_t *myPTD;
|
||||
|
||||
POSTCODE(START_ALL_APS_POST);
|
||||
|
||||
@ -1549,7 +1552,7 @@ start_all_aps(u_int boot_addr)
|
||||
((u_long)KPTphys & PG_FRAME));
|
||||
|
||||
/* store PTD for this AP's boot sequence */
|
||||
bootPTD = (pd_entry_t *)vtophys(newptd);
|
||||
myPTD = (pd_entry_t *)vtophys(newptd);
|
||||
|
||||
/* alloc new page table page */
|
||||
newpt = (pt_entry_t *)(kmem_alloc(kernel_map, PAGE_SIZE));
|
||||
@ -1577,12 +1580,13 @@ start_all_aps(u_int boot_addr)
|
||||
newpt[i] = SMP_prvpt[i];
|
||||
|
||||
/* allocate and set up an idle stack data page */
|
||||
stack = (int *)kmem_alloc(kernel_map, PAGE_SIZE);
|
||||
newpt[3] = (pt_entry_t)(PG_V | PG_RW | vtophys(stack));
|
||||
stack = (char *)kmem_alloc(kernel_map, UPAGES*PAGE_SIZE);
|
||||
for (i = 0; i < UPAGES; i++)
|
||||
newpt[i + 3] = (pt_entry_t)(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
newpt[4] = 0; /* *prv_CMAP1 */
|
||||
newpt[5] = 0; /* *prv_CMAP2 */
|
||||
newpt[6] = 0; /* *prv_CMAP3 */
|
||||
newpt[5] = 0; /* *prv_CMAP1 */
|
||||
newpt[6] = 0; /* *prv_CMAP2 */
|
||||
newpt[7] = 0; /* *prv_CMAP3 */
|
||||
|
||||
/* prime data page for it to use */
|
||||
newpp[0] = x; /* cpuid */
|
||||
@ -1593,11 +1597,11 @@ start_all_aps(u_int boot_addr)
|
||||
newpp[5] = 0; /* runtime.tv_usec */
|
||||
newpp[6] = x << 24; /* cpu_lockid */
|
||||
newpp[7] = 0; /* other_cpus */
|
||||
newpp[8] = (int)bootPTD; /* my_idlePTD */
|
||||
newpp[8] = (int)myPTD; /* my_idlePTD */
|
||||
newpp[9] = 0; /* ss_tpr */
|
||||
newpp[10] = (int)&newpt[4]; /* prv_CMAP1 */
|
||||
newpp[11] = (int)&newpt[5]; /* prv_CMAP2 */
|
||||
newpp[12] = (int)&newpt[6]; /* prv_CMAP3 */
|
||||
newpp[10] = (int)&newpt[5]; /* prv_CMAP1 */
|
||||
newpp[11] = (int)&newpt[6]; /* prv_CMAP2 */
|
||||
newpp[12] = (int)&newpt[7]; /* prv_CMAP3 */
|
||||
|
||||
/* setup a vector to our boot code */
|
||||
*((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET;
|
||||
@ -1605,6 +1609,7 @@ start_all_aps(u_int boot_addr)
|
||||
outb(CMOS_REG, BIOS_RESET);
|
||||
outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */
|
||||
|
||||
bootPTD = myPTD;
|
||||
/* attempt to start the Application Processor */
|
||||
CHECK_INIT(99); /* setup checkpoints */
|
||||
if (!start_ap(x, boot_addr)) {
|
||||
@ -1651,11 +1656,16 @@ start_all_aps(u_int boot_addr)
|
||||
my_idlePTD = (pd_entry_t *)vtophys(newptd);
|
||||
|
||||
/* Allocate and setup BSP idle stack */
|
||||
stack = (int *)kmem_alloc(kernel_map, PAGE_SIZE);
|
||||
SMP_prvpt[3] = (pt_entry_t)(PG_V | PG_RW | vtophys(stack));
|
||||
stack = (char *)kmem_alloc(kernel_map, UPAGES * PAGE_SIZE);
|
||||
for (i = 0; i < UPAGES; i++)
|
||||
SMP_prvpt[i + 3] = (pt_entry_t)(PG_V | PG_RW | vtophys(PAGE_SIZE * i + stack));
|
||||
|
||||
pmap_set_opt_bsp();
|
||||
|
||||
for (i = 0; i < mp_ncpus; i++) {
|
||||
bcopy( (int *) PTD + KPTDI, (int *) IdlePTDS[i] + KPTDI, NKPDE * sizeof (int));
|
||||
}
|
||||
|
||||
/* number of APs actually started */
|
||||
return mp_ncpus - 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user