From 5b2b2a3cc12ed9a87e40d4d0b8545d049775ef1d Mon Sep 17 00:00:00 2001 From: gibbed Date: Mon, 26 Nov 2018 09:04:10 -0600 Subject: [PATCH 1/5] [Kernel] Fix logging of app for XMsgInProcessCall/XMsgSystemProcessCall/XMsgStartIORequest/XMsgStartIORequestEx. --- src/xenia/kernel/xam/xam_msg.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/xenia/kernel/xam/xam_msg.cc b/src/xenia/kernel/xam/xam_msg.cc index 3dec932a2..07d0be6c7 100644 --- a/src/xenia/kernel/xam/xam_msg.cc +++ b/src/xenia/kernel/xam/xam_msg.cc @@ -23,7 +23,7 @@ dword_result_t XMsgInProcessCall(dword_t app, dword_t message, dword_t arg1, auto result = kernel_state()->app_manager()->DispatchMessageSync(app, message, arg1, arg2); if (result == X_ERROR_NOT_FOUND) { - XELOGE("XMsgInProcessCall: app %.8X undefined", app); + XELOGE("XMsgInProcessCall: app %.8X undefined", (uint32_t)app); } return result; } @@ -34,7 +34,7 @@ dword_result_t XMsgSystemProcessCall(dword_t app, dword_t message, auto result = kernel_state()->app_manager()->DispatchMessageAsync( app, message, buffer, buffer_length); if (result == X_ERROR_NOT_FOUND) { - XELOGE("XMsgSystemProcessCall: app %.8X undefined", app); + XELOGE("XMsgSystemProcessCall: app %.8X undefined", (uint32_t)app); } return result; } @@ -46,7 +46,7 @@ dword_result_t XMsgStartIORequest(dword_t app, dword_t message, auto result = kernel_state()->app_manager()->DispatchMessageAsync( app, message, buffer, buffer_length); if (result == X_ERROR_NOT_FOUND) { - XELOGE("XMsgStartIORequest: app %.8X undefined", app); + XELOGE("XMsgStartIORequest: app %.8X undefined", (uint32_t)app); } if (overlapped_ptr) { kernel_state()->CompleteOverlappedImmediate(overlapped_ptr, result); @@ -63,7 +63,7 @@ dword_result_t XMsgStartIORequestEx(dword_t app, dword_t message, auto result = kernel_state()->app_manager()->DispatchMessageAsync( app, message, buffer, buffer_length); if (result == X_ERROR_NOT_FOUND) { - XELOGE("XMsgStartIORequestEx: app %.8X undefined", app); + XELOGE("XMsgStartIORequestEx: app %.8X undefined", (uint32_t)app); } if (overlapped_ptr) { kernel_state()->CompleteOverlappedImmediate(overlapped_ptr, result); From 28b494dadc5cbcc74ba47784872b0b58ca89d7a3 Mon Sep 17 00:00:00 2001 From: gibbed Date: Mon, 26 Nov 2018 10:21:09 -0600 Subject: [PATCH 2/5] [Kernel] Stub XMsg app 0x000000FE/msg 0x00020021. --- src/xenia/kernel/xam/app_manager.cc | 4 +- src/xenia/kernel/xam/apps/unknown_fe_app.cc | 55 +++++++++++++++++++++ src/xenia/kernel/xam/apps/unknown_fe_app.h | 34 +++++++++++++ 3 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 src/xenia/kernel/xam/apps/unknown_fe_app.cc create mode 100644 src/xenia/kernel/xam/apps/unknown_fe_app.h diff --git a/src/xenia/kernel/xam/app_manager.cc b/src/xenia/kernel/xam/app_manager.cc index e83740776..fc18ca729 100644 --- a/src/xenia/kernel/xam/app_manager.cc +++ b/src/xenia/kernel/xam/app_manager.cc @@ -10,6 +10,7 @@ #include "xenia/kernel/xam/app_manager.h" #include "xenia/kernel/kernel_state.h" +#include "xenia/kernel/xam/apps/unknown_fe_app.h" #include "xenia/kernel/xam/apps/xgi_app.h" #include "xenia/kernel/xam/apps/xlivebase_app.h" #include "xenia/kernel/xam/apps/xmp_app.h" @@ -24,9 +25,10 @@ App::App(KernelState* kernel_state, uint32_t app_id) app_id_(app_id) {} void AppManager::RegisterApps(KernelState* kernel_state, AppManager* manager) { + manager->RegisterApp(std::make_unique(kernel_state)); manager->RegisterApp(std::make_unique(kernel_state)); manager->RegisterApp(std::make_unique(kernel_state)); - manager->RegisterApp(std::make_unique(kernel_state)); + manager->RegisterApp(std::make_unique(kernel_state)); } void AppManager::RegisterApp(std::unique_ptr app) { diff --git a/src/xenia/kernel/xam/apps/unknown_fe_app.cc b/src/xenia/kernel/xam/apps/unknown_fe_app.cc new file mode 100644 index 000000000..cb05a339e --- /dev/null +++ b/src/xenia/kernel/xam/apps/unknown_fe_app.cc @@ -0,0 +1,55 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2015 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#include "xenia/kernel/xam/apps/unknown_fe_app.h" + +#include "xenia/base/logging.h" +#include "xenia/base/threading.h" + +namespace xe { +namespace kernel { +namespace xam { +namespace apps { + +UnknownFEApp::UnknownFEApp(KernelState* kernel_state) + : App(kernel_state, 0xFE) {} + +X_RESULT UnknownFEApp::DispatchMessageSync(uint32_t message, + uint32_t buffer_ptr, + uint32_t buffer_length) { + // NOTE: buffer_length may be zero or valid. + auto buffer = memory_->TranslateVirtual(buffer_ptr); + switch (message) { + case 0x00020021: { + struct message_data { + char unk_00[64]; + xe::be unk_40; // KeGetCurrentProcessType() < 1 ? 1 : 0 + xe::be unk_44; // ? output_ptr ? + xe::be unk_48; // ? overlapped_ptr ? + }* data = reinterpret_cast(buffer); + assert_true(buffer_length == sizeof(message_data)); + auto unk = memory_->TranslateVirtual*>(data->unk_44); + *unk = 0; + XELOGD("UnknownFEApp(0x00020021)('%s', %.8X, %.8X, %.8X)", data->unk_00, + (uint32_t)data->unk_40, (uint32_t)data->unk_44, + (uint32_t)data->unk_48); + return X_ERROR_SUCCESS; + } + } + XELOGE( + "Unimplemented 0xFE message app=%.8X, msg=%.8X, arg1=%.8X, " + "arg2=%.8X", + app_id(), message, buffer_ptr, buffer_length); + return X_STATUS_UNSUCCESSFUL; +} + +} // namespace apps +} // namespace xam +} // namespace kernel +} // namespace xe diff --git a/src/xenia/kernel/xam/apps/unknown_fe_app.h b/src/xenia/kernel/xam/apps/unknown_fe_app.h new file mode 100644 index 000000000..f2d764f17 --- /dev/null +++ b/src/xenia/kernel/xam/apps/unknown_fe_app.h @@ -0,0 +1,34 @@ +/** + ****************************************************************************** + * Xenia : Xbox 360 Emulator Research Project * + ****************************************************************************** + * Copyright 2015 Ben Vanik. All rights reserved. * + * Released under the BSD license - see LICENSE in the root for more details. * + ****************************************************************************** + */ + +#ifndef XENIA_KERNEL_XAM_APPS_UNKNOWN_FE_APP_H_ +#define XENIA_KERNEL_XAM_APPS_UNKNOWN_FE_APP_H_ + +#include "xenia/kernel/kernel_state.h" +#include "xenia/kernel/xam/app_manager.h" + +namespace xe { +namespace kernel { +namespace xam { +namespace apps { + +class UnknownFEApp : public App { + public: + explicit UnknownFEApp(KernelState* kernel_state); + + X_RESULT DispatchMessageSync(uint32_t message, uint32_t buffer_ptr, + uint32_t buffer_length) override; +}; + +} // namespace apps +} // namespace xam +} // namespace kernel +} // namespace xe + +#endif // XENIA_KERNEL_XAM_APPS_UNKNOWN_FE_APP_H_ From 08be8af5c0efc4e2f0f06dd5e290c03d8b6ea87a Mon Sep 17 00:00:00 2001 From: gibbed Date: Mon, 26 Nov 2018 10:24:17 -0600 Subject: [PATCH 3/5] [App] Abort out early with an error message if CPU does not support AVX. --- src/xenia/app/xenia_main.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/xenia/app/xenia_main.cc b/src/xenia/app/xenia_main.cc index 2597fc02f..98dcbf4f4 100644 --- a/src/xenia/app/xenia_main.cc +++ b/src/xenia/app/xenia_main.cc @@ -37,6 +37,8 @@ #include "xenia/hid/xinput/xinput_hid.h" #endif // XE_PLATFORM_WIN32 +#include "third_party/xbyak/xbyak/xbyak_util.h" + DEFINE_string(apu, "any", "Audio system. Use: [any, nop, xaudio2]"); DEFINE_string(gpu, "any", "Graphics system. Use: [any, vulkan, null]"); DEFINE_string(hid, "any", "Input system. Use: [any, nop, winkey, xinput]"); @@ -138,6 +140,14 @@ int xenia_main(const std::vector& args) { Profiler::Initialize(); Profiler::ThreadEnter("main"); + Xbyak::util::Cpu cpu; + if (!cpu.has(Xbyak::util::Cpu::tAVX)) { + xe::FatalError( + "Your CPU is too old to support Xenia. See the FAQ for system " + "requirements at https://xenia.jp"); + return -1; + } + // Figure out where content should go. std::wstring content_root; if (!FLAGS_content_root.empty()) { From e7d77f4780d359837dd2735241ff5a2040a457e9 Mon Sep 17 00:00:00 2001 From: gibbed Date: Mon, 26 Nov 2018 10:33:22 -0600 Subject: [PATCH 4/5] Clarify AVX requirement error message. --- src/xenia/app/xenia_main.cc | 4 ++-- src/xenia/cpu/backend/x64/x64_emitter.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/xenia/app/xenia_main.cc b/src/xenia/app/xenia_main.cc index 98dcbf4f4..5ea224000 100644 --- a/src/xenia/app/xenia_main.cc +++ b/src/xenia/app/xenia_main.cc @@ -143,8 +143,8 @@ int xenia_main(const std::vector& args) { Xbyak::util::Cpu cpu; if (!cpu.has(Xbyak::util::Cpu::tAVX)) { xe::FatalError( - "Your CPU is too old to support Xenia. See the FAQ for system " - "requirements at https://xenia.jp"); + "Your CPU does not support AVX, which is required by Xenia. See the " + "FAQ for system requirements at https://xenia.jp"); return -1; } diff --git a/src/xenia/cpu/backend/x64/x64_emitter.cc b/src/xenia/cpu/backend/x64/x64_emitter.cc index 7ffd7b582..28e5f86e4 100644 --- a/src/xenia/cpu/backend/x64/x64_emitter.cc +++ b/src/xenia/cpu/backend/x64/x64_emitter.cc @@ -82,8 +82,8 @@ X64Emitter::X64Emitter(X64Backend* backend, XbyakAllocator* allocator) if (!cpu_.has(Xbyak::util::Cpu::tAVX)) { xe::FatalError( - "Your CPU is too old to support Xenia. See the FAQ for system " - "requirements at https://xenia.jp"); + "Your CPU does not support AVX, which is required by Xenia. See the " + "FAQ for system requirements at https://xenia.jp"); return; } } From da8f094bf8e4c1a57f741cc61af8a5735488cd60 Mon Sep 17 00:00:00 2001 From: gibbed Date: Mon, 26 Nov 2018 11:21:37 -0600 Subject: [PATCH 5/5] [App] Fix Travis whining. --- src/xenia/app/premake5.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/xenia/app/premake5.lua b/src/xenia/app/premake5.lua index fd4f5b87b..b907adb63 100644 --- a/src/xenia/app/premake5.lua +++ b/src/xenia/app/premake5.lua @@ -42,6 +42,8 @@ project("xenia-app") "WinMain", -- Use WinMain instead of main. }) defines({ + "XBYAK_NO_OP_NAMES", + "XBYAK_ENABLE_OMITTED_OPERAND", }) includedirs({ project_root.."/third_party/gflags/src",