diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-12-31 13:25:13 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-12-31 21:26:10 +0000 |
commit | 93efc201159cb045325956f97570d65fe42fca8d (patch) | |
tree | 0cb3e73ad48598688589f16c7bc83a0678759522 | |
parent | c15b7499463175cf69d70c972997483647640586 (diff) | |
download | wireshark-93efc201159cb045325956f97570d65fe42fca8d.tar.gz wireshark-93efc201159cb045325956f97570d65fe42fca8d.tar.bz2 wireshark-93efc201159cb045325956f97570d65fe42fca8d.zip |
"#else", not "#elif", for the last part of a chain of conditionals.
Also give more details, for future reference, on how to determine
whether the processor supports CPUID.
Change-Id: I01e7173e45b0079f02338e51248238c05302dbd2
Reviewed-on: https://code.wireshark.org/review/6189
Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r-- | wsutil/ws_cpuid.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/wsutil/ws_cpuid.h b/wsutil/ws_cpuid.h index 4ef0fc88f6..c6f92c8bda 100644 --- a/wsutil/ws_cpuid.h +++ b/wsutil/ws_cpuid.h @@ -55,10 +55,32 @@ ws_cpuid(guint32 *CPUInfo, int selector) static gboolean ws_cpuid(guint32 *CPUInfo _U_, int selector _U_) { - /* TODO: need a test if older proccesors have the cpuid instruction */ + /* + * TODO: need a test if older proccesors have the cpuid instruction. + * + * The correct way to test for this, according to the Intel64/IA-32 + * documentation from Intel, in section 17.1 "USING THE CPUID + * INSTRUCTION", is to try to change the ID bit (bit 21) in + * EFLAGS. If it can be changed, the machine supports CPUID, + * otherwise it doesn't. + * + * Some 486's, and all subsequent processors, support CPUID. + * + * For those who are curious, the way you distinguish between + * an 80386 and an 80486 is to try to set the flag in EFLAGS + * that causes unaligned accesses to fault - that's bit 18. + * However, if the SMAP bit is set in CR4, that bit controls + * whether explicit supervisor-mode access to user-mode pages + * are allowed, so that should presumably only be done in a + * very controlled environment, such as the system boot process. + * + * So, if you want to find out what type of CPU the system has, + * it's probably best to ask the OS, if it supplies the result + * of any CPU type testing it's done. + */ return FALSE; } -#elif +#else /* not x86 */ static gboolean ws_cpuid(guint32 *CPUInfo _U_, int selector _U_) { |