MCPcopy Create free account
hub / github.com/F-Stack/f-stack / identblue

Function identblue

freebsd/x86/x86/identcpu.c:1247–1277  ·  view source on GitHub ↗

* Distinguish IBM Blue Lightning CPU from Cyrix CPUs that does not * support cpuid instruction. This function should be called after * loading interrupt descriptor table register. * * I don't like this method that handles fault, but I couldn't get * information for any other methods. Does blue giant know? */

Source from the content-addressed store, hash-verified

1245 * information for any other methods. Does blue giant know?
1246 */
1247static int
1248identblue(void)
1249{
1250
1251 trap_by_rdmsr = 0;
1252
1253 /*
1254 * Cyrix 486-class CPU does not support rdmsr instruction.
1255 * The rdmsr instruction generates invalid opcode fault, and exception
1256 * will be trapped by bluetrap6() on Cyrix 486-class CPU. The
1257 * bluetrap6() set the magic number to trap_by_rdmsr.
1258 */
1259 setidt(IDT_UD, bluetrap6, SDT_SYS386TGT, SEL_KPL,
1260 GSEL(GCODE_SEL, SEL_KPL));
1261
1262 /*
1263 * Certain BIOS disables cpuid instruction of Cyrix 6x86MX CPU.
1264 * In this case, rdmsr generates general protection fault, and
1265 * exception will be trapped by bluetrap13().
1266 */
1267 setidt(IDT_GP, bluetrap13, SDT_SYS386TGT, SEL_KPL,
1268 GSEL(GCODE_SEL, SEL_KPL));
1269
1270 rdmsr(0x1002); /* Cyrix CPU generates fault. */
1271
1272 if (trap_by_rdmsr == 0xa8c1d)
1273 return IDENTBLUE_CYRIX486;
1274 else if (trap_by_rdmsr == 0xa89c4)
1275 return IDENTBLUE_CYRIXM2;
1276 return IDENTBLUE_IBMCPU;
1277}
1278
1279/*
1280 * identifycyrix() set lower 16 bits of cyrix_did as follows:

Callers 1

finishidentcpuFunction · 0.85

Calls 2

setidtFunction · 0.50
rdmsrFunction · 0.50

Tested by

no test coverage detected