From 9a82fd9a3b7cf6ef3f4f2325287ed2d359d7cd1f Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Wed, 22 Feb 2023 02:29:07 +0100 Subject: [PATCH] early-access version 3412 --- CMakeLists.txt | 2 +- README.md | 2 +- src/core/hle/kernel/hle_ipc.h | 12 ++++++++++++ src/core/hle/kernel/svc.cpp | 16 ++++++++-------- src/core/hle/kernel/svc.h | 18 +++++++++--------- .../hle/kernel/svc/svc_address_translation.cpp | 10 +++++----- src/core/hle/kernel/svc/svc_cache.cpp | 8 ++++---- src/core/hle/kernel/svc/svc_code_memory.cpp | 4 ++-- src/core/hle/kernel/svc/svc_debug.cpp | 10 +++++----- .../kernel/svc/svc_device_address_space.cpp | 16 ++++++++-------- .../hle/kernel/svc/svc_insecure_memory.cpp | 4 ++-- src/core/hle/kernel/svc/svc_io_pool.cpp | 8 ++++---- .../hle/kernel/svc/svc_physical_memory.cpp | 2 +- src/core/hle/kernel/svc/svc_port.cpp | 2 +- src/core/hle/kernel/svc/svc_process_memory.cpp | 4 ++-- src/core/hle/kernel/svc_generator.py | 4 ++-- src/core/hle/service/sm/sm.cpp | 9 +++++++-- src/core/hle/service/sockets/sockets.h | 1 + .../hle/service/sockets/sockets_translate.cpp | 2 ++ src/core/internal_network/network.cpp | 4 ++++ src/core/internal_network/network.h | 1 + src/video_core/buffer_cache/buffer_base.h | 2 +- src/web_service/web_backend.cpp | 2 +- src/yuzu/discord_impl.cpp | 2 +- 24 files changed, 85 insertions(+), 60 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c455e73ba..2a4bf17a7 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -241,7 +241,7 @@ endif() if (ENABLE_WEB_SERVICE) find_package(cpp-jwt 1.4 CONFIG) - find_package(httplib 0.11 MODULE) + find_package(httplib 0.12 MODULE) endif() if (YUZU_TESTS) diff --git a/README.md b/README.md index b420df375..dfec8e508 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3411. +This is the source code for early-access 3412. ## Legal Notice diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h index 3cc1f5a36..632dacc83 100755 --- a/src/core/hle/kernel/hle_ipc.h +++ b/src/core/hle/kernel/hle_ipc.h @@ -147,9 +147,21 @@ public: return server_manager; } + // TODO: remove this when sm: is implemented with the proper IUserInterface + // abstraction, creating a new C++ handler object for each session: + + bool GetIsInitializedForSm() const { + return is_initialized_for_sm; + } + + void SetIsInitializedForSm() { + is_initialized_for_sm = true; + } + private: bool convert_to_domain{}; bool is_domain{}; + bool is_initialized_for_sm{}; SessionRequestHandlerPtr session_handler; std::vector domain_handlers; diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 8495e88d2..a3b79e35a 100755 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -82,7 +82,7 @@ static_assert(sizeof(uint64_t) == 8); static void SvcWrap_SetHeapSize64From32(Core::System& system) { Result ret{}; - uintptr_t out_address{}; + uint64_t out_address{}; uint32_t size{}; size = Convert(GetReg32(system, 1)); @@ -729,7 +729,7 @@ static void SvcWrap_GetLastThreadInfo64From32(Core::System& system) { Result ret{}; ilp32::LastThreadContext out_context{}; - uintptr_t out_tls_address{}; + uint64_t out_tls_address{}; uint32_t out_flags{}; ret = GetLastThreadInfo64From32(system, &out_context, &out_tls_address, &out_flags); @@ -1278,8 +1278,8 @@ static void SvcWrap_QueryPhysicalAddress64From32(Core::System& system) { static void SvcWrap_QueryIoMapping64From32(Core::System& system) { Result ret{}; - uintptr_t out_address{}; - uintptr_t out_size{}; + uint64_t out_address{}; + uint64_t out_size{}; uint64_t physical_address{}; uint32_t size{}; @@ -2088,7 +2088,7 @@ static void SvcWrap_UnmapInsecureMemory64From32(Core::System& system) { static void SvcWrap_SetHeapSize64(Core::System& system) { Result ret{}; - uintptr_t out_address{}; + uint64_t out_address{}; uint64_t size{}; size = Convert(GetReg64(system, 1)); @@ -2705,7 +2705,7 @@ static void SvcWrap_GetLastThreadInfo64(Core::System& system) { Result ret{}; lp64::LastThreadContext out_context{}; - uintptr_t out_tls_address{}; + uint64_t out_tls_address{}; uint32_t out_flags{}; ret = GetLastThreadInfo64(system, &out_context, &out_tls_address, &out_flags); @@ -3217,8 +3217,8 @@ static void SvcWrap_QueryPhysicalAddress64(Core::System& system) { static void SvcWrap_QueryIoMapping64(Core::System& system) { Result ret{}; - uintptr_t out_address{}; - uintptr_t out_size{}; + uint64_t out_address{}; + uint64_t out_size{}; uint64_t physical_address{}; uint64_t size{}; diff --git a/src/core/hle/kernel/svc.h b/src/core/hle/kernel/svc.h index 0b256af8d..da5565ed5 100755 --- a/src/core/hle/kernel/svc.h +++ b/src/core/hle/kernel/svc.h @@ -16,7 +16,7 @@ class System; namespace Kernel::Svc { // clang-format off -Result SetHeapSize(Core::System& system, uintptr_t* out_address, uint64_t size); +Result SetHeapSize(Core::System& system, uint64_t* out_address, uint64_t size); Result SetMemoryPermission(Core::System& system, uint64_t address, uint64_t size, MemoryPermission perm); Result SetMemoryAttribute(Core::System& system, uint64_t address, uint64_t size, uint32_t mask, uint32_t attr); Result MapMemory(Core::System& system, uint64_t dst_address, uint64_t src_address, uint64_t size); @@ -61,7 +61,7 @@ Result FlushDataCache(Core::System& system, uint64_t address, uint64_t size); Result MapPhysicalMemory(Core::System& system, uint64_t address, uint64_t size); Result UnmapPhysicalMemory(Core::System& system, uint64_t address, uint64_t size); Result GetDebugFutureThreadInfo(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns); -Result GetLastThreadInfo(Core::System& system, lp64::LastThreadContext* out_context, uintptr_t* out_tls_address, uint32_t* out_flags); +Result GetLastThreadInfo(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_tls_address, uint32_t* out_flags); Result GetResourceLimitLimitValue(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which); Result GetResourceLimitCurrentValue(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which); Result SetThreadActivity(Core::System& system, Handle thread_handle, ThreadActivity thread_activity); @@ -94,7 +94,7 @@ Result MapTransferMemory(Core::System& system, Handle trmem_handle, uint64_t add Result UnmapTransferMemory(Core::System& system, Handle trmem_handle, uint64_t address, uint64_t size); Result CreateInterruptEvent(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type); Result QueryPhysicalAddress(Core::System& system, lp64::PhysicalMemoryInfo* out_info, uint64_t address); -Result QueryIoMapping(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, uint64_t physical_address, uint64_t size); +Result QueryIoMapping(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint64_t size); Result CreateDeviceAddressSpace(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size); Result AttachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle); Result DetachDeviceAddressSpace(Core::System& system, DeviceName device_name, Handle das_handle); @@ -137,7 +137,7 @@ Result SetResourceLimitLimitValue(Core::System& system, Handle resource_limit_ha Result MapInsecureMemory(Core::System& system, uint64_t address, uint64_t size); Result UnmapInsecureMemory(Core::System& system, uint64_t address, uint64_t size); -Result SetHeapSize64From32(Core::System& system, uintptr_t* out_address, uint32_t size); +Result SetHeapSize64From32(Core::System& system, uint64_t* out_address, uint32_t size); Result SetMemoryPermission64From32(Core::System& system, uint32_t address, uint32_t size, MemoryPermission perm); Result SetMemoryAttribute64From32(Core::System& system, uint32_t address, uint32_t size, uint32_t mask, uint32_t attr); Result MapMemory64From32(Core::System& system, uint32_t dst_address, uint32_t src_address, uint32_t size); @@ -182,7 +182,7 @@ Result FlushDataCache64From32(Core::System& system, uint32_t address, uint32_t s Result MapPhysicalMemory64From32(Core::System& system, uint32_t address, uint32_t size); Result UnmapPhysicalMemory64From32(Core::System& system, uint32_t address, uint32_t size); Result GetDebugFutureThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns); -Result GetLastThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context, uintptr_t* out_tls_address, uint32_t* out_flags); +Result GetLastThreadInfo64From32(Core::System& system, ilp32::LastThreadContext* out_context, uint64_t* out_tls_address, uint32_t* out_flags); Result GetResourceLimitLimitValue64From32(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which); Result GetResourceLimitCurrentValue64From32(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which); Result SetThreadActivity64From32(Core::System& system, Handle thread_handle, ThreadActivity thread_activity); @@ -215,7 +215,7 @@ Result MapTransferMemory64From32(Core::System& system, Handle trmem_handle, uint Result UnmapTransferMemory64From32(Core::System& system, Handle trmem_handle, uint32_t address, uint32_t size); Result CreateInterruptEvent64From32(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type); Result QueryPhysicalAddress64From32(Core::System& system, ilp32::PhysicalMemoryInfo* out_info, uint32_t address); -Result QueryIoMapping64From32(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, uint64_t physical_address, uint32_t size); +Result QueryIoMapping64From32(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint32_t size); Result CreateDeviceAddressSpace64From32(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size); Result AttachDeviceAddressSpace64From32(Core::System& system, DeviceName device_name, Handle das_handle); Result DetachDeviceAddressSpace64From32(Core::System& system, DeviceName device_name, Handle das_handle); @@ -258,7 +258,7 @@ Result SetResourceLimitLimitValue64From32(Core::System& system, Handle resource_ Result MapInsecureMemory64From32(Core::System& system, uint32_t address, uint32_t size); Result UnmapInsecureMemory64From32(Core::System& system, uint32_t address, uint32_t size); -Result SetHeapSize64(Core::System& system, uintptr_t* out_address, uint64_t size); +Result SetHeapSize64(Core::System& system, uint64_t* out_address, uint64_t size); Result SetMemoryPermission64(Core::System& system, uint64_t address, uint64_t size, MemoryPermission perm); Result SetMemoryAttribute64(Core::System& system, uint64_t address, uint64_t size, uint32_t mask, uint32_t attr); Result MapMemory64(Core::System& system, uint64_t dst_address, uint64_t src_address, uint64_t size); @@ -303,7 +303,7 @@ Result FlushDataCache64(Core::System& system, uint64_t address, uint64_t size); Result MapPhysicalMemory64(Core::System& system, uint64_t address, uint64_t size); Result UnmapPhysicalMemory64(Core::System& system, uint64_t address, uint64_t size); Result GetDebugFutureThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_thread_id, Handle debug_handle, int64_t ns); -Result GetLastThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context, uintptr_t* out_tls_address, uint32_t* out_flags); +Result GetLastThreadInfo64(Core::System& system, lp64::LastThreadContext* out_context, uint64_t* out_tls_address, uint32_t* out_flags); Result GetResourceLimitLimitValue64(Core::System& system, int64_t* out_limit_value, Handle resource_limit_handle, LimitableResource which); Result GetResourceLimitCurrentValue64(Core::System& system, int64_t* out_current_value, Handle resource_limit_handle, LimitableResource which); Result SetThreadActivity64(Core::System& system, Handle thread_handle, ThreadActivity thread_activity); @@ -336,7 +336,7 @@ Result MapTransferMemory64(Core::System& system, Handle trmem_handle, uint64_t a Result UnmapTransferMemory64(Core::System& system, Handle trmem_handle, uint64_t address, uint64_t size); Result CreateInterruptEvent64(Core::System& system, Handle* out_read_handle, int32_t interrupt_id, InterruptType interrupt_type); Result QueryPhysicalAddress64(Core::System& system, lp64::PhysicalMemoryInfo* out_info, uint64_t address); -Result QueryIoMapping64(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, uint64_t physical_address, uint64_t size); +Result QueryIoMapping64(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint64_t size); Result CreateDeviceAddressSpace64(Core::System& system, Handle* out_handle, uint64_t das_address, uint64_t das_size); Result AttachDeviceAddressSpace64(Core::System& system, DeviceName device_name, Handle das_handle); Result DetachDeviceAddressSpace64(Core::System& system, DeviceName device_name, Handle das_handle); diff --git a/src/core/hle/kernel/svc/svc_address_translation.cpp b/src/core/hle/kernel/svc/svc_address_translation.cpp index c25e144cd..e65a11cda 100755 --- a/src/core/hle/kernel/svc/svc_address_translation.cpp +++ b/src/core/hle/kernel/svc/svc_address_translation.cpp @@ -12,7 +12,7 @@ Result QueryPhysicalAddress(Core::System& system, lp64::PhysicalMemoryInfo* out_ R_THROW(ResultNotImplemented); } -Result QueryIoMapping(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, +Result QueryIoMapping(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint64_t size) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); @@ -23,7 +23,7 @@ Result QueryPhysicalAddress64(Core::System& system, lp64::PhysicalMemoryInfo* ou R_RETURN(QueryPhysicalAddress(system, out_info, address)); } -Result QueryIoMapping64(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, +Result QueryIoMapping64(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint64_t size) { R_RETURN(QueryIoMapping(system, out_address, out_size, physical_address, size)); } @@ -41,10 +41,10 @@ Result QueryPhysicalAddress64From32(Core::System& system, ilp32::PhysicalMemoryI R_SUCCEED(); } -Result QueryIoMapping64From32(Core::System& system, uintptr_t* out_address, uintptr_t* out_size, +Result QueryIoMapping64From32(Core::System& system, uint64_t* out_address, uint64_t* out_size, uint64_t physical_address, uint32_t size) { - R_RETURN(QueryIoMapping(system, reinterpret_cast(out_address), - reinterpret_cast(out_size), physical_address, size)); + R_RETURN(QueryIoMapping(system, reinterpret_cast(out_address), + reinterpret_cast(out_size), physical_address, size)); } } // namespace Kernel::Svc diff --git a/src/core/hle/kernel/svc/svc_cache.cpp b/src/core/hle/kernel/svc/svc_cache.cpp index 598b71da5..1779832d3 100755 --- a/src/core/hle/kernel/svc/svc_cache.cpp +++ b/src/core/hle/kernel/svc/svc_cache.cpp @@ -13,7 +13,7 @@ void FlushEntireDataCache(Core::System& system) { UNIMPLEMENTED(); } -Result FlushDataCache(Core::System& system, VAddr address, size_t size) { +Result FlushDataCache(Core::System& system, uint64_t address, uint64_t size) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } @@ -33,8 +33,8 @@ Result StoreProcessDataCache(Core::System& system, Handle process_handle, uint64 Result FlushProcessDataCache(Core::System& system, Handle process_handle, u64 address, u64 size) { // Validate address/size. R_UNLESS(size > 0, ResultInvalidSize); - R_UNLESS(address == static_cast(address), ResultInvalidCurrentMemory); - R_UNLESS(size == static_cast(size), ResultInvalidCurrentMemory); + R_UNLESS(address == static_cast(address), ResultInvalidCurrentMemory); + R_UNLESS(size == static_cast(size), ResultInvalidCurrentMemory); // Get the process from its handle. KScopedAutoObject process = @@ -53,7 +53,7 @@ void FlushEntireDataCache64(Core::System& system) { FlushEntireDataCache(system); } -Result FlushDataCache64(Core::System& system, VAddr address, size_t size) { +Result FlushDataCache64(Core::System& system, uint64_t address, uint64_t size) { R_RETURN(FlushDataCache(system, address, size)); } diff --git a/src/core/hle/kernel/svc/svc_code_memory.cpp b/src/core/hle/kernel/svc/svc_code_memory.cpp index 538ff1c71..8bed747af 100755 --- a/src/core/hle/kernel/svc/svc_code_memory.cpp +++ b/src/core/hle/kernel/svc/svc_code_memory.cpp @@ -28,7 +28,7 @@ constexpr bool IsValidUnmapFromOwnerCodeMemoryPermission(MemoryPermission perm) } // namespace -Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t size) { +Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, uint64_t size) { LOG_TRACE(Kernel_SVC, "called, address=0x{:X}, size=0x{:X}", address, size); // Get kernel instance. @@ -64,7 +64,7 @@ Result CreateCodeMemory(Core::System& system, Handle* out, VAddr address, size_t } Result ControlCodeMemory(Core::System& system, Handle code_memory_handle, - CodeMemoryOperation operation, VAddr address, size_t size, + CodeMemoryOperation operation, VAddr address, uint64_t size, MemoryPermission perm) { LOG_TRACE(Kernel_SVC, diff --git a/src/core/hle/kernel/svc/svc_debug.cpp b/src/core/hle/kernel/svc/svc_debug.cpp index a14050fa7..a4d1f700e 100755 --- a/src/core/hle/kernel/svc/svc_debug.cpp +++ b/src/core/hle/kernel/svc/svc_debug.cpp @@ -45,19 +45,19 @@ Result SetDebugThreadContext(Core::System& system, Handle debug_handle, uint64_t } Result QueryDebugProcessMemory(Core::System& system, uint64_t out_memory_info, - PageInfo* out_page_info, Handle debug_handle, uintptr_t address) { + PageInfo* out_page_info, Handle process_handle, uint64_t address) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } -Result ReadDebugProcessMemory(Core::System& system, uintptr_t buffer, Handle debug_handle, - uintptr_t address, size_t size) { +Result ReadDebugProcessMemory(Core::System& system, uint64_t buffer, Handle debug_handle, + uint64_t address, uint64_t size) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } -Result WriteDebugProcessMemory(Core::System& system, Handle debug_handle, uintptr_t buffer, - uintptr_t address, size_t size) { +Result WriteDebugProcessMemory(Core::System& system, Handle debug_handle, uint64_t buffer, + uint64_t address, uint64_t size) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } diff --git a/src/core/hle/kernel/svc/svc_device_address_space.cpp b/src/core/hle/kernel/svc/svc_device_address_space.cpp index f68c0e6a9..ec3143e67 100755 --- a/src/core/hle/kernel/svc/svc_device_address_space.cpp +++ b/src/core/hle/kernel/svc/svc_device_address_space.cpp @@ -76,8 +76,8 @@ constexpr bool IsValidDeviceMemoryPermission(MemoryPermission device_perm) { } Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Handle process_handle, - uint64_t process_address, size_t size, uint64_t device_address, - u32 option) { + uint64_t process_address, uint64_t size, + uint64_t device_address, u32 option) { // Decode the option. const MapDeviceAddressSpaceOption option_pack{option}; const auto device_perm = option_pack.permission; @@ -90,7 +90,7 @@ Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Han R_UNLESS(size > 0, ResultInvalidSize); R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory); R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion); - R_UNLESS((process_address == static_cast(process_address)), + R_UNLESS((process_address == static_cast(process_address)), ResultInvalidCurrentMemory); R_UNLESS(IsValidDeviceMemoryPermission(device_perm), ResultInvalidNewMemoryPermission); R_UNLESS(reserved == 0, ResultInvalidEnumValue); @@ -116,8 +116,8 @@ Result MapDeviceAddressSpaceByForce(Core::System& system, Handle das_handle, Han } Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Handle process_handle, - uint64_t process_address, size_t size, uint64_t device_address, - u32 option) { + uint64_t process_address, uint64_t size, + uint64_t device_address, u32 option) { // Decode the option. const MapDeviceAddressSpaceOption option_pack{option}; const auto device_perm = option_pack.permission; @@ -131,7 +131,7 @@ Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Han R_UNLESS(size > 0, ResultInvalidSize); R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory); R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion); - R_UNLESS((process_address == static_cast(process_address)), + R_UNLESS((process_address == static_cast(process_address)), ResultInvalidCurrentMemory); R_UNLESS(IsValidDeviceMemoryPermission(device_perm), ResultInvalidNewMemoryPermission); R_UNLESS(reserved == 0, ResultInvalidEnumValue); @@ -157,7 +157,7 @@ Result MapDeviceAddressSpaceAligned(Core::System& system, Handle das_handle, Han } Result UnmapDeviceAddressSpace(Core::System& system, Handle das_handle, Handle process_handle, - uint64_t process_address, size_t size, uint64_t device_address) { + uint64_t process_address, uint64_t size, uint64_t device_address) { // Validate input. R_UNLESS(Common::IsAligned(process_address, PageSize), ResultInvalidAddress); R_UNLESS(Common::IsAligned(device_address, PageSize), ResultInvalidAddress); @@ -165,7 +165,7 @@ Result UnmapDeviceAddressSpace(Core::System& system, Handle das_handle, Handle p R_UNLESS(size > 0, ResultInvalidSize); R_UNLESS((process_address < process_address + size), ResultInvalidCurrentMemory); R_UNLESS((device_address < device_address + size), ResultInvalidMemoryRegion); - R_UNLESS((process_address == static_cast(process_address)), + R_UNLESS((process_address == static_cast(process_address)), ResultInvalidCurrentMemory); // Get the device address space. diff --git a/src/core/hle/kernel/svc/svc_insecure_memory.cpp b/src/core/hle/kernel/svc/svc_insecure_memory.cpp index 79882685d..00457c6bf 100755 --- a/src/core/hle/kernel/svc/svc_insecure_memory.cpp +++ b/src/core/hle/kernel/svc/svc_insecure_memory.cpp @@ -6,12 +6,12 @@ namespace Kernel::Svc { -Result MapInsecureMemory(Core::System& system, uintptr_t address, size_t size) { +Result MapInsecureMemory(Core::System& system, uint64_t address, uint64_t size) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } -Result UnmapInsecureMemory(Core::System& system, uintptr_t address, size_t size) { +Result UnmapInsecureMemory(Core::System& system, uint64_t address, uint64_t size) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } diff --git a/src/core/hle/kernel/svc/svc_io_pool.cpp b/src/core/hle/kernel/svc/svc_io_pool.cpp index 33f3d69bf..f01817e24 100755 --- a/src/core/hle/kernel/svc/svc_io_pool.cpp +++ b/src/core/hle/kernel/svc/svc_io_pool.cpp @@ -12,19 +12,19 @@ Result CreateIoPool(Core::System& system, Handle* out, IoPoolType pool_type) { } Result CreateIoRegion(Core::System& system, Handle* out, Handle io_pool_handle, uint64_t phys_addr, - size_t size, MemoryMapping mapping, MemoryPermission perm) { + uint64_t size, MemoryMapping mapping, MemoryPermission perm) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } -Result MapIoRegion(Core::System& system, Handle io_region_handle, uintptr_t address, size_t size, +Result MapIoRegion(Core::System& system, Handle io_region_handle, uint64_t address, uint64_t size, MemoryPermission map_perm) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } -Result UnmapIoRegion(Core::System& system, Handle io_region_handle, uintptr_t address, - size_t size) { +Result UnmapIoRegion(Core::System& system, Handle io_region_handle, uint64_t address, + uint64_t size) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } diff --git a/src/core/hle/kernel/svc/svc_physical_memory.cpp b/src/core/hle/kernel/svc/svc_physical_memory.cpp index a1f534454..ed6a624ac 100755 --- a/src/core/hle/kernel/svc/svc_physical_memory.cpp +++ b/src/core/hle/kernel/svc/svc_physical_memory.cpp @@ -158,7 +158,7 @@ Result SetUnsafeLimit64(Core::System& system, uint64_t limit) { R_RETURN(SetUnsafeLimit(system, limit)); } -Result SetHeapSize64From32(Core::System& system, uintptr_t* out_address, uint32_t size) { +Result SetHeapSize64From32(Core::System& system, uint64_t* out_address, uint32_t size) { R_RETURN(SetHeapSize(system, out_address, size)); } diff --git a/src/core/hle/kernel/svc/svc_port.cpp b/src/core/hle/kernel/svc/svc_port.cpp index ac095b338..78c2a8d17 100755 --- a/src/core/hle/kernel/svc/svc_port.cpp +++ b/src/core/hle/kernel/svc/svc_port.cpp @@ -49,7 +49,7 @@ Result ConnectToNamedPort(Core::System& system, Handle* out, VAddr user_name) { } Result CreatePort(Core::System& system, Handle* out_server, Handle* out_client, - int32_t max_sessions, bool is_light, uintptr_t name) { + int32_t max_sessions, bool is_light, uint64_t name) { UNIMPLEMENTED(); R_THROW(ResultNotImplemented); } diff --git a/src/core/hle/kernel/svc/svc_process_memory.cpp b/src/core/hle/kernel/svc/svc_process_memory.cpp index 4dfd9e5bb..8e2fb4092 100755 --- a/src/core/hle/kernel/svc/svc_process_memory.cpp +++ b/src/core/hle/kernel/svc/svc_process_memory.cpp @@ -37,8 +37,8 @@ Result SetProcessMemoryPermission(Core::System& system, Handle process_handle, V R_UNLESS(Common::IsAligned(size, PageSize), ResultInvalidSize); R_UNLESS(size > 0, ResultInvalidSize); R_UNLESS((address < address + size), ResultInvalidCurrentMemory); - R_UNLESS(address == static_cast(address), ResultInvalidCurrentMemory); - R_UNLESS(size == static_cast(size), ResultInvalidCurrentMemory); + R_UNLESS(address == static_cast(address), ResultInvalidCurrentMemory); + R_UNLESS(size == static_cast(size), ResultInvalidCurrentMemory); // Validate the memory permission. R_UNLESS(IsValidProcessMemoryPermission(perm), ResultInvalidNewMemoryPermission); diff --git a/src/core/hle/kernel/svc_generator.py b/src/core/hle/kernel/svc_generator.py index 34d2ac659..0cce69e85 100755 --- a/src/core/hle/kernel/svc_generator.py +++ b/src/core/hle/kernel/svc_generator.py @@ -443,7 +443,7 @@ def emit_wrapper(wrapped_fn, suffix, register_info, arguments, byte_size): lines.append("") for output_type, var_name, _, is_address in output_writes: - output_type = "uintptr_t" if is_address else output_type + output_type = "uint64_t" if is_address else output_type lines.append(f"{output_type} {var_name}{{}};") for input_type, var_name, _ in input_reads: lines.append(f"{input_type} {var_name}{{}};") @@ -630,7 +630,7 @@ def emit_call(bitness, names, suffix): def build_fn_declaration(return_type, name, arguments): arg_list = ["Core::System& system"] for arg in arguments: - type_name = "uintptr_t" if arg.is_address else arg.type_name + type_name = "uint64_t" if arg.is_address else arg.type_name pointer = "*" if arg.is_output and not arg.is_outptr else "" arg_list.append(f"{type_name}{pointer} {arg.var_name}") diff --git a/src/core/hle/service/sm/sm.cpp b/src/core/hle/service/sm/sm.cpp index eb7def69c..159a14a0d 100755 --- a/src/core/hle/service/sm/sm.cpp +++ b/src/core/hle/service/sm/sm.cpp @@ -112,7 +112,7 @@ ResultVal ServiceManager::GetServicePort(const std::string& name void SM::Initialize(Kernel::HLERequestContext& ctx) { LOG_DEBUG(Service_SM, "called"); - is_initialized = true; + ctx.GetManager()->SetIsInitializedForSm(); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); @@ -159,7 +159,7 @@ static std::string PopServiceName(IPC::RequestParser& rp) { } ResultVal SM::GetServiceImpl(Kernel::HLERequestContext& ctx) { - if (!is_initialized) { + if (!ctx.GetManager()->GetIsInitializedForSm()) { return ERR_NOT_INITIALIZED; } @@ -168,6 +168,11 @@ ResultVal SM::GetServiceImpl(Kernel::HLERequestContext& // Find the named port. auto port_result = service_manager.GetServicePort(name); + if (port_result.Code() == ERR_INVALID_NAME) { + LOG_ERROR(Service_SM, "Invalid service name '{}'", name); + return ERR_INVALID_NAME; + } + if (port_result.Failed()) { LOG_INFO(Service_SM, "Waiting for service {} to become available", name); ctx.SetIsDeferred(); diff --git a/src/core/hle/service/sockets/sockets.h b/src/core/hle/service/sockets/sockets.h index 43ad784fc..9dcf83438 100755 --- a/src/core/hle/service/sockets/sockets.h +++ b/src/core/hle/service/sockets/sockets.h @@ -19,6 +19,7 @@ enum class Errno : u32 { INVAL = 22, MFILE = 24, MSGSIZE = 90, + CONNRESET = 104, NOTCONN = 107, TIMEDOUT = 110, }; diff --git a/src/core/hle/service/sockets/sockets_translate.cpp b/src/core/hle/service/sockets/sockets_translate.cpp index 9c6985f78..a5e0365fe 100755 --- a/src/core/hle/service/sockets/sockets_translate.cpp +++ b/src/core/hle/service/sockets/sockets_translate.cpp @@ -27,6 +27,8 @@ Errno Translate(Network::Errno value) { return Errno::NOTCONN; case Network::Errno::TIMEDOUT: return Errno::TIMEDOUT; + case Network::Errno::CONNRESET: + return Errno::CONNRESET; default: UNIMPLEMENTED_MSG("Unimplemented errno={}", value); return Errno::SUCCESS; diff --git a/src/core/internal_network/network.cpp b/src/core/internal_network/network.cpp index e6a1ec7c1..46ea5a33b 100755 --- a/src/core/internal_network/network.cpp +++ b/src/core/internal_network/network.cpp @@ -109,6 +109,8 @@ Errno TranslateNativeError(int e) { return Errno::AGAIN; case WSAECONNREFUSED: return Errno::CONNREFUSED; + case WSAECONNRESET: + return Errno::CONNRESET; case WSAEHOSTUNREACH: return Errno::HOSTUNREACH; case WSAENETDOWN: @@ -205,6 +207,8 @@ Errno TranslateNativeError(int e) { return Errno::AGAIN; case ECONNREFUSED: return Errno::CONNREFUSED; + case ECONNRESET: + return Errno::CONNRESET; case EHOSTUNREACH: return Errno::HOSTUNREACH; case ENETDOWN: diff --git a/src/core/internal_network/network.h b/src/core/internal_network/network.h index 95d25fc0a..1bad3f6a0 100755 --- a/src/core/internal_network/network.h +++ b/src/core/internal_network/network.h @@ -30,6 +30,7 @@ enum class Errno { NOTCONN, AGAIN, CONNREFUSED, + CONNRESET, HOSTUNREACH, NETDOWN, NETUNREACH, diff --git a/src/video_core/buffer_cache/buffer_base.h b/src/video_core/buffer_cache/buffer_base.h index 0a44caa66..22eed2578 100755 --- a/src/video_core/buffer_cache/buffer_base.h +++ b/src/video_core/buffer_cache/buffer_base.h @@ -568,7 +568,7 @@ private: const u64* const state_words = Array(); const u64 num_query_words = size / BYTES_PER_WORD + 1; const u64 word_begin = offset / BYTES_PER_WORD; - const u64 word_end = std::min(word_begin + num_query_words, NumWords()); + const u64 word_end = std::min(word_begin + num_query_words, NumWords()); const u64 page_base = offset / BYTES_PER_PAGE; const u64 page_limit = Common::DivCeil(offset + size, BYTES_PER_PAGE); u64 begin = std::numeric_limits::max(); diff --git a/src/web_service/web_backend.cpp b/src/web_service/web_backend.cpp index 1c048443f..c3cd13ad6 100755 --- a/src/web_service/web_backend.cpp +++ b/src/web_service/web_backend.cpp @@ -71,7 +71,7 @@ struct Client::Impl { const std::string& jwt_ = "", const std::string& username_ = "", const std::string& token_ = "") { if (cli == nullptr) { - cli = std::make_unique(host.c_str()); + cli = std::make_unique(host); } if (!cli->is_valid()) { diff --git a/src/yuzu/discord_impl.cpp b/src/yuzu/discord_impl.cpp index 7b15c62cd..b07ca8029 100755 --- a/src/yuzu/discord_impl.cpp +++ b/src/yuzu/discord_impl.cpp @@ -76,7 +76,7 @@ void DiscordImpl::Update() { // New Check for game cover httplib::Client cli(game_cover_url); - if (auto res = cli.Head(fmt::format("/images/game/boxart/{}.png", icon_name).c_str())) { + if (auto res = cli.Head(fmt::format("/images/game/boxart/{}.png", icon_name))) { if (res->status == 200) { game_cover_url += fmt::format("/images/game/boxart/{}.png", icon_name); } else {