Improve MP debugging
This commit is contained in:
parent
a69bfec37f
commit
8825b399c4
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user