This commit is contained in:
cinap_lenrek 2017-03-11 20:42:25 +01:00
commit 5b7a62e5e6
20 changed files with 29 additions and 51 deletions

View file

@ -222,7 +222,6 @@ typedef void KMap;
struct
{
Lock;
char machs[MAXMACH]; /* active CPUs */
int exiting; /* shutdown */
}active;

View file

@ -193,7 +193,6 @@ typedef void KMap;
struct
{
Lock;
char machs[MAXMACH]; /* active CPUs */
int exiting; /* shutdown */
}active;

View file

@ -180,7 +180,6 @@ struct Mach
struct
{
Lock;
char machs[MAXMACH];
int exiting;
}active;

View file

@ -215,7 +215,6 @@ typedef void KMap;
struct
{
Lock;
char machs[MAXMACH]; /* active CPUs */
int exiting; /* shutdown */
}active;

View file

@ -141,7 +141,7 @@ lapiconline(void)
}
/*
* use the i8253 clock to figure out our lapic timer rate.
* use the i8253/tsc clock to figure out our lapic timer rate.
*/
static void
lapictimerinit(void)
@ -150,6 +150,11 @@ lapictimerinit(void)
Apictimer *a;
int s;
if(m->machno != 0){
lapictimer[m->machno] = lapictimer[0];
return;
}
s = splhi();
a = &lapictimer[m->machno];
a->tdx = 0;

View file

@ -269,10 +269,8 @@ void kunmap(KMap*);
struct
{
Lock;
char machs[MAXMACH]; /* active CPUs */
int exiting; /* shutdown */
int thunderbirdsarego; /* lets the added processors continue to schedinit */
}active;
/*

View file

@ -130,6 +130,13 @@ guesscpuhz(int aalcycles)
int loops, x, y;
uvlong a, b, cpufreq;
if(m->machno != 0){
m->cpuhz = MACHP(0)->cpuhz;
m->cpumhz = MACHP(0)->cpumhz;
m->loopconst = MACHP(0)->loopconst;
return;
}
ilock(&i8253);
for(loops = 1000;;loops += 1000) {
/*

View file

@ -167,7 +167,6 @@ main(void)
pageinit();
swapinit();
userinit();
active.thunderbirdsarego = 1;
schedinit();
}
@ -426,6 +425,7 @@ confinit(void)
if(userpcnt < 10)
userpcnt = 70;
kpages = conf.npage - (conf.npage*userpcnt)/100;
conf.nimage = conf.nproc;
/*
* Hack for the big boys. Only good while physmem < 4GB.
@ -438,7 +438,6 @@ confinit(void)
if(getconf("*imagemaxmb") == 0)
if(kpages > (64*MB + conf.npage*sizeof(Page))/BY2PG){
kpages = (64*MB + conf.npage*sizeof(Page))/BY2PG;
conf.nimage = 2000;
kpages += (conf.nproc*KSTACK)/BY2PG;
}
} else {

View file

@ -679,7 +679,7 @@ vunmap(void *v, int size)
* boot. In that case it suffices to flush the MACH(0) TLB
* and return.
*/
if(!active.thunderbirdsarego){
if(up == nil){
putcr3(PADDR(MACHP(0)->pdb));
return;
}

View file

@ -12,30 +12,17 @@ static void
squidboy(Apic* apic)
{
// iprint("Hello Squidboy\n");
machinit();
mmuinit();
cpuidentify();
cpuidprint();
syncclock();
active.machs[m->machno] = 1;
apic->online = 1;
coherence();
lapicinit(apic);
lapiconline();
syncclock();
timersinit();
fpoff();
lock(&active);
active.machs[m->machno] = 1;
unlock(&active);
while(!active.thunderbirdsarego)
microdelay(100);
schedinit();
}
@ -107,10 +94,12 @@ mpstartap(Apic* apic)
nvramwrite(0x0F, 0x0A); /* shutdown code: warm reset upon init ipi */
lapicstartap(apic, PADDR(APBOOTSTRAP));
for(i = 0; i < 1000; i++){
for(i = 0; i < 100000; i++){
if(arch->fastclock == tscticks)
cycles(&m->tscticks); /* for ap's syncclock(); */
if(apic->online)
break;
delay(10);
delay(1);
}
nvramwrite(0x0F, 0x00);
}

View file

@ -232,10 +232,8 @@ typedef void KMap;
struct
{
Lock;
char machs[MAXMACH]; /* bitmap of active CPUs */
int exiting; /* shutdown */
int thunderbirdsarego; /* lets the added processors continue to schedinit */
}active;
/*

View file

@ -200,6 +200,7 @@ confinit(void)
if(userpcnt < 10)
userpcnt = 70;
kpages = conf.npage - (conf.npage*userpcnt)/100;
conf.nimage = conf.nproc;
} else {
if(userpcnt < 10) {
if(conf.npage*BY2PG < 16*MB)
@ -517,7 +518,6 @@ main()
pageinit();
swapinit();
userinit();
active.thunderbirdsarego = 1;
schedinit();
}

View file

@ -15,21 +15,12 @@ squidboy(Apic* apic)
mmuinit();
cpuidentify();
cpuidprint();
syncclock();
active.machs[m->machno] = 1;
apic->online = 1;
coherence();
lapicinit(apic);
lapiconline();
syncclock();
timersinit();
lock(&active);
active.machs[m->machno] = 1;
unlock(&active);
while(!active.thunderbirdsarego)
microdelay(100);
schedinit();
}
@ -102,10 +93,12 @@ mpstartap(Apic* apic)
nvramwrite(0x0F, 0x0A); /* shutdown code: warm reset upon init ipi */
lapicstartap(apic, PADDR(APBOOTSTRAP));
for(i = 0; i < 1000; i++){
for(i = 0; i < 100000; i++){
if(arch->fastclock == tscticks)
cycles(&m->tscticks); /* for ap's syncclock(); */
if(apic->online)
break;
delay(10);
delay(1);
}
nvramwrite(0x0F, 0x00);
}

View file

@ -1008,11 +1008,9 @@ cpushutdown(void)
{
int ms, once;
lock(&active);
once = active.machs[m->machno];
active.machs[m->machno] = 0;
active.exiting = 1;
unlock(&active);
if(once)
iprint("cpu%d: exiting\n", m->machno);

View file

@ -188,7 +188,6 @@ struct Mach
struct
{
Lock;
char machs[MAXMACH];
int exiting;
}active;

View file

@ -203,7 +203,6 @@ struct Softtlb
struct
{
Lock;
char machs[MAXMACH]; /* active cpus */
short exiting;
}active;

View file

@ -250,7 +250,6 @@ struct
int wfi; /* bitmap of CPUs in WFI state */
int stopped; /* bitmap of CPUs stopped */
int exiting; /* shutdown */
int thunderbirdsarego; /* lets the added processors continue to schedinit */
}active;
extern register Mach* m; /* R10 */

View file

@ -484,7 +484,7 @@ mmurelease(Proc* proc)
for(page = proc->mmul2cache; page != nil; page = next){
next = page->next;
if(--page->ref)
panic("mmurelease: page->ref %d", page->ref);
panic("mmurelease: page->ref %ld", page->ref);
pagechainhead(page);
}
if(proc->mmul2cache != nil)

View file

@ -106,7 +106,6 @@ main(void)
swapinit();
userinit();
active.thunderbirdsarego = 1;
schedinit();
}

View file

@ -174,7 +174,6 @@ struct ISAConf
struct
{
Lock;
char machs[MAXMACH]; /* active CPUs */
int exiting; /* shutdown */
}active;