Improvements for SMP

This commit is contained in:
Ali Mashtizadeh 2015-02-15 18:50:43 -08:00
parent 4808b746f5
commit b8c8b1fc7d
4 changed files with 14 additions and 3 deletions

View File

@ -17,6 +17,7 @@ void
Critical_Init()
{
int c;
for (c = 0; c < MAX_CPUS; c++)
{
lockLevel[c] = 0;
@ -43,7 +44,11 @@ Critical_Exit()
void
Debug_Critical(int argc, const char *argv[])
{
kprintf("CPU0: %u\n", lockLevel[0]);
int c;
for (c = 0; c < MAX_CPUS; c++) {
kprintf("CPU%d: %u\n", c, lockLevel[c]);
}
}
REGISTER_DBGCMD(critical, "Critical Enter/Exit Stats", Debug_Critical);

View File

@ -151,8 +151,10 @@ LAPIC_Init()
Panic("APIC is required!\n");
// Disable ATPIC
outb(0xA1, 0xFF);
outb(0x21, 0xFF);
if (LAPIC_CPU() == 0) {
outb(0xA1, 0xFF);
outb(0x21, 0xFF);
}
// Enable LAPIC
base = rdmsr(IA32_APIC_BASE_MSR);

View File

@ -187,6 +187,8 @@ void Machine_InitAP()
Machine_TSSInit();
//Machine_SyscallInit();
LAPIC_Init();
kprintf("AP %d booted!\n", CPU());
while (1) {}

View File

@ -10,6 +10,7 @@
#include <sys/spinlock.h>
#include <sys/irq.h>
#include <sys/syscall.h>
#include <sys/mp.h>
#include <machine/amd64.h>
#include <machine/lapic.h>
@ -91,6 +92,7 @@ Trap_InitAP()
void
Trap_Dump(TrapFrame *tf)
{
kprintf("CPU %d\n", CPU());
kprintf("Interrupt %d Error Code: %016llx\n",
tf->vector, tf->errcode);
kprintf("cr0: %016llx cr2: %016llx\n",