aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common/mac/arch_utilities.cc28
-rw-r--r--src/third_party/mac_headers/mach/machine.h1
2 files changed, 25 insertions, 4 deletions
diff --git a/src/common/mac/arch_utilities.cc b/src/common/mac/arch_utilities.cc
index 4e5f5534..c9225e00 100644
--- a/src/common/mac/arch_utilities.cc
+++ b/src/common/mac/arch_utilities.cc
@@ -111,6 +111,7 @@ namespace {
enum Architecture {
kArch_i386 = 0,
kArch_x86_64,
+ kArch_x86_64h,
kArch_arm,
kArch_arm64,
kArch_ppc,
@@ -136,6 +137,13 @@ const NXArchInfo kKnownArchitectures[] = {
"Intel x86-64"
},
{
+ "x86_64h",
+ CPU_TYPE_X86_64,
+ CPU_SUBTYPE_X86_64_H,
+ NX_LittleEndian,
+ "Intel x86-64h Haswell"
+ },
+ {
"arm",
CPU_TYPE_ARM,
CPU_SUBTYPE_ARM_ALL,
@@ -189,23 +197,35 @@ const NXArchInfo *NXGetArchInfoFromName(const char *name) {
const NXArchInfo *NXGetArchInfoFromCpuType(cpu_type_t cputype,
cpu_subtype_t cpusubtype) {
+ const NXArchInfo *candidate = NULL;
for (int arch = 0; arch < kNumArchitectures; ++arch) {
if (kKnownArchitectures[arch].cputype == cputype) {
- return &kKnownArchitectures[arch];
+ if (kKnownArchitectures[arch].cpusubtype == cpusubtype) {
+ return &kKnownArchitectures[arch];
+ }
+ if (!candidate) {
+ candidate = &kKnownArchitectures[arch];
+ }
}
}
- return NULL;
+ return candidate;
}
struct fat_arch *NXFindBestFatArch(cpu_type_t cputype,
cpu_subtype_t cpusubtype,
struct fat_arch *fat_archs,
uint32_t nfat_archs) {
+ struct fat_arch *candidate = NULL;
for (uint32_t f = 0; f < nfat_archs; ++f) {
if (fat_archs[f].cputype == cputype) {
- return &fat_archs[f];
+ if (fat_archs[f].cpusubtype == cpusubtype) {
+ return &fat_archs[f];
+ }
+ if (!candidate) {
+ candidate = &fat_archs[f];
+ }
}
}
- return NULL;
+ return candidate;
}
#endif // !__APPLE__
diff --git a/src/third_party/mac_headers/mach/machine.h b/src/third_party/mac_headers/mach/machine.h
index 91d9d709..5bb21e48 100644
--- a/src/third_party/mac_headers/mach/machine.h
+++ b/src/third_party/mac_headers/mach/machine.h
@@ -228,6 +228,7 @@ typedef integer_t cpu_threadtype_t;
#define CPU_SUBTYPE_X86_ALL ((cpu_subtype_t)3)
#define CPU_SUBTYPE_X86_64_ALL ((cpu_subtype_t)3)
#define CPU_SUBTYPE_X86_ARCH1 ((cpu_subtype_t)4)
+#define CPU_SUBTYPE_X86_64_H ((cpu_subtype_t)8) /* Haswell feature subset */
#define CPU_THREADTYPE_INTEL_HTT ((cpu_threadtype_t) 1)