setup initial value of MSR on ppc context
Fixed PrefetchW feature check Added prefetchw check to startup AVX check, there should be no CPUs that support AVX but not PrefetchW. Init VRSAVE to all ones. Removed unused disable_global_lock flag.
This commit is contained in:
@@ -14,20 +14,32 @@
|
||||
// Includes Windows headers, so it goes after platform_win.h.
|
||||
#include "third_party/xbyak/xbyak/xbyak_util.h"
|
||||
|
||||
class StartupAvxCheck {
|
||||
class StartupCpuFeatureCheck {
|
||||
public:
|
||||
StartupAvxCheck() {
|
||||
StartupCpuFeatureCheck() {
|
||||
Xbyak::util::Cpu cpu;
|
||||
if (cpu.has(Xbyak::util::Cpu::tAVX)) {
|
||||
return;
|
||||
const char* error_message = nullptr;
|
||||
if (!cpu.has(Xbyak::util::Cpu::tAVX)) {
|
||||
error_message =
|
||||
"Your CPU does not support AVX, which is required by Xenia. See "
|
||||
"the "
|
||||
"FAQ for system requirements at https://xenia.jp";
|
||||
}
|
||||
unsigned int data[4];
|
||||
Xbyak::util::Cpu::getCpuid(0x80000001, data);
|
||||
if (!(data[2] & (1U << 8))) {
|
||||
error_message =
|
||||
"Your cpu does not support PrefetchW, which Xenia Canary "
|
||||
"requires.";
|
||||
}
|
||||
if (error_message == nullptr) {
|
||||
return;
|
||||
} else {
|
||||
// TODO(gibbed): detect app type and printf instead, if needed?
|
||||
MessageBoxA(nullptr, error_message, "Xenia Error",
|
||||
MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
|
||||
ExitProcess(static_cast<uint32_t>(-1));
|
||||
}
|
||||
// TODO(gibbed): detect app type and printf instead, if needed?
|
||||
MessageBoxA(
|
||||
nullptr,
|
||||
"Your CPU does not support AVX, which is required by Xenia. See the "
|
||||
"FAQ for system requirements at https://xenia.jp",
|
||||
"Xenia Error", MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
|
||||
ExitProcess(static_cast<uint32_t>(-1));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -38,4 +50,4 @@ class StartupAvxCheck {
|
||||
// https://docs.microsoft.com/en-us/cpp/preprocessor/init-seg
|
||||
#pragma warning(suppress : 4073)
|
||||
#pragma init_seg(lib)
|
||||
static StartupAvxCheck gStartupAvxCheck;
|
||||
static StartupCpuFeatureCheck gStartupAvxCheck;
|
||||
@@ -71,6 +71,13 @@ void InitFeatureFlags() {
|
||||
unsigned int data[4];
|
||||
Xbyak::util::Cpu::getCpuid(0x80000001, data);
|
||||
unsigned amd_flags = data[2];
|
||||
// chrispy: do prefetchw manually, prefetchw is one of the features xbyak
|
||||
// ignores if you have an amd cpu.
|
||||
|
||||
if (amd_flags & (1U << 8)) {
|
||||
// no mask for prefetchw
|
||||
feature_flags_ |= kX64EmitPrefetchW;
|
||||
}
|
||||
if (amd_flags & (1U << 5)) {
|
||||
if ((cvars::x64_extension_mask & kX64EmitLZCNT) == kX64EmitLZCNT) {
|
||||
feature_flags_ |= kX64EmitLZCNT;
|
||||
|
||||
Reference in New Issue
Block a user