smp: Don't just fatal() if there's too many cores; initialize up to 32

This commit is contained in:
K. Lange 2021-10-12 20:04:38 +09:00
parent d60b2daccd
commit a8ca76845c
2 changed files with 6 additions and 5 deletions

View File

@ -192,7 +192,7 @@ struct ProcessorLocal {
#endif
};
extern struct ProcessorLocal processor_local_data[32];
extern struct ProcessorLocal processor_local_data[];
extern int processor_count;
/**

View File

@ -247,13 +247,13 @@ void smp_initialize(void) {
switch (entry[0]) {
case 0:
if (entry[4] & 0x01) {
if (cores == 32) { /* TODO define this somewhere better */
printf("smp: too many cores\n");
goto _toomany;
}
processor_local_data[cores].cpu_id = cores;
processor_local_data[cores].lapic_id = entry[3];
cores++;
if (cores == 33) {
printf("smp: too many cores\n");
arch_fatal();
}
}
break;
/* TODO: Other entries */
@ -262,6 +262,7 @@ void smp_initialize(void) {
}
}
_toomany:
processor_count = cores;
if (!lapic_base) return;