Changeset 8882 in vbox
- Timestamp:
- May 16, 2008 11:55:20 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 30917
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/asm.h
r8277 r8882 942 942 #endif 943 943 944 945 /** 946 * Extracts the CPU family from ASMCpuId(1) or ASMCpuId(0x80000001) 947 * 948 * @returns Family. 949 * @param uEAX EAX return from ASMCpuId(1) or ASMCpuId(0x80000001). 950 */ 951 DECLINLINE(uint32_t) ASMGetCpuFamily(uint32_t uEAX) 952 { 953 return ((uEAX >> 8) & 0xf) == 0xf 954 ? ((uEAX >> 20) & 0x7f) + 0xf 955 : ((uEAX >> 8) & 0xf); 956 } 957 958 959 /** 960 * Extracts the CPU model from ASMCpuId(1) or ASMCpuId(0x80000001) 961 * 962 * @returns Model. 963 * @param uEAX EAX from ASMCpuId(1) or ASMCpuId(0x80000001). 964 */ 965 DECLINLINE(uint32_t) ASMGetCpuModel(uint32_t uEAX) 966 { 967 return ((uEAX >> 8) & 0xf) == 0xf /* family! */ 968 ? ((uEAX >> 4) & 0xf) | ((uEAX >> 12) & 0xf0) 969 : ((uEAX >> 4) & 0xf); 970 } 971 972 973 /** 974 * Extracts the CPU stepping from ASMCpuId(1) or ASMCpuId(0x80000001) 975 * 976 * @returns Model. 977 * @param uEAX EAX from ASMCpuId(1) or ASMCpuId(0x80000001). 978 */ 979 DECLINLINE(uint32_t) ASMGetCpuStepping(uint32_t uEAX) 980 { 981 return uEAX & 0xf; 982 } 983 984 944 985 /** 945 986 * Get cr0. -
trunk/src/VBox/Runtime/testcase/tstInlineAsm.cpp
r8245 r8882 182 182 { 183 183 ASMCpuId(1, &s.uEAX, &s.uEBX, &s.uECX, &s.uEDX); 184 RTPrintf("Family: % d \tExtended: %d \tEffectiv: %d\n"185 "Model: % d \tExtended: %d \tEffectiv: %d\n"184 RTPrintf("Family: %#x \tExtended: %#x \tEffectiv: %#x\n" 185 "Model: %#x \tExtended: %#x \tEffectiv: %#x\n" 186 186 "Stepping: %d\n" 187 187 "APIC ID: %#04x\n" … … 189 189 "CLFLUSH Size: %d\n" 190 190 "Brand ID: %#04x\n", 191 (s.uEAX >> 8) & 0xf, (s.uEAX >> 20) & 0x7f, ((s.uEAX >> 8) & 0xf) + (((s.uEAX >> 8) & 0xf) == 0xf ? (s.uEAX >> 20) & 0x7f : 0),192 (s.uEAX >> 4) & 0xf, (s.uEAX >> 16) & 0x0f, ((s.uEAX >> 4) & 0xf) | (((s.uEAX >> 4) & 0xf) == 0xf ? (s.uEAX >> 16) & 0x0f : 0),193 (s.uEAX >> 0) & 0xf,191 (s.uEAX >> 8) & 0xf, (s.uEAX >> 20) & 0x7f, ASMGetCpuFamily(s.uEAX), 192 (s.uEAX >> 4) & 0xf, (s.uEAX >> 16) & 0x0f, ASMGetCpuModel(s.uEAX), 193 ASMGetCpuStepping(s.uEAX), 194 194 (s.uEBX >> 24) & 0xff, 195 195 (s.uEBX >> 16) & 0xff, … … 280 280 { 281 281 ASMCpuId(0x80000001, &s.uEAX, &s.uEBX, &s.uECX, &s.uEDX); 282 RTPrintf("Family: % d \tExtended: %d \tEffectiv: %d\n"283 "Model: % d \tExtended: %d \tEffectiv: %d\n"282 RTPrintf("Family: %#x \tExtended: %#x \tEffectiv: %#x\n" 283 "Model: %#x \tExtended: %#x \tEffectiv: %#x\n" 284 284 "Stepping: %d\n" 285 285 "Brand ID: %#05x\n", 286 (s.uEAX >> 8) & 0xf, (s.uEAX >> 20) & 0x7f, ((s.uEAX >> 8) & 0xf) + (((s.uEAX >> 8) & 0xf) == 0xf ? (s.uEAX >> 20) & 0x7f : 0),287 (s.uEAX >> 4) & 0xf, (s.uEAX >> 16) & 0x0f, ((s.uEAX >> 4) & 0xf) | (((s.uEAX >> 4) & 0xf) == 0xf ? (s.uEAX >> 16) & 0x0f : 0),288 (s.uEAX >> 0) & 0xf,286 (s.uEAX >> 8) & 0xf, (s.uEAX >> 20) & 0x7f, ASMGetCpuFamily(s.uEAX), 287 (s.uEAX >> 4) & 0xf, (s.uEAX >> 16) & 0x0f, ASMGetCpuModel(s.uEAX), 288 ASMGetCpuStepping(s.uEAX), 289 289 s.uEBX & 0xfff); 290 290
Note:
See TracChangeset
for help on using the changeset viewer.