From f90f68d129d47f07217302594d04ffb3d3ef38b7 Mon Sep 17 00:00:00 2001 From: Malcolm Jestadt Date: Fri, 31 May 2019 23:34:46 -0400 Subject: [PATCH] Detect tsx_force_abort presence and print to log --- Utilities/sysinfo.cpp | 13 +++++++++++++ Utilities/sysinfo.h | 2 ++ 2 files changed, 15 insertions(+) mode change 100644 => 100755 Utilities/sysinfo.cpp mode change 100644 => 100755 Utilities/sysinfo.h diff --git a/Utilities/sysinfo.cpp b/Utilities/sysinfo.cpp old mode 100644 new mode 100755 index 59af3afd9e..31a6a72424 --- a/Utilities/sysinfo.cpp +++ b/Utilities/sysinfo.cpp @@ -44,6 +44,12 @@ bool utils::has_rtm() return g_value; } +bool utils::has_tsx_force_abort() +{ + static const bool g_value = get_cpuid(0, 0)[0] >= 0x7 && (get_cpuid(7, 0)[3] & 0x2000) == 0x2000; + return g_value; +} + bool utils::has_mpx() { static const bool g_value = get_cpuid(0, 0)[0] >= 0x7 && (get_cpuid(7, 0)[1] & 0x4000) == 0x4000; @@ -127,10 +133,17 @@ std::string utils::get_system_info() if (has_rtm()) { result += " | TSX"; + + if (has_tsx_force_abort()) + { + result += "-FA"; + } + if (!has_mpx()) { result += " disabled by default"; } + } return result; diff --git a/Utilities/sysinfo.h b/Utilities/sysinfo.h old mode 100644 new mode 100755 index ba07c22a9f..71d1d2e81b --- a/Utilities/sysinfo.h +++ b/Utilities/sysinfo.h @@ -37,6 +37,8 @@ namespace utils bool has_rtm(); + bool has_tsx_force_abort(); + bool has_mpx(); bool has_512();