From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Wed, 29 Apr 1998 06:29:19 +0100 From: forsyth@caldo.demon.co.uk forsyth@caldo.demon.co.uk Subject: [9fans] AMD cpu detection Topicbox-Message-UUID: 783d4ae8-eac8-11e9-9e20-41e7f4b1d025 Message-ID: <19980429052919.YzSiTBbE4eYGzU_YXpjXjvIw_90-fP-8gLiGHDl9Ucg@z> for a 233MHz AMD/K6, on a Micronics AT-03 Twister m/board, i now use: { 5, 6, 11, "AMD-K6", }, /* determined by trial and error */ which might imply this improved approximation for the other plain K6 entry: { 5, 7, 11, "AMD-K6", }, /* guesswork */ (but i haven't got that model here). i'll try it on a 200MHz K6 when i get to the office. on boot, i get cpu0: 234MHz AuthenticAMD AMD-K6 (cpuid: AX 0x0562 DX: 0x8001BF) reducing 11 to 10 aalcycles gave 214MHz, so i use 11. further retrofitting changes required to get that far: void printcpufreq(void) { int i; char buf[128]; i = sprint(buf, "cpu%d: %dMHz ", m->machno, cpumhz); if(cpuidid[0]) i += sprint(buf+i, "%s ", cpuidid); sprint(buf+i, "%s (cpuid: AX 0x%4.4luX DX 0x%4.4luX)\n", cputype->name, cpuidax, cpuiddx); print(buf); } ie: delete m-> from several names to refer to the newly added static variables. add #define X86STEPPING(x) ((x) & 0x0F) #define X86MODEL(x) (((x)>>4) & 0x0F) #define X86FAMILY(x) (((x)>>8) & 0x0F) to the top of io.h and put #define CPUID BYTE $0x0F; BYTE $0xA2 /* CPUID, argument in AX */ after #define NOP XCHGL AX,AX in l.s i think that's all i did to get it to work.