From 09a901eb605300b89bcf4fdeac655a5320aec356 Mon Sep 17 00:00:00 2001 From: Bill Paul Date: Fri, 14 Apr 1995 02:06:00 +0000 Subject: [PATCH] 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.) --- sys/amd64/amd64/machdep.c | 18 ++++++++++++++---- sys/i386/i386/machdep.c | 18 ++++++++++++++---- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 2aa0e14ed91f..c5e6948f68fa 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -422,12 +422,13 @@ identifycpu() panic("startup: bad cpu id"); } -#ifdef I586_CPU +#if defined(I586_CPU) if(cpu_class == CPUCLASS_586) { calibrate_cyclecounter(); printf("%d-MHz ", pentium_mhz); } #endif +#if defined(I486_CPU) || defined(I586_CPU) if (!strcmp(cpu_vendor,"GenuineIntel")) { if ((cpu_id & 0xf00) > 3) { cpu_model[0] = '\0'; @@ -442,8 +443,10 @@ identifycpu() } if ((cpu_id & 0xf00) == 0x400) { strcat(cpu_model, "i486 "); +#if defined(I586_CPU) } else if ((cpu_id & 0xf00) == 0x500) { strcat(cpu_model, "Pentium "); +#endif } else { strcat(cpu_model, "unknown "); } @@ -466,7 +469,7 @@ identifycpu() break; case 0x480: strcat(cpu_model, "DX4"); break; -#ifdef I586_CPU +#if defined(I586_CPU) case 0x510: if (pentium_mhz == 60) { strcat(cpu_model, "510\\60"); @@ -489,25 +492,32 @@ identifycpu() } } } - +#endif printf("%s (", cpu_model); switch(cpu_class) { case CPUCLASS_286: printf("286"); break; +#if defined(I386_CPU) case CPUCLASS_386: printf("386"); break; +#endif +#if defined(I486_CPU) case CPUCLASS_486: printf("486"); break; +#endif +#if defined(I586_CPU) case CPUCLASS_586: printf("Pentium"); break; +#endif default: printf("unknown"); /* will panic below... */ } printf("-class CPU)\n"); +#if defined(I486_CPU) || defined(I586_CPU) if(*cpu_vendor) printf(" Origin = \"%s\"",cpu_vendor); if(cpu_id) @@ -521,7 +531,7 @@ identifycpu() } } printf("\n"); - +#endif /* * Now that we have told the user what they have, * let them know if that machine type isn't configured. diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 2aa0e14ed91f..c5e6948f68fa 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -422,12 +422,13 @@ identifycpu() panic("startup: bad cpu id"); } -#ifdef I586_CPU +#if defined(I586_CPU) if(cpu_class == CPUCLASS_586) { calibrate_cyclecounter(); printf("%d-MHz ", pentium_mhz); } #endif +#if defined(I486_CPU) || defined(I586_CPU) if (!strcmp(cpu_vendor,"GenuineIntel")) { if ((cpu_id & 0xf00) > 3) { cpu_model[0] = '\0'; @@ -442,8 +443,10 @@ identifycpu() } if ((cpu_id & 0xf00) == 0x400) { strcat(cpu_model, "i486 "); +#if defined(I586_CPU) } else if ((cpu_id & 0xf00) == 0x500) { strcat(cpu_model, "Pentium "); +#endif } else { strcat(cpu_model, "unknown "); } @@ -466,7 +469,7 @@ identifycpu() break; case 0x480: strcat(cpu_model, "DX4"); break; -#ifdef I586_CPU +#if defined(I586_CPU) case 0x510: if (pentium_mhz == 60) { strcat(cpu_model, "510\\60"); @@ -489,25 +492,32 @@ identifycpu() } } } - +#endif printf("%s (", cpu_model); switch(cpu_class) { case CPUCLASS_286: printf("286"); break; +#if defined(I386_CPU) case CPUCLASS_386: printf("386"); break; +#endif +#if defined(I486_CPU) case CPUCLASS_486: printf("486"); break; +#endif +#if defined(I586_CPU) case CPUCLASS_586: printf("Pentium"); break; +#endif default: printf("unknown"); /* will panic below... */ } printf("-class CPU)\n"); +#if defined(I486_CPU) || defined(I586_CPU) if(*cpu_vendor) printf(" Origin = \"%s\"",cpu_vendor); if(cpu_id) @@ -521,7 +531,7 @@ identifycpu() } } printf("\n"); - +#endif /* * Now that we have told the user what they have, * let them know if that machine type isn't configured.