From bff264b5fd65aea2fabbf156d9c0c21945552e1a Mon Sep 17 00:00:00 2001 From: "chss95cs@gmail.com" Date: Sun, 30 Oct 2022 10:47:09 -0700 Subject: [PATCH] Fixed RtlCompareString and RtlCompareStringN, they were very wrong, for CompareString the params are struct ptrs not char ptrs Fixed a ton of clang-cl compiler warnings about unused variables, still many left. Fixed a lot of inconsistent override ones too --- src/xenia/app/emulator_window.cc | 4 +- src/xenia/base/filesystem_win.cc | 2 +- src/xenia/base/split_map.h | 2 - src/xenia/cpu/backend/x64/x64_sequences.cc | 4 +- .../compiler/passes/conditional_group_pass.cc | 2 - src/xenia/cpu/hir/opcodes.h | 5 +- src/xenia/cpu/mmio_handler.cc | 3 +- src/xenia/cpu/ppc/ppc_decode_data.h | 24 +++++ src/xenia/cpu/ppc/ppc_emit_altivec.cc | 6 +- .../gpu/d3d12/d3d12_command_processor.cc | 1 + src/xenia/gpu/d3d12/d3d12_command_processor.h | 3 +- src/xenia/gpu/d3d12/d3d12_texture_cache.h | 2 +- src/xenia/gpu/pm4_command_processor_declare.h | 17 +++- .../gpu/vulkan/vulkan_command_processor.h | 3 +- src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.cc | 99 ++++++++++++++----- .../kernel/xboxkrnl/xboxkrnl_threading.cc | 13 +-- src/xenia/kernel/xboxkrnl/xboxkrnl_video.cc | 2 +- 17 files changed, 134 insertions(+), 58 deletions(-) diff --git a/src/xenia/app/emulator_window.cc b/src/xenia/app/emulator_window.cc index d401eaed2..a9688aecb 100644 --- a/src/xenia/app/emulator_window.cc +++ b/src/xenia/app/emulator_window.cc @@ -614,7 +614,7 @@ bool EmulatorWindow::Initialize() { MenuItem::Type::kString, "Build commit on GitHub...", "F2", std::bind(&EmulatorWindow::ShowBuildCommit, this))); help_menu->AddChild(MenuItem::Create( - MenuItem::Type::kString, "Recent changes on GitHub...", [this]() { + MenuItem::Type::kString, "Recent changes on GitHub...", []() { LaunchWebBrowser( "https://github.com/xenia-project/xenia/compare/" XE_BUILD_COMMIT "..." XE_BUILD_BRANCH); @@ -622,7 +622,7 @@ bool EmulatorWindow::Initialize() { help_menu->AddChild(MenuItem::Create(MenuItem::Type::kSeparator)); help_menu->AddChild(MenuItem::Create( MenuItem::Type::kString, "&About...", - [this]() { LaunchWebBrowser("https://xenia.jp/about/"); })); + []() { LaunchWebBrowser("https://xenia.jp/about/"); })); } main_menu->AddChild(std::move(help_menu)); diff --git a/src/xenia/base/filesystem_win.cc b/src/xenia/base/filesystem_win.cc index f1f16c063..fb6edbb91 100644 --- a/src/xenia/base/filesystem_win.cc +++ b/src/xenia/base/filesystem_win.cc @@ -149,7 +149,7 @@ class Win32FileHandle : public FileHandle { return false; } } - bool SetLength(size_t length) { + bool SetLength(size_t length) override { LARGE_INTEGER position; position.QuadPart = length; if (!SetFilePointerEx(handle_, position, nullptr, SEEK_SET)) { diff --git a/src/xenia/base/split_map.h b/src/xenia/base/split_map.h index 510c2ed70..e52857020 100644 --- a/src/xenia/base/split_map.h +++ b/src/xenia/base/split_map.h @@ -67,8 +67,6 @@ class split_map { void InsertAt(TKey k, TValue v, uint32_t idx) { uint32_t old_size = size(); - bool needs_shiftup = idx != old_size; - values_.insert(values_.begin() + idx, v); keys_.insert(keys_.begin() + idx, k); } diff --git a/src/xenia/cpu/backend/x64/x64_sequences.cc b/src/xenia/cpu/backend/x64/x64_sequences.cc index 24c10ebef..6264cd9c3 100644 --- a/src/xenia/cpu/backend/x64/x64_sequences.cc +++ b/src/xenia/cpu/backend/x64/x64_sequences.cc @@ -808,7 +808,7 @@ static const hir::Instr* GetFirstPrecedingInstrWithPossibleFlagEffects( go_further: i = i->GetNonFakePrev(); if (!i) { - return false; + return nullptr; } iop = i->opcode->num; // context/local loads are just movs from mem. we know they will not spoil the @@ -989,7 +989,7 @@ struct COMPARE_EQ_F32 if (!HasPrecedingCmpOfSameValues(i.instr)) { EmitCommutativeBinaryXmmOp( e, i, - [&i](X64Emitter& e, I8Op dest, const Xmm& src1, const Xmm& src2) { + [](X64Emitter& e, I8Op dest, const Xmm& src1, const Xmm& src2) { e.vcomiss(src1, src2); }); } diff --git a/src/xenia/cpu/compiler/passes/conditional_group_pass.cc b/src/xenia/cpu/compiler/passes/conditional_group_pass.cc index e29eaae45..ae395be4d 100644 --- a/src/xenia/cpu/compiler/passes/conditional_group_pass.cc +++ b/src/xenia/cpu/compiler/passes/conditional_group_pass.cc @@ -48,7 +48,6 @@ bool ConditionalGroupPass::Initialize(Compiler* compiler) { bool ConditionalGroupPass::Run(HIRBuilder* builder) { bool dirty; - int loops = 0; do { assert_true(loops < 20); // arbitrary number dirty = false; @@ -68,7 +67,6 @@ bool ConditionalGroupPass::Run(HIRBuilder* builder) { dirty |= result; } } - loops++; } while (dirty); return true; } diff --git a/src/xenia/cpu/hir/opcodes.h b/src/xenia/cpu/hir/opcodes.h index 6d90f1811..1bd85cae9 100644 --- a/src/xenia/cpu/hir/opcodes.h +++ b/src/xenia/cpu/hir/opcodes.h @@ -11,7 +11,7 @@ #define XENIA_CPU_HIR_OPCODES_H_ #include - +#include "xenia/base/platform.h" namespace xe { namespace cpu { namespace hir { @@ -361,13 +361,16 @@ enum OpcodeSignature { #define GET_OPCODE_SIG_TYPE_SRC1(sig) (OpcodeSignatureType)((sig >> 3) & 0x7) #define GET_OPCODE_SIG_TYPE_SRC2(sig) (OpcodeSignatureType)((sig >> 6) & 0x7) #define GET_OPCODE_SIG_TYPE_SRC3(sig) (OpcodeSignatureType)((sig >> 9) & 0x7) +XE_MAYBE_UNUSED static bool IsOpcodeBinaryValue(uint32_t signature) { return (signature & ~(0x7)) == ((OPCODE_SIG_TYPE_V << 3) | (OPCODE_SIG_TYPE_V << 6)); } +XE_MAYBE_UNUSED static bool IsOpcodeUnaryValue(uint32_t signature) { return (signature & ~(0x7)) == ((OPCODE_SIG_TYPE_V << 3)); } +XE_MAYBE_UNUSED static void UnpackOpcodeSig(uint32_t sig, OpcodeSignatureType& dest, OpcodeSignatureType& src1, OpcodeSignatureType& src2, diff --git a/src/xenia/cpu/mmio_handler.cc b/src/xenia/cpu/mmio_handler.cc index 61f420eaa..b1e2d2964 100644 --- a/src/xenia/cpu/mmio_handler.cc +++ b/src/xenia/cpu/mmio_handler.cc @@ -185,7 +185,7 @@ bool MMIOHandler::TryDecodeLoadStore(const uint8_t* p, uint8_t rex_b = rex & 0b0001; uint8_t rex_x = rex & 0b0010; uint8_t rex_r = rex & 0b0100; - uint8_t rex_w = rex & 0b1000; + //uint8_t rex_w = rex & 0b1000; // http://www.sandpile.org/x86/opc_rm.htm // http://www.sandpile.org/x86/opc_sib.htm @@ -418,7 +418,6 @@ bool MMIOHandler::ExceptionCallback(Exception* ex) { // Quick kill anything outside our mapping. return false; } - uint64_t hostip = ex->pc(); void* fault_host_address = reinterpret_cast(ex->fault_address()); diff --git a/src/xenia/cpu/ppc/ppc_decode_data.h b/src/xenia/cpu/ppc/ppc_decode_data.h index 61ae57610..1d6d95e69 100644 --- a/src/xenia/cpu/ppc/ppc_decode_data.h +++ b/src/xenia/cpu/ppc/ppc_decode_data.h @@ -46,6 +46,7 @@ struct PPCDecodeData { uint32_t LEV() const { return bits_.LEV; } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -74,6 +75,7 @@ struct PPCDecodeData { uint32_t L() const { return bits_.RT & 0x1; } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -95,6 +97,7 @@ struct PPCDecodeData { int32_t ds() const { return static_cast(XEEXTS16(DS() << 2)); } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -174,6 +177,7 @@ struct PPCDecodeData { uint32_t CRFS() const { return bits_.RA >> 2; } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -200,6 +204,7 @@ struct PPCDecodeData { uint32_t CRFS() const { return CRBA() >> 2; } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -223,6 +228,7 @@ struct PPCDecodeData { } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -244,6 +250,7 @@ struct PPCDecodeData { bool Rc() const { return bits_.Rc ? true : false; } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -266,6 +273,7 @@ struct PPCDecodeData { bool Rc() const { return bits_.Rc ? true : false; } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -289,6 +297,7 @@ struct PPCDecodeData { bool Rc() const { return bits_.Rc ? true : false; } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -314,6 +323,7 @@ struct PPCDecodeData { bool Rc() const { return bits_.Rc ? true : false; } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -339,6 +349,7 @@ struct PPCDecodeData { bool Rc() const { return bits_.Rc ? true : false; } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -363,6 +374,7 @@ struct PPCDecodeData { bool Rc() const { return bits_.Rc ? true : false; } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -389,6 +401,7 @@ struct PPCDecodeData { bool Rc() const { return bits_.Rc ? true : false; } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -412,6 +425,7 @@ struct PPCDecodeData { int32_t SIMM() const { return static_cast(XEEXTS16(VA())); } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -431,6 +445,7 @@ struct PPCDecodeData { bool Rc() const { return bits_.Rc ? true : false; } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -452,6 +467,7 @@ struct PPCDecodeData { uint32_t SHB() const { return VC() & 0xF; } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -473,6 +489,7 @@ struct PPCDecodeData { uint32_t VB() const { return bits_.VB128l | (bits_.VB128h << 5); } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -498,6 +515,7 @@ struct PPCDecodeData { uint32_t RB() const { return bits_.RB; } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -521,6 +539,7 @@ struct PPCDecodeData { uint32_t VC() const { return bits_.VC; } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -546,6 +565,7 @@ struct PPCDecodeData { int32_t SIMM() const { return static_cast(XEEXTS16(bits_.UIMM)); } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -567,6 +587,7 @@ struct PPCDecodeData { uint32_t z() const { return bits_.z; } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -592,6 +613,7 @@ struct PPCDecodeData { uint32_t SH() const { return bits_.SH; } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -618,6 +640,7 @@ struct PPCDecodeData { bool Rc() const { return bits_.Rc ? true : false; } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; @@ -642,6 +665,7 @@ struct PPCDecodeData { uint32_t UIMM() const { return bits_.PERMl | (bits_.PERMh << 5); } private: + XE_MAYBE_UNUSED uint32_t address_; union { uint32_t value_; diff --git a/src/xenia/cpu/ppc/ppc_emit_altivec.cc b/src/xenia/cpu/ppc/ppc_emit_altivec.cc index 9ff0f45c6..386abf4bd 100644 --- a/src/xenia/cpu/ppc/ppc_emit_altivec.cc +++ b/src/xenia/cpu/ppc/ppc_emit_altivec.cc @@ -2014,8 +2014,7 @@ int InstrEmit_vupkhsh(PPCHIRBuilder& f, const InstrData& i) { return InstrEmit_vupkhsh_(f, i.VX.VD, i.VX.VB); } int InstrEmit_vupkhsh128(PPCHIRBuilder& f, const InstrData& i) { - uint32_t va = VX128_VA128; - assert_zero(va); + assert_zero(VX128_VA128); return InstrEmit_vupkhsh_(f, VX128_VD128, VX128_VB128); } @@ -2032,8 +2031,7 @@ int InstrEmit_vupklsh(PPCHIRBuilder& f, const InstrData& i) { return InstrEmit_vupklsh_(f, i.VX.VD, i.VX.VB); } int InstrEmit_vupklsh128(PPCHIRBuilder& f, const InstrData& i) { - uint32_t va = VX128_VA128; - assert_zero(va); + assert_zero(VX128_VA128); return InstrEmit_vupklsh_(f, VX128_VD128, VX128_VB128); } diff --git a/src/xenia/gpu/d3d12/d3d12_command_processor.cc b/src/xenia/gpu/d3d12/d3d12_command_processor.cc index 9f00648b0..87f9e6be8 100644 --- a/src/xenia/gpu/d3d12/d3d12_command_processor.cc +++ b/src/xenia/gpu/d3d12/d3d12_command_processor.cc @@ -5152,6 +5152,7 @@ void D3D12CommandProcessor::WriteGammaRampSRV( #define COMMAND_PROCESSOR D3D12CommandProcessor #include "../pm4_command_processor_implement.h" +#undef COMMAND_PROCESSOR } // namespace d3d12 } // namespace gpu } // namespace xe diff --git a/src/xenia/gpu/d3d12/d3d12_command_processor.h b/src/xenia/gpu/d3d12/d3d12_command_processor.h index 53a23add8..68c79d785 100644 --- a/src/xenia/gpu/d3d12/d3d12_command_processor.h +++ b/src/xenia/gpu/d3d12/d3d12_command_processor.h @@ -50,8 +50,9 @@ struct MemExportRange { }; class D3D12CommandProcessor final : public CommandProcessor { protected: +#define OVERRIDING_BASE_CMDPROCESSOR #include "../pm4_command_processor_declare.h" - +#undef OVERRIDING_BASE_CMDPROCESSOR public: explicit D3D12CommandProcessor(D3D12GraphicsSystem* graphics_system, kernel::KernelState* kernel_state); diff --git a/src/xenia/gpu/d3d12/d3d12_texture_cache.h b/src/xenia/gpu/d3d12/d3d12_texture_cache.h index e70954fb9..347772bb6 100644 --- a/src/xenia/gpu/d3d12/d3d12_texture_cache.h +++ b/src/xenia/gpu/d3d12/d3d12_texture_cache.h @@ -87,7 +87,7 @@ class D3D12TextureCache final : public TextureCache { ~D3D12TextureCache(); - void ClearCache(); + void ClearCache() override; void BeginSubmission(uint64_t new_submission_index) override; void BeginFrame() override; diff --git a/src/xenia/gpu/pm4_command_processor_declare.h b/src/xenia/gpu/pm4_command_processor_declare.h index 8db802d13..da0888f21 100644 --- a/src/xenia/gpu/pm4_command_processor_declare.h +++ b/src/xenia/gpu/pm4_command_processor_declare.h @@ -1,8 +1,15 @@ -void ExecuteIndirectBuffer(uint32_t ptr, uint32_t count) XE_RESTRICT; -virtual uint32_t ExecutePrimaryBuffer(uint32_t start_index, uint32_t end_index) XE_RESTRICT; -virtual bool ExecutePacket(); +#if defined(OVERRIDING_BASE_CMDPROCESSOR) +#define PM4_OVERRIDE override +#else +#define PM4_OVERRIDE +#endif +void ExecuteIndirectBuffer(uint32_t ptr, + uint32_t count) XE_RESTRICT; +virtual uint32_t ExecutePrimaryBuffer(uint32_t start_index, uint32_t end_index) + XE_RESTRICT PM4_OVERRIDE; +virtual bool ExecutePacket() PM4_OVERRIDE; public: void ExecutePacket(uint32_t ptr, uint32_t count); @@ -111,4 +118,6 @@ XE_COLD bool ExecutePacketType3_CountOverflow(uint32_t count); XE_NOINLINE XE_COLD -bool ExecutePacketType0_CountOverflow(uint32_t count); \ No newline at end of file +bool ExecutePacketType0_CountOverflow(uint32_t count); + +#undef PM4_OVERRIDE \ No newline at end of file diff --git a/src/xenia/gpu/vulkan/vulkan_command_processor.h b/src/xenia/gpu/vulkan/vulkan_command_processor.h index 619ae270d..5ebddf604 100644 --- a/src/xenia/gpu/vulkan/vulkan_command_processor.h +++ b/src/xenia/gpu/vulkan/vulkan_command_processor.h @@ -48,8 +48,9 @@ namespace vulkan { class VulkanCommandProcessor final : public CommandProcessor { protected: +#define OVERRIDING_BASE_CMDPROCESSOR #include "../pm4_command_processor_declare.h" - +#undef OVERRIDING_BASE_CMDPROCESSOR public: // Single-descriptor layouts for use within a single frame. enum class SingleTransientDescriptorLayout { diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.cc index 3a0d88ea4..77a46cded 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_rtl.cc @@ -28,7 +28,11 @@ namespace xe { namespace kernel { namespace xboxkrnl { - +struct X_STRING { + unsigned short length; + unsigned short pad; + uint32_t ptr; +}; // https://msdn.microsoft.com/en-us/library/ff561778 dword_result_t RtlCompareMemory_entry(lpvoid_t source1, lpvoid_t source2, dword_t length) { @@ -142,38 +146,81 @@ dword_result_t RtlLowerChar_entry(dword_t in) { } DECLARE_XBOXKRNL_EXPORT1(RtlLowerChar, kNone, kImplemented); -dword_result_t RtlCompareString_entry(lpstring_t string_1, lpstring_t string_2, - dword_t case_insensitive) { - int ret = case_insensitive ? xe_strcasecmp(string_1, string_2) - : std::strcmp(string_1, string_2); - return ret; +static int RtlCompareStringN_impl(uint8_t* string_1, unsigned int string_1_len, + uint8_t* string_2, unsigned int string_2_len, + int case_insensitive) { + if (string_1_len == 0xFFFFFFFF) { + uint8_t* string1_strlen_iter = string_1; + while (*string1_strlen_iter++) + ; + string_1_len = static_cast(string1_strlen_iter - string_1 - 1); + } + if (string_2_len == 0xFFFFFFFF) { + uint8_t* string2_strlen_iter = string_2; + while (*string2_strlen_iter++) + ; + string_2_len = static_cast(string2_strlen_iter - string_2 - 1); + } + uint8_t* string1_end = &string_1[std::min(string_2_len, string_1_len)]; + if (case_insensitive) { + while (string_1 < string1_end) { + unsigned c1 = *string_1++; + unsigned c2 = *string_2++; + if (c1 != c2) { + unsigned cu1 = rtl_upper_table[c1]; + unsigned cu2 = rtl_upper_table[c2]; + if (cu1 != cu2) { + return cu1 - cu2; + } + } + } + } else { + while (string_1 < string1_end) { + unsigned c1 = *string_1++; + unsigned c2 = *string_2++; + if (c1 != c2) { + return c1 - c2; + } + } + } + // why? not sure, but its the original logic + return string_1_len - string_2_len; } -DECLARE_XBOXKRNL_EXPORT1(RtlCompareString, kNone, kImplemented); - dword_result_t RtlCompareStringN_entry(lpstring_t string_1, dword_t string_1_len, lpstring_t string_2, dword_t string_2_len, dword_t case_insensitive) { - uint32_t len1 = string_1_len; - uint32_t len2 = string_2_len; - - if (string_1_len == 0xFFFF) { - len1 = uint32_t(std::strlen(string_1)); - } - if (string_2_len == 0xFFFF) { - len2 = uint32_t(std::strlen(string_2)); - } - auto len = std::min(string_1_len, string_2_len); - - int ret = case_insensitive ? xe_strncasecmp(string_1, string_2, len) - : std::strncmp(string_1, string_2, len); - - return ret; + return RtlCompareStringN_impl( + reinterpret_cast(string_1.host_address()), string_1_len, + reinterpret_cast(string_2.host_address()), string_2_len, + case_insensitive); } + DECLARE_XBOXKRNL_EXPORT1(RtlCompareStringN, kNone, kImplemented); +dword_result_t RtlCompareString_entry(lpvoid_t string_1, lpvoid_t string_2, + dword_t case_insensitive) { + X_STRING* xs1 = string_1.as(); + X_STRING* xs2 = string_2.as(); + + + unsigned length_1 = xe::load_and_swap(&xs1->length); + unsigned length_2 = xe::load_and_swap(&xs2->length); + + uint32_t ptr_1 = xe::load_and_swap(&xs1->ptr); + + uint32_t ptr_2 = xe::load_and_swap(&xs2->ptr); + + + auto kmem = kernel_memory(); + + return RtlCompareStringN_impl( + kmem->TranslateVirtual(ptr_1), length_1, + kmem->TranslateVirtual(ptr_2), length_2, case_insensitive); +} +DECLARE_XBOXKRNL_EXPORT1(RtlCompareString, kNone, kImplemented); // https://msdn.microsoft.com/en-us/library/ff561918 void RtlInitAnsiString_entry(pointer_t destination, lpstring_t source) { @@ -188,13 +235,13 @@ void RtlInitAnsiString_entry(pointer_t destination, destination->pointer = source.guest_address(); } DECLARE_XBOXKRNL_EXPORT1(RtlInitAnsiString, kNone, kImplemented); -//https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlupcaseunicodechar +// https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlupcaseunicodechar dword_result_t RtlUpcaseUnicodeChar_entry(dword_t SourceCharacter) { - return std::use_facet>(std::locale()).toupper(SourceCharacter); + return std::use_facet>(std::locale()) + .toupper(SourceCharacter); } DECLARE_XBOXKRNL_EXPORT1(RtlUpcaseUnicodeChar, kNone, kImplemented); - // https://msdn.microsoft.com/en-us/library/ff561899 void RtlFreeAnsiString_entry(pointer_t string) { if (string->pointer) { diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_threading.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_threading.cc index 34cc2a685..574a91585 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_threading.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_threading.cc @@ -912,7 +912,7 @@ dword_result_t NtWaitForMultipleObjectsEx_entry( dword_t count, lpdword_t handles, dword_t wait_type, dword_t wait_mode, dword_t alertable, lpqword_t timeout_ptr) { uint64_t timeout = timeout_ptr ? static_cast(*timeout_ptr) : 0u; - if (!count || count > 64 || wait_type != 1 && wait_type) { + if (!count || count > 64 || (wait_type != 1 && wait_type)) { return X_STATUS_INVALID_PARAMETER; } return xeNtWaitForMultipleObjectsEx(count, handles, wait_type, wait_mode, @@ -997,8 +997,6 @@ void xeKeKfReleaseSpinLock(uint32_t* lock, dword_t old_irql) { void KfReleaseSpinLock_entry(lpdword_t lock_ptr, dword_t old_irql, const ppc_context_t& ppc_ctx) { - auto lock = reinterpret_cast(lock_ptr.host_address()); - assert_true(*lock_ptr == static_cast(ppc_ctx->r[13])); *lock_ptr = 0; @@ -1052,7 +1050,6 @@ void KeReleaseSpinLockFromRaisedIrql_entry(lpdword_t lock_ptr, const ppc_context_t& ppc_ctx) { // Unlock. assert_true(*lock_ptr == static_cast(ppc_ctx->r[13])); - auto lock = reinterpret_cast(lock_ptr.host_address()); *lock_ptr = 0; } DECLARE_XBOXKRNL_EXPORT2(KeReleaseSpinLockFromRaisedIrql, kThreading, @@ -1404,7 +1401,7 @@ pointer_result_t InterlockedPushEntrySList_entry( assert_not_null(entry); alignas(8) X_SLIST_HEADER old_hdr = *plist_ptr; - alignas(8) X_SLIST_HEADER new_hdr = {0}; + alignas(8) X_SLIST_HEADER new_hdr = {{0}, 0, 0}; uint32_t old_head = 0; do { old_hdr = *plist_ptr; @@ -1428,8 +1425,8 @@ pointer_result_t InterlockedPopEntrySList_entry( assert_not_null(plist_ptr); uint32_t popped = 0; - alignas(8) X_SLIST_HEADER old_hdr = {0}; - alignas(8) X_SLIST_HEADER new_hdr = {0}; + alignas(8) X_SLIST_HEADER old_hdr = {{0}, 0, 0}; + alignas(8) X_SLIST_HEADER new_hdr = {{0}, 0, 0}; do { old_hdr = *plist_ptr; auto next = kernel_memory()->TranslateVirtual( @@ -1456,7 +1453,7 @@ pointer_result_t InterlockedFlushSList_entry( assert_not_null(plist_ptr); alignas(8) X_SLIST_HEADER old_hdr = *plist_ptr; - alignas(8) X_SLIST_HEADER new_hdr = {0}; + alignas(8) X_SLIST_HEADER new_hdr = {{0}, 0, 0}; uint32_t first = 0; do { old_hdr = *plist_ptr; diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_video.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_video.cc index 531bd49de..d8e225924 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_video.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_video.cc @@ -433,7 +433,7 @@ void VdSwap_entry( return; } gpu_fetch.base_address = frontbuffer_physical_address >> 12; - + XE_MAYBE_UNUSED auto texture_format = gpu::xenos::TextureFormat(texture_format_ptr.value()); auto color_space = *color_space_ptr; assert_true(texture_format == gpu::xenos::TextureFormat::k_8_8_8_8 ||