mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-17 16:10:46 +01:00
Hopefully I won't get flamed for this: insert a few more #if defined(I486_CPU)
and #if defined (I586_CPU) thingies into identifycpu() so that we only compile in what's actually needed for a given CPU. So far as I can tell, none of my 386 machines generate a cpu_vendor code, so I made the extra vendor and feature line conditional on I486_CPU and I586_CPU. (Otherwise we print out a blank line which looks silly.)
This commit is contained in:
parent
8a03631b28
commit
09a901eb60
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=7814
@ -422,12 +422,13 @@ identifycpu()
|
|||||||
panic("startup: bad cpu id");
|
panic("startup: bad cpu id");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef I586_CPU
|
#if defined(I586_CPU)
|
||||||
if(cpu_class == CPUCLASS_586) {
|
if(cpu_class == CPUCLASS_586) {
|
||||||
calibrate_cyclecounter();
|
calibrate_cyclecounter();
|
||||||
printf("%d-MHz ", pentium_mhz);
|
printf("%d-MHz ", pentium_mhz);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(I486_CPU) || defined(I586_CPU)
|
||||||
if (!strcmp(cpu_vendor,"GenuineIntel")) {
|
if (!strcmp(cpu_vendor,"GenuineIntel")) {
|
||||||
if ((cpu_id & 0xf00) > 3) {
|
if ((cpu_id & 0xf00) > 3) {
|
||||||
cpu_model[0] = '\0';
|
cpu_model[0] = '\0';
|
||||||
@ -442,8 +443,10 @@ identifycpu()
|
|||||||
}
|
}
|
||||||
if ((cpu_id & 0xf00) == 0x400) {
|
if ((cpu_id & 0xf00) == 0x400) {
|
||||||
strcat(cpu_model, "i486 ");
|
strcat(cpu_model, "i486 ");
|
||||||
|
#if defined(I586_CPU)
|
||||||
} else if ((cpu_id & 0xf00) == 0x500) {
|
} else if ((cpu_id & 0xf00) == 0x500) {
|
||||||
strcat(cpu_model, "Pentium ");
|
strcat(cpu_model, "Pentium ");
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
strcat(cpu_model, "unknown ");
|
strcat(cpu_model, "unknown ");
|
||||||
}
|
}
|
||||||
@ -466,7 +469,7 @@ identifycpu()
|
|||||||
break;
|
break;
|
||||||
case 0x480:
|
case 0x480:
|
||||||
strcat(cpu_model, "DX4"); break;
|
strcat(cpu_model, "DX4"); break;
|
||||||
#ifdef I586_CPU
|
#if defined(I586_CPU)
|
||||||
case 0x510:
|
case 0x510:
|
||||||
if (pentium_mhz == 60) {
|
if (pentium_mhz == 60) {
|
||||||
strcat(cpu_model, "510\\60");
|
strcat(cpu_model, "510\\60");
|
||||||
@ -489,25 +492,32 @@ identifycpu()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
printf("%s (", cpu_model);
|
printf("%s (", cpu_model);
|
||||||
switch(cpu_class) {
|
switch(cpu_class) {
|
||||||
case CPUCLASS_286:
|
case CPUCLASS_286:
|
||||||
printf("286");
|
printf("286");
|
||||||
break;
|
break;
|
||||||
|
#if defined(I386_CPU)
|
||||||
case CPUCLASS_386:
|
case CPUCLASS_386:
|
||||||
printf("386");
|
printf("386");
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if defined(I486_CPU)
|
||||||
case CPUCLASS_486:
|
case CPUCLASS_486:
|
||||||
printf("486");
|
printf("486");
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if defined(I586_CPU)
|
||||||
case CPUCLASS_586:
|
case CPUCLASS_586:
|
||||||
printf("Pentium");
|
printf("Pentium");
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
printf("unknown"); /* will panic below... */
|
printf("unknown"); /* will panic below... */
|
||||||
}
|
}
|
||||||
printf("-class CPU)\n");
|
printf("-class CPU)\n");
|
||||||
|
#if defined(I486_CPU) || defined(I586_CPU)
|
||||||
if(*cpu_vendor)
|
if(*cpu_vendor)
|
||||||
printf(" Origin = \"%s\"",cpu_vendor);
|
printf(" Origin = \"%s\"",cpu_vendor);
|
||||||
if(cpu_id)
|
if(cpu_id)
|
||||||
@ -521,7 +531,7 @@ identifycpu()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* Now that we have told the user what they have,
|
* Now that we have told the user what they have,
|
||||||
* let them know if that machine type isn't configured.
|
* let them know if that machine type isn't configured.
|
||||||
|
@ -422,12 +422,13 @@ identifycpu()
|
|||||||
panic("startup: bad cpu id");
|
panic("startup: bad cpu id");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef I586_CPU
|
#if defined(I586_CPU)
|
||||||
if(cpu_class == CPUCLASS_586) {
|
if(cpu_class == CPUCLASS_586) {
|
||||||
calibrate_cyclecounter();
|
calibrate_cyclecounter();
|
||||||
printf("%d-MHz ", pentium_mhz);
|
printf("%d-MHz ", pentium_mhz);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(I486_CPU) || defined(I586_CPU)
|
||||||
if (!strcmp(cpu_vendor,"GenuineIntel")) {
|
if (!strcmp(cpu_vendor,"GenuineIntel")) {
|
||||||
if ((cpu_id & 0xf00) > 3) {
|
if ((cpu_id & 0xf00) > 3) {
|
||||||
cpu_model[0] = '\0';
|
cpu_model[0] = '\0';
|
||||||
@ -442,8 +443,10 @@ identifycpu()
|
|||||||
}
|
}
|
||||||
if ((cpu_id & 0xf00) == 0x400) {
|
if ((cpu_id & 0xf00) == 0x400) {
|
||||||
strcat(cpu_model, "i486 ");
|
strcat(cpu_model, "i486 ");
|
||||||
|
#if defined(I586_CPU)
|
||||||
} else if ((cpu_id & 0xf00) == 0x500) {
|
} else if ((cpu_id & 0xf00) == 0x500) {
|
||||||
strcat(cpu_model, "Pentium ");
|
strcat(cpu_model, "Pentium ");
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
strcat(cpu_model, "unknown ");
|
strcat(cpu_model, "unknown ");
|
||||||
}
|
}
|
||||||
@ -466,7 +469,7 @@ identifycpu()
|
|||||||
break;
|
break;
|
||||||
case 0x480:
|
case 0x480:
|
||||||
strcat(cpu_model, "DX4"); break;
|
strcat(cpu_model, "DX4"); break;
|
||||||
#ifdef I586_CPU
|
#if defined(I586_CPU)
|
||||||
case 0x510:
|
case 0x510:
|
||||||
if (pentium_mhz == 60) {
|
if (pentium_mhz == 60) {
|
||||||
strcat(cpu_model, "510\\60");
|
strcat(cpu_model, "510\\60");
|
||||||
@ -489,25 +492,32 @@ identifycpu()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
printf("%s (", cpu_model);
|
printf("%s (", cpu_model);
|
||||||
switch(cpu_class) {
|
switch(cpu_class) {
|
||||||
case CPUCLASS_286:
|
case CPUCLASS_286:
|
||||||
printf("286");
|
printf("286");
|
||||||
break;
|
break;
|
||||||
|
#if defined(I386_CPU)
|
||||||
case CPUCLASS_386:
|
case CPUCLASS_386:
|
||||||
printf("386");
|
printf("386");
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if defined(I486_CPU)
|
||||||
case CPUCLASS_486:
|
case CPUCLASS_486:
|
||||||
printf("486");
|
printf("486");
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#if defined(I586_CPU)
|
||||||
case CPUCLASS_586:
|
case CPUCLASS_586:
|
||||||
printf("Pentium");
|
printf("Pentium");
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
printf("unknown"); /* will panic below... */
|
printf("unknown"); /* will panic below... */
|
||||||
}
|
}
|
||||||
printf("-class CPU)\n");
|
printf("-class CPU)\n");
|
||||||
|
#if defined(I486_CPU) || defined(I586_CPU)
|
||||||
if(*cpu_vendor)
|
if(*cpu_vendor)
|
||||||
printf(" Origin = \"%s\"",cpu_vendor);
|
printf(" Origin = \"%s\"",cpu_vendor);
|
||||||
if(cpu_id)
|
if(cpu_id)
|
||||||
@ -521,7 +531,7 @@ identifycpu()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* Now that we have told the user what they have,
|
* Now that we have told the user what they have,
|
||||||
* let them know if that machine type isn't configured.
|
* let them know if that machine type isn't configured.
|
||||||
|
Loading…
Reference in New Issue
Block a user