This commit is contained in:
rsc 2007-08-27 16:12:08 +00:00
parent 3ce1647078
commit da94233784

30
mp.c
View file

@ -72,8 +72,7 @@ mp_search(void)
if((p = (bda[0x0F]<<8)|bda[0x0E])){
if((mp = mp_scan((uchar*) p, 1024)))
return mp;
}
else{
}else{
p = ((bda[0x14]<<8)|bda[0x13])*1024;
if((mp = mp_scan((uchar*)p-1024, 1024)))
return mp;
@ -94,19 +93,20 @@ mp_detect(void)
uint length;
if((mp = mp_search()) == 0 || mp->physaddr == 0)
return 1;
return -1;
pcmp = (struct mpctb*) mp->physaddr;
if(memcmp(pcmp, "PCMP", 4))
return 2;
if(memcmp(pcmp, "PCMP", 4) != 0)
return -1;
if(pcmp->version != 1 && pcmp->version != 4)
return -1;
length = pcmp->length;
sum = 0;
for(p = (uchar*)pcmp; length; length--)
sum += *p++;
if(sum || (pcmp->version != 1 && pcmp->version != 4))
return 3;
if(sum != 0)
return -1;
return 0;
}
@ -114,20 +114,17 @@ mp_detect(void)
void
mp_init(void)
{
int r;
int i, r;
uchar *p, *e;
struct mpctb *mpctb;
struct mppe *proc;
struct mpbe *bus;
struct mpioapic *ioapic;
struct mpie *intr;
int i;
uchar byte;
ncpu = 0;
if((r = mp_detect()) != 0) {
if(mp_detect() < 0)
return;
}
ismp = 1;
@ -179,11 +176,10 @@ mp_init(void)
}
if(mp->imcrp) {
// It appears that Bochs doesn't support IMCR, so code won't run.
// Bochs doesn't support IMCR, so this doesn't run on Bochs.
// But it would on real hardware.
outb(0x22, 0x70); // Select IMCR
byte = inb(0x23); // Current contents
byte |= 0x01; // Mask external INTR
outb(0x23, byte); // Disconnect 8259s/NMI
outb(0x23, inb(0x23) | 1); // Mask external interrupts.
}
}