diff options
| author | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-10-29 03:39:29 -0400 |
|---|---|---|
| committer | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-10-29 03:39:29 -0400 |
| commit | ea6c1193fbfa95e586bb6d129dc684163a12cb3e (patch) | |
| tree | e4d23143900184630deeabe27eab1321dac4a428 /src/core/hle/kernel/svc | |
| parent | 0bb5055b6541c74f47603a8dff0569a509cbaf18 (diff) | |
Revert "Import experimental NS2 support and accumulated GPU fixes"
This reverts commit 535b676970. The Switch 2 support comes from the nx2
work instead, merged next.
Diffstat (limited to 'src/core/hle/kernel/svc')
| -rw-r--r-- | src/core/hle/kernel/svc/svc_info.cpp | 27 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_ipc.cpp | 19 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_memory.cpp | 25 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_synchronization.cpp | 21 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc/svc_thread.cpp | 11 |
5 files changed, 10 insertions, 93 deletions
diff --git a/src/core/hle/kernel/svc/svc_info.cpp b/src/core/hle/kernel/svc/svc_info.cpp index aea7407542..863bb58fa8 100644 --- a/src/core/hle/kernel/svc/svc_info.cpp +++ b/src/core/hle/kernel/svc/svc_info.cpp @@ -14,32 +14,11 @@ #include "core/hle/kernel/svc_version.h" namespace Kernel::Svc { -namespace { -// Identified from the extended SDK's RemoteRegionManager initialization. -constexpr InfoType RemoteRegionAddress = static_cast<InfoType>(29); -constexpr InfoType RemoteRegionSize = static_cast<InfoType>(30); -constexpr InfoType RemoteMemoryUsed = static_cast<InfoType>(31); -constexpr InfoType RemoteMemoryTotal = static_cast<InfoType>(32); -constexpr InfoType MemoryMappingAlignment = static_cast<InfoType>(33); -} // namespace /// Gets system/memory information for the current process Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle handle, u64 info_sub_id) { LOG_TRACE(Kernel_SVC, "called info_id={:#x}, info_sub_id={:#x}, handle={:#08x}", info_id_type, info_sub_id, handle); u32 info_id = u32(info_id_type); - if (info_id_type == RemoteRegionAddress || info_id_type == RemoteRegionSize || - info_id_type == RemoteMemoryUsed || info_id_type == RemoteMemoryTotal || - info_id_type == MemoryMappingAlignment) { - R_UNLESS(info_sub_id == 0, ResultInvalidEnumValue); - const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable(); - KScopedAutoObject process = handle_table.GetObject<KProcess>(system.Kernel(), handle); - R_UNLESS(process.IsNotNull(), ResultInvalidHandle); - R_UNLESS(process->UsesPAuthReturns(), ResultInvalidEnumValue); - // Remote mappings are absent; ordinary mappings use the kernel page size. - *result = info_id_type == MemoryMappingAlignment ? PageSize : 0; - LOG_DEBUG(Kernel_SVC, "Extended memory info_id={:#x}, value={:#x}", info_id, *result); - R_SUCCEED(); - } switch (info_id_type) { case InfoType::CoreMask: case InfoType::PriorityMask: @@ -145,8 +124,7 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle default: break; } - LOG_ERROR(Kernel_SVC, "Unimplemented svcGetInfo id={:#x}, sub_id={:#x}, handle={:#x}", - info_id, info_sub_id, handle); + LOG_ERROR(Kernel_SVC, "Unimplemented svcGetInfo id={:#016x}", info_id); R_THROW(ResultInvalidEnumValue); } case InfoType::DebuggerAttached: @@ -280,8 +258,7 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle R_SUCCEED(); } default: - LOG_ERROR(Kernel_SVC, "Unimplemented svcGetInfo id={:#x}, sub_id={:#x}, handle={:#x}", - info_id, info_sub_id, handle); + LOG_ERROR(Kernel_SVC, "Unimplemented svcGetInfo id={:#016x}", info_id); R_THROW(ResultInvalidEnumValue); } } diff --git a/src/core/hle/kernel/svc/svc_ipc.cpp b/src/core/hle/kernel/svc/svc_ipc.cpp index fadde6c093..875590d6f7 100644 --- a/src/core/hle/kernel/svc/svc_ipc.cpp +++ b/src/core/hle/kernel/svc/svc_ipc.cpp @@ -13,7 +13,6 @@ #include "core/hle/kernel/k_scoped_resource_reservation.h" #include "core/hle/kernel/k_server_session.h" #include "core/hle/kernel/k_session.h" -#include "core/hle/kernel/k_thread.h" #include "core/hle/kernel/svc.h" #include "core/hle/kernel/svc_results.h" @@ -143,23 +142,7 @@ Result ReplyAndReceiveImpl(KernelCore& kernel, int32_t* out_index, uintptr_t mes /// Makes a blocking IPC call to a service. Result SendSyncRequest(Core::System& system, Handle session_handle) { - auto& process = GetCurrentProcess(system.Kernel()); - if (!process.UsesPAuthReturns()) { - R_RETURN(SendSyncRequestImpl(system.Kernel(), 0, 0, session_handle)); - } - const auto tls = GetCurrentThread(system.Kernel()).GetTlsAddress(); - const u64 header = process.GetMemory().Read64(tls); - const bool trace_tipc = (header & 0xffff) >= 16; - if (trace_tipc) { - LOG_DEBUG(Kernel_SVC, "TIPC send handle={:#x}, header={:#x}, special={:#x}", - session_handle, header, process.GetMemory().Read64(tls + 8)); - } - const auto result = SendSyncRequestImpl(system.Kernel(), 0, 0, session_handle); - if (trace_tipc) { - LOG_DEBUG(Kernel_SVC, "TIPC receive result={:#x}, header={:#x}, data={:#x}", - result.raw, process.GetMemory().Read64(tls), process.GetMemory().Read64(tls + 8)); - } - R_RETURN(result); + R_RETURN(SendSyncRequestImpl(system.Kernel(), 0, 0, session_handle)); } Result SendSyncRequestWithUserBuffer(Core::System& system, uint64_t message, uint64_t buffer_size, diff --git a/src/core/hle/kernel/svc/svc_memory.cpp b/src/core/hle/kernel/svc/svc_memory.cpp index 53c0d43456..970912fe50 100644 --- a/src/core/hle/kernel/svc/svc_memory.cpp +++ b/src/core/hle/kernel/svc/svc_memory.cpp @@ -126,31 +126,6 @@ Result SetMemoryAttribute(Core::System& system, u64 address, u64 size, u32 mask, R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory); // Set the memory attribute. - const auto result = page_table.SetMemoryAttribute(address, size, - static_cast<KMemoryAttribute>(mask), - static_cast<KMemoryAttribute>(attr)); - if (GetCurrentProcess(system.Kernel()).UsesPAuthReturns()) { - LOG_DEBUG(Kernel_SVC, "native memory attribute result={:#x}", result.raw); - } - R_RETURN(result); -} - -// Captured native SDK callers set bit 0x20 before registering GPU-accessible -// memory and clear it during destruction. This tracks eligibility on real mapped -// memory; GPU mappings and submission remain separate operations. -Result SetGpuMemoryAttribute(Core::System& system, u64 address, u64 size, u32 mask, u32 attr) { - auto& process = GetCurrentProcess(system.Kernel()); - R_UNLESS(process.UsesPAuthReturns(), ResultNotImplemented); - LOG_DEBUG(Kernel_SVC, "GPU memory address={:#x}, size={:#x}, mask={:#x}, attr={:#x}", - address, size, mask, attr); - R_UNLESS(Common::IsAligned(address, PageSize), ResultInvalidAddress); - R_UNLESS(size > 0 && Common::IsAligned(size, PageSize), ResultInvalidSize); - R_UNLESS(address < address + size, ResultInvalidCurrentMemory); - constexpr u32 SupportedMask = static_cast<u32>(MemoryAttribute::GpuAccessible); - R_UNLESS((attr & ~mask) == 0 && ((mask | attr) & ~SupportedMask) == 0, - ResultInvalidCombination); - auto& page_table = process.GetPageTable(); - R_UNLESS(page_table.Contains(address, size), ResultInvalidCurrentMemory); R_RETURN(page_table.SetMemoryAttribute(address, size, static_cast<KMemoryAttribute>(mask), static_cast<KMemoryAttribute>(attr))); } diff --git a/src/core/hle/kernel/svc/svc_synchronization.cpp b/src/core/hle/kernel/svc/svc_synchronization.cpp index 2f72f60215..2b019c52d1 100644 --- a/src/core/hle/kernel/svc/svc_synchronization.cpp +++ b/src/core/hle/kernel/svc/svc_synchronization.cpp @@ -15,24 +15,13 @@ namespace Kernel::Svc { -namespace { -void LogInvalidNativeSyncHandle(Core::System& system, const char* operation, Handle handle) { - if (!GetCurrentProcess(system.Kernel()).UsesPAuthReturns()) { return; } - const auto& context = GetCurrentThread(system.Kernel()).GetContext(); - LOG_DEBUG(Kernel_SVC, "native {} invalid handle={:#x}, pc={:#x}, lr={:#x}, fp={:#x}", - operation, handle, context.pc, context.lr, context.fp); -} -} - /// Close a handle Result CloseHandle(Core::System& system, Handle handle) { LOG_TRACE(Kernel_SVC, "Closing handle {:#08x}", handle); // Remove the handle. - if (!GetCurrentProcess(system.Kernel()).GetHandleTable().Remove(system.Kernel(), handle)) { - LogInvalidNativeSyncHandle(system, "CloseHandle", handle); - R_THROW(ResultInvalidHandle); - } + R_UNLESS(GetCurrentProcess(system.Kernel()).GetHandleTable().Remove(system.Kernel(), handle), + ResultInvalidHandle); R_SUCCEED(); } @@ -60,7 +49,6 @@ Result ResetSignal(Core::System& system, Handle handle) { } } - LogInvalidNativeSyncHandle(system, "ResetSignal", handle); R_THROW(ResultInvalidHandle); } @@ -84,10 +72,7 @@ Result WaitSynchronization(Core::System& system, int32_t* out_index, u64 user_ha R_UNLESS(GetCurrentMemory(system.Kernel()).ReadBlock(user_handles, handles.data(), sizeof(Handle) * num_handles), ResultInvalidPointer); // Convert the handles to objects. - if (!handle_table.GetMultipleObjects<KSynchronizationObject>(system.Kernel(), objs.data(), handles.data(), num_handles)) { - for (s32 i = 0; i < num_handles; ++i) { LogInvalidNativeSyncHandle(system, "WaitSynchronization set", handles[i]); } - R_THROW(ResultInvalidHandle); - } + R_UNLESS(handle_table.GetMultipleObjects<KSynchronizationObject>(system.Kernel(), objs.data(), handles.data(), num_handles), ResultInvalidHandle); } // Ensure handles are closed when we're done. diff --git a/src/core/hle/kernel/svc/svc_thread.cpp b/src/core/hle/kernel/svc/svc_thread.cpp index b4eb0b5719..dbca13dd26 100644 --- a/src/core/hle/kernel/svc/svc_thread.cpp +++ b/src/core/hle/kernel/svc/svc_thread.cpp @@ -16,11 +16,8 @@ namespace Kernel::Svc { namespace { -bool IsValidVirtualCoreId(const KProcess& process, int32_t core_id) { - // Extended processes use the kernel's existing virtual-core mapping. - const auto core_count = process.UsesPAuthReturns() ? Core::Hardware::NumVirtualCores - : Core::Hardware::NUM_CPU_CORES; - return 0 <= core_id && core_id < static_cast<int32_t>(core_count); +constexpr bool IsValidVirtualCoreId(int32_t core_id) { + return (0 <= core_id && core_id < static_cast<int32_t>(Core::Hardware::NUM_CPU_CORES)); } } // Anonymous namespace @@ -41,7 +38,7 @@ Result CreateThread(Core::System& system, Handle* out_handle, u64 entry_point, u } // Validate arguments. - R_UNLESS(IsValidVirtualCoreId(process, core_id), ResultInvalidCoreId); + R_UNLESS(IsValidVirtualCoreId(core_id), ResultInvalidCoreId); R_UNLESS(((1ull << core_id) & process.GetCoreMask()) != 0, ResultInvalidCoreId); R_UNLESS(HighestThreadPriority <= priority && priority <= LowestThreadPriority, @@ -265,7 +262,7 @@ Result SetThreadCoreMask(Core::System& system, Handle thread_handle, s32 core_id R_UNLESS(affinity_mask != 0, ResultInvalidCombination); // Validate the core id. - if (IsValidVirtualCoreId(GetCurrentProcess(system.Kernel()), core_id)) { + if (IsValidVirtualCoreId(core_id)) { R_UNLESS(((1ULL << core_id) & affinity_mask) != 0, ResultInvalidCombination); } else { R_UNLESS(core_id == IdealCoreNoUpdate || core_id == IdealCoreDontCare, |
