From d3fb1d6c3882e45dee66fe7e5cf7613268e1b7bb Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 19 Aug 2017 11:28:22 -0500 Subject: [PATCH 1/6] Dyncom: Fixed a conversion warning when decoding thumb instructions. --- src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index f4fbb8d04..f829b9229 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp @@ -759,7 +759,7 @@ static ThumbDecodeStatus DecodeThumbInstruction(u32 inst, u32 addr, u32* arm_ins ThumbDecodeStatus ret = TranslateThumbInstruction(addr, inst, arm_inst, inst_size); if (ret == ThumbDecodeStatus::BRANCH) { int inst_index; - int table_length = arm_instruction_trans_len; + int table_length = static_cast(arm_instruction_trans_len); u32 tinstr = GetThumbInstruction(inst, addr); switch ((tinstr & 0xF800) >> 11) { From 9d0841b48b6b6f3c5a2425922617343fc2f79cdc Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 19 Aug 2017 11:30:20 -0500 Subject: [PATCH 2/6] Dyncom: Use size_t instead of int to store the instruction offsets in the instruction cache. Fixes a few warnings. --- src/core/arm/dyncom/arm_dyncom_interpreter.cpp | 6 +++--- src/core/arm/skyeye_common/armstate.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp index f829b9229..3522d1e82 100644 --- a/src/core/arm/dyncom/arm_dyncom_interpreter.cpp +++ b/src/core/arm/dyncom/arm_dyncom_interpreter.cpp @@ -838,7 +838,7 @@ static unsigned int InterpreterTranslateInstruction(const ARMul_State* cpu, cons return inst_size; } -static int InterpreterTranslateBlock(ARMul_State* cpu, int& bb_start, u32 addr) { +static int InterpreterTranslateBlock(ARMul_State* cpu, std::size_t& bb_start, u32 addr) { MICROPROFILE_SCOPE(DynCom_Decode); // Decode instruction, get index @@ -871,7 +871,7 @@ static int InterpreterTranslateBlock(ARMul_State* cpu, int& bb_start, u32 addr) return KEEP_GOING; } -static int InterpreterTranslateSingle(ARMul_State* cpu, int& bb_start, u32 addr) { +static int InterpreterTranslateSingle(ARMul_State* cpu, std::size_t& bb_start, u32 addr) { MICROPROFILE_SCOPE(DynCom_Decode); ARM_INST_PTR inst_base = nullptr; @@ -1620,7 +1620,7 @@ unsigned InterpreterMainLoop(ARMul_State* cpu) { unsigned int addr; unsigned int num_instrs = 0; - int ptr; + std::size_t ptr; LOAD_NZCVT; DISPATCH : { diff --git a/src/core/arm/skyeye_common/armstate.h b/src/core/arm/skyeye_common/armstate.h index 1a707ff7e..893877797 100644 --- a/src/core/arm/skyeye_common/armstate.h +++ b/src/core/arm/skyeye_common/armstate.h @@ -230,7 +230,7 @@ public: // TODO(bunnei): Move this cache to a better place - it should be per codeset (likely per // process for our purposes), not per ARMul_State (which tracks CPU core state). - std::unordered_map instruction_cache; + std::unordered_map instruction_cache; private: void ResetMPCoreCP15Registers(); From d237a890482b62c90c58691863dabd609c2aa34e Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 19 Aug 2017 11:33:01 -0500 Subject: [PATCH 3/6] CPU/Dynarmic: Fixed a warning when incrementing the number of ticks in ExecuteInstructions. --- src/core/arm/dynarmic/arm_dynarmic.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/arm/dynarmic/arm_dynarmic.cpp b/src/core/arm/dynarmic/arm_dynarmic.cpp index 7d2790b08..0a0b91590 100644 --- a/src/core/arm/dynarmic/arm_dynarmic.cpp +++ b/src/core/arm/dynarmic/arm_dynarmic.cpp @@ -136,7 +136,7 @@ MICROPROFILE_DEFINE(ARM_Jit, "ARM JIT", "ARM JIT", MP_RGB(255, 64, 64)); void ARM_Dynarmic::ExecuteInstructions(int num_instructions) { MICROPROFILE_SCOPE(ARM_Jit); - unsigned ticks_executed = jit->Run(static_cast(num_instructions)); + std::size_t ticks_executed = jit->Run(static_cast(num_instructions)); AddTicks(ticks_executed); } From 145a7293a32c6fb25f1db796f7e1dd6c4efc985e Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 19 Aug 2017 11:37:21 -0500 Subject: [PATCH 4/6] HLE/Applets: Fixed some conversion warnings when creating the framebuffer shared memory objects. --- src/core/hle/applets/erreula.cpp | 4 ++-- src/core/hle/applets/mii_selector.cpp | 4 ++-- src/core/hle/applets/mint.cpp | 4 ++-- src/core/hle/applets/swkbd.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/hle/applets/erreula.cpp b/src/core/hle/applets/erreula.cpp index 75d7fd9fc..518f371f5 100644 --- a/src/core/hle/applets/erreula.cpp +++ b/src/core/hle/applets/erreula.cpp @@ -31,8 +31,8 @@ ResultCode ErrEula::ReceiveParameter(const Service::APT::MessageParameter& param heap_memory = std::make_shared>(capture_info.size); // Create a SharedMemory that directly points to this heap block. framebuffer_memory = Kernel::SharedMemory::CreateForApplet( - heap_memory, 0, heap_memory->size(), MemoryPermission::ReadWrite, - MemoryPermission::ReadWrite, "ErrEula Memory"); + heap_memory, 0, capture_info.size, MemoryPermission::ReadWrite, MemoryPermission::ReadWrite, + "ErrEula Memory"); // Send the response message with the newly created SharedMemory Service::APT::MessageParameter result; diff --git a/src/core/hle/applets/mii_selector.cpp b/src/core/hle/applets/mii_selector.cpp index 89f08daa2..705859f1e 100644 --- a/src/core/hle/applets/mii_selector.cpp +++ b/src/core/hle/applets/mii_selector.cpp @@ -38,8 +38,8 @@ ResultCode MiiSelector::ReceiveParameter(const Service::APT::MessageParameter& p heap_memory = std::make_shared>(capture_info.size); // Create a SharedMemory that directly points to this heap block. framebuffer_memory = Kernel::SharedMemory::CreateForApplet( - heap_memory, 0, heap_memory->size(), MemoryPermission::ReadWrite, - MemoryPermission::ReadWrite, "MiiSelector Memory"); + heap_memory, 0, capture_info.size, MemoryPermission::ReadWrite, MemoryPermission::ReadWrite, + "MiiSelector Memory"); // Send the response message with the newly created SharedMemory Service::APT::MessageParameter result; diff --git a/src/core/hle/applets/mint.cpp b/src/core/hle/applets/mint.cpp index 31a79ea17..50d79190b 100644 --- a/src/core/hle/applets/mint.cpp +++ b/src/core/hle/applets/mint.cpp @@ -31,8 +31,8 @@ ResultCode Mint::ReceiveParameter(const Service::APT::MessageParameter& paramete heap_memory = std::make_shared>(capture_info.size); // Create a SharedMemory that directly points to this heap block. framebuffer_memory = Kernel::SharedMemory::CreateForApplet( - heap_memory, 0, heap_memory->size(), MemoryPermission::ReadWrite, - MemoryPermission::ReadWrite, "Mint Memory"); + heap_memory, 0, capture_info.size, MemoryPermission::ReadWrite, MemoryPermission::ReadWrite, + "Mint Memory"); // Send the response message with the newly created SharedMemory Service::APT::MessageParameter result; diff --git a/src/core/hle/applets/swkbd.cpp b/src/core/hle/applets/swkbd.cpp index fdf8807b0..0bc471a3a 100644 --- a/src/core/hle/applets/swkbd.cpp +++ b/src/core/hle/applets/swkbd.cpp @@ -41,8 +41,8 @@ ResultCode SoftwareKeyboard::ReceiveParameter(Service::APT::MessageParameter con heap_memory = std::make_shared>(capture_info.size); // Create a SharedMemory that directly points to this heap block. framebuffer_memory = Kernel::SharedMemory::CreateForApplet( - heap_memory, 0, heap_memory->size(), MemoryPermission::ReadWrite, - MemoryPermission::ReadWrite, "SoftwareKeyboard Memory"); + heap_memory, 0, capture_info.size, MemoryPermission::ReadWrite, MemoryPermission::ReadWrite, + "SoftwareKeyboard Memory"); // Send the response message with the newly created SharedMemory Service::APT::MessageParameter result; From 65f19b51c43fbc35a1f1bfb81d773eaf6b5fffd3 Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 19 Aug 2017 12:04:40 -0500 Subject: [PATCH 5/6] Warnings: Add UNREACHABLE macros to switches that contemplate all possible values. --- src/core/file_sys/archive_backend.cpp | 2 ++ src/core/hle/kernel/kernel.h | 3 +++ src/core/hw/gpu.h | 4 ++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/file_sys/archive_backend.cpp b/src/core/file_sys/archive_backend.cpp index 1fae0ede0..87a240d7a 100644 --- a/src/core/file_sys/archive_backend.cpp +++ b/src/core/file_sys/archive_backend.cpp @@ -90,6 +90,8 @@ std::u16string Path::AsU16Str() const { LOG_ERROR(Service_FS, "LowPathType cannot be converted to u16string!"); return {}; } + + UNREACHABLE(); } std::vector Path::AsBinary() const { diff --git a/src/core/hle/kernel/kernel.h b/src/core/hle/kernel/kernel.h index 9cf288b08..142bb84b2 100644 --- a/src/core/hle/kernel/kernel.h +++ b/src/core/hle/kernel/kernel.h @@ -8,6 +8,7 @@ #include #include #include +#include "common/assert.h" #include "common/common_types.h" namespace Kernel { @@ -84,6 +85,8 @@ public: case HandleType::ClientSession: return false; } + + UNREACHABLE(); } public: diff --git a/src/core/hw/gpu.h b/src/core/hw/gpu.h index 21b127fee..e3d0a0e08 100644 --- a/src/core/hw/gpu.h +++ b/src/core/hw/gpu.h @@ -74,9 +74,9 @@ struct Regs { case PixelFormat::RGB5A1: case PixelFormat::RGBA4: return 2; - default: - UNIMPLEMENTED(); } + + UNREACHABLE(); } INSERT_PADDING_WORDS(0x4); From 8a9a4e2c42b6c2326140f7369374bf78a4645a8f Mon Sep 17 00:00:00 2001 From: Subv Date: Sat, 19 Aug 2017 12:09:35 -0500 Subject: [PATCH 6/6] GPU/Warnings: Explicitly cast the screen refresh ticks to u64. --- src/core/hw/gpu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/hw/gpu.cpp b/src/core/hw/gpu.cpp index 6838e449c..83ad9d898 100644 --- a/src/core/hw/gpu.cpp +++ b/src/core/hw/gpu.cpp @@ -29,7 +29,7 @@ namespace GPU { Regs g_regs; /// 268MHz CPU clocks / 60Hz frames per second -const u64 frame_ticks = BASE_CLOCK_RATE_ARM11 / SCREEN_REFRESH_RATE; +const u64 frame_ticks = static_cast(BASE_CLOCK_RATE_ARM11 / SCREEN_REFRESH_RATE); /// Event id for CoreTiming static int vblank_event;