Improve MP debugging

This commit is contained in:
Ali Mashtizadeh 2015-02-16 13:59:24 -08:00
parent a69bfec37f
commit 8825b399c4

View File

@ -14,14 +14,23 @@
#include <machine/pmap.h>
#include <machine/lapic.h>
#define MP_WAITTIME 250000000ULL
extern uint8_t mpstart_begin[];
extern uint8_t mpstart_end[];
extern AS systemAS;
volatile bool booted;
#define MP_WAITTIME 250000000ULL
#define CPUSTATE_NOT_PRESENT 0
#define CPUSTATE_BOOTED 1
typedef struct CPUState {
int state;
UnixEpochNS heartbeat;
} CPUState;
volatile static bool booted;
volatile static CPUState cpus[MAX_CPUS];
static int
MPBootAP(int procNo)
@ -75,18 +84,28 @@ MP_Init()
if (MPBootAP(i) < 0)
break;
}
cpus[CPU()].state = CPUSTATE_BOOTED;
}
void
MP_InitAP()
{
kprintf("AP %d booted!\n", CPU());
cpus[CPU()].state = CPUSTATE_BOOTED;
booted = 1;
}
static void
Debug_CPUS(int argc, const char *argv[])
{
int c;
for (c = 0; c < MAX_CPUS; c++) {
if (cpus[c].state != CPUSTATE_NOT_PRESENT) {
kprintf("CPU %d: BOOTED\n", c);
}
}
}
REGISTER_DBGCMD(cpus, "Show MP information", Debug_CPUS);