| 1068 | } |
| 1069 | |
| 1070 | inline void queryCacheSizes_intel_codes(int& l1, int& l2, int& l3) |
| 1071 | { |
| 1072 | int abcd[4]; |
| 1073 | abcd[0] = abcd[1] = abcd[2] = abcd[3] = 0; |
| 1074 | l1 = l2 = l3 = 0; |
| 1075 | EIGEN_CPUID(abcd,0x00000002,0); |
| 1076 | unsigned char * bytes = reinterpret_cast<unsigned char *>(abcd)+2; |
| 1077 | bool check_for_p2_core2 = false; |
| 1078 | for(int i=0; i<14; ++i) |
| 1079 | { |
| 1080 | switch(bytes[i]) |
| 1081 | { |
| 1082 | case 0x0A: l1 = 8; break; // 0Ah data L1 cache, 8 KB, 2 ways, 32 byte lines |
| 1083 | case 0x0C: l1 = 16; break; // 0Ch data L1 cache, 16 KB, 4 ways, 32 byte lines |
| 1084 | case 0x0E: l1 = 24; break; // 0Eh data L1 cache, 24 KB, 6 ways, 64 byte lines |
| 1085 | case 0x10: l1 = 16; break; // 10h data L1 cache, 16 KB, 4 ways, 32 byte lines (IA-64) |
| 1086 | case 0x15: l1 = 16; break; // 15h code L1 cache, 16 KB, 4 ways, 32 byte lines (IA-64) |
| 1087 | case 0x2C: l1 = 32; break; // 2Ch data L1 cache, 32 KB, 8 ways, 64 byte lines |
| 1088 | case 0x30: l1 = 32; break; // 30h code L1 cache, 32 KB, 8 ways, 64 byte lines |
| 1089 | case 0x60: l1 = 16; break; // 60h data L1 cache, 16 KB, 8 ways, 64 byte lines, sectored |
| 1090 | case 0x66: l1 = 8; break; // 66h data L1 cache, 8 KB, 4 ways, 64 byte lines, sectored |
| 1091 | case 0x67: l1 = 16; break; // 67h data L1 cache, 16 KB, 4 ways, 64 byte lines, sectored |
| 1092 | case 0x68: l1 = 32; break; // 68h data L1 cache, 32 KB, 4 ways, 64 byte lines, sectored |
| 1093 | case 0x1A: l2 = 96; break; // code and data L2 cache, 96 KB, 6 ways, 64 byte lines (IA-64) |
| 1094 | case 0x22: l3 = 512; break; // code and data L3 cache, 512 KB, 4 ways (!), 64 byte lines, dual-sectored |
| 1095 | case 0x23: l3 = 1024; break; // code and data L3 cache, 1024 KB, 8 ways, 64 byte lines, dual-sectored |
| 1096 | case 0x25: l3 = 2048; break; // code and data L3 cache, 2048 KB, 8 ways, 64 byte lines, dual-sectored |
| 1097 | case 0x29: l3 = 4096; break; // code and data L3 cache, 4096 KB, 8 ways, 64 byte lines, dual-sectored |
| 1098 | case 0x39: l2 = 128; break; // code and data L2 cache, 128 KB, 4 ways, 64 byte lines, sectored |
| 1099 | case 0x3A: l2 = 192; break; // code and data L2 cache, 192 KB, 6 ways, 64 byte lines, sectored |
| 1100 | case 0x3B: l2 = 128; break; // code and data L2 cache, 128 KB, 2 ways, 64 byte lines, sectored |
| 1101 | case 0x3C: l2 = 256; break; // code and data L2 cache, 256 KB, 4 ways, 64 byte lines, sectored |
| 1102 | case 0x3D: l2 = 384; break; // code and data L2 cache, 384 KB, 6 ways, 64 byte lines, sectored |
| 1103 | case 0x3E: l2 = 512; break; // code and data L2 cache, 512 KB, 4 ways, 64 byte lines, sectored |
| 1104 | case 0x40: l2 = 0; break; // no integrated L2 cache (P6 core) or L3 cache (P4 core) |
| 1105 | case 0x41: l2 = 128; break; // code and data L2 cache, 128 KB, 4 ways, 32 byte lines |
| 1106 | case 0x42: l2 = 256; break; // code and data L2 cache, 256 KB, 4 ways, 32 byte lines |
| 1107 | case 0x43: l2 = 512; break; // code and data L2 cache, 512 KB, 4 ways, 32 byte lines |
| 1108 | case 0x44: l2 = 1024; break; // code and data L2 cache, 1024 KB, 4 ways, 32 byte lines |
| 1109 | case 0x45: l2 = 2048; break; // code and data L2 cache, 2048 KB, 4 ways, 32 byte lines |
| 1110 | case 0x46: l3 = 4096; break; // code and data L3 cache, 4096 KB, 4 ways, 64 byte lines |
| 1111 | case 0x47: l3 = 8192; break; // code and data L3 cache, 8192 KB, 8 ways, 64 byte lines |
| 1112 | case 0x48: l2 = 3072; break; // code and data L2 cache, 3072 KB, 12 ways, 64 byte lines |
| 1113 | case 0x49: if(l2!=0) l3 = 4096; else {check_for_p2_core2=true; l3 = l2 = 4096;} break;// code and data L3 cache, 4096 KB, 16 ways, 64 byte lines (P4) or L2 for core2 |
| 1114 | case 0x4A: l3 = 6144; break; // code and data L3 cache, 6144 KB, 12 ways, 64 byte lines |
| 1115 | case 0x4B: l3 = 8192; break; // code and data L3 cache, 8192 KB, 16 ways, 64 byte lines |
| 1116 | case 0x4C: l3 = 12288; break; // code and data L3 cache, 12288 KB, 12 ways, 64 byte lines |
| 1117 | case 0x4D: l3 = 16384; break; // code and data L3 cache, 16384 KB, 16 ways, 64 byte lines |
| 1118 | case 0x4E: l2 = 6144; break; // code and data L2 cache, 6144 KB, 24 ways, 64 byte lines |
| 1119 | case 0x78: l2 = 1024; break; // code and data L2 cache, 1024 KB, 4 ways, 64 byte lines |
| 1120 | case 0x79: l2 = 128; break; // code and data L2 cache, 128 KB, 8 ways, 64 byte lines, dual-sectored |
| 1121 | case 0x7A: l2 = 256; break; // code and data L2 cache, 256 KB, 8 ways, 64 byte lines, dual-sectored |
| 1122 | case 0x7B: l2 = 512; break; // code and data L2 cache, 512 KB, 8 ways, 64 byte lines, dual-sectored |
| 1123 | case 0x7C: l2 = 1024; break; // code and data L2 cache, 1024 KB, 8 ways, 64 byte lines, dual-sectored |
| 1124 | case 0x7D: l2 = 2048; break; // code and data L2 cache, 2048 KB, 8 ways, 64 byte lines |
| 1125 | case 0x7E: l2 = 256; break; // code and data L2 cache, 256 KB, 8 ways, 128 byte lines, sect. (IA-64) |
| 1126 | case 0x7F: l2 = 512; break; // code and data L2 cache, 512 KB, 2 ways, 64 byte lines |
| 1127 | case 0x80: l2 = 512; break; // code and data L2 cache, 512 KB, 8 ways, 64 byte lines |
no outgoing calls
no test coverage detected