aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/k_memory_block.h4
-rw-r--r--src/core/hle/kernel/k_page_table_base.cpp3
-rw-r--r--src/core/hle/kernel/k_process.cpp1
-rw-r--r--src/core/hle/kernel/k_process.h5
-rw-r--r--src/core/hle/kernel/kernel.cpp12
-rw-r--r--src/core/hle/kernel/svc.cpp4
-rw-r--r--src/core/hle/kernel/svc.h2
-rw-r--r--src/core/hle/kernel/svc/svc_info.cpp27
-rw-r--r--src/core/hle/kernel/svc/svc_ipc.cpp19
-rw-r--r--src/core/hle/kernel/svc/svc_memory.cpp25
-rw-r--r--src/core/hle/kernel/svc/svc_synchronization.cpp21
-rw-r--r--src/core/hle/kernel/svc/svc_thread.cpp11
-rw-r--r--src/core/hle/kernel/svc_types.h1
13 files changed, 18 insertions, 117 deletions
diff --git a/src/core/hle/kernel/k_memory_block.h b/src/core/hle/kernel/k_memory_block.h
index 2abca31d87..f6543bdb3a 100644
--- a/src/core/hle/kernel/k_memory_block.h
+++ b/src/core/hle/kernel/k_memory_block.h
@@ -195,9 +195,7 @@ enum class KMemoryAttribute : u8 {
Uncached = static_cast<u8>(Svc::MemoryAttribute::Uncached),
PermissionLocked = static_cast<u8>(Svc::MemoryAttribute::PermissionLocked),
- GpuAccessible = static_cast<u8>(Svc::MemoryAttribute::GpuAccessible),
-
- SetMask = Uncached | PermissionLocked | GpuAccessible,
+ SetMask = Uncached | PermissionLocked,
};
DECLARE_ENUM_FLAG_OPERATORS(KMemoryAttribute);
diff --git a/src/core/hle/kernel/k_page_table_base.cpp b/src/core/hle/kernel/k_page_table_base.cpp
index fd5d2c2dce..2a0a7d49d5 100644
--- a/src/core/hle/kernel/k_page_table_base.cpp
+++ b/src/core/hle/kernel/k_page_table_base.cpp
@@ -2102,8 +2102,7 @@ Result KPageTableBase::SetMemoryAttribute(KProcessAddress addr, size_t size, KMe
constexpr KMemoryAttribute AttributeTestMask =
~(KMemoryAttribute::SetMask | KMemoryAttribute::DeviceShared);
const KMemoryState state_test_mask =
- (True(mask & (KMemoryAttribute::Uncached | KMemoryAttribute::GpuAccessible))
- ? KMemoryState::FlagCanChangeAttribute
+ (True(mask & KMemoryAttribute::Uncached) ? KMemoryState::FlagCanChangeAttribute
: KMemoryState::None) |
(True(mask & KMemoryAttribute::PermissionLocked) ? KMemoryState::FlagCanPermissionLock
: KMemoryState::None);
diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp
index 813d8e9402..27d1b1bfc4 100644
--- a/src/core/hle/kernel/k_process.cpp
+++ b/src/core/hle/kernel/k_process.cpp
@@ -1260,7 +1260,6 @@ Result KProcess::LoadFromMetadata(KernelCore& kernel, const FileSys::ProgramMeta
// Assign remaining properties.
m_ideal_core_id = metadata.GetMainThreadCore();
- m_uses_pauth_returns = metadata.UsesExtendedAcid();
// Set up emulation context.
this->InitializeInterfaces(kernel);
diff --git a/src/core/hle/kernel/k_process.h b/src/core/hle/kernel/k_process.h
index ca96591ed0..b5693751c3 100644
--- a/src/core/hle/kernel/k_process.h
+++ b/src/core/hle/kernel/k_process.h
@@ -135,7 +135,6 @@ private:
bool m_is_signaled : 1 = false;
bool m_is_initialized : 1 = false;
bool m_is_application : 1 = false;
- bool m_uses_pauth_returns : 1 = false;
bool m_is_default_application_system_resource : 1 = false;
bool m_is_suspended : 1 = false;
bool m_is_immortal : 1 = false;
@@ -249,10 +248,6 @@ public:
return m_is_application;
}
- bool UsesPAuthReturns() const {
- return m_uses_pauth_returns;
- }
-
bool IsDefaultApplicationSystemResource() const {
return m_is_default_application_system_resource;
}
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index c7beb9c3ce..4f1d849209 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -120,13 +120,13 @@ struct KernelCore::Impl {
}
void TerminateAllProcesses() {
- auto& kernel = system.Kernel();
- // Applet cleanup can remove processes while termination waits for its threads.
- auto processes = kernel.GetProcessList();
- for (auto& process : processes) {
- process->Terminate(kernel);
- kernel.RemoveProcess(process.GetPointerUnsafe());
+ std::scoped_lock lk{process_list_lock};
+ for (auto& process : process_list) {
+ process->Terminate(system.Kernel());
+ process->Close(system.Kernel());
+ process = nullptr;
}
+ process_list.clear();
}
void Shutdown(KernelCore& kernel) {
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index c91ae43dd8..3542d5a3b6 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -2370,10 +2370,6 @@ static void Call32(Core::System& system, u32 imm, std::span<uint64_t, 8> args) {
static void Call64(Core::System& system, u32 imm, std::span<uint64_t, 8> args) {
switch (SvcId(imm)) {
- case SvcId::SetGpuMemoryAttribute:
- args[0] = SetGpuMemoryAttribute(system, args[0], args[1],
- static_cast<u32>(args[2]), static_cast<u32>(args[3])).raw;
- return;
case SvcId::SetHeapSize: return SvcWrap_SetHeapSize64(system, args);
case SvcId::SetMemoryPermission: return SvcWrap_SetMemoryPermission64(system, args);
case SvcId::SetMemoryAttribute: return SvcWrap_SetMemoryAttribute64(system, args);
diff --git a/src/core/hle/kernel/svc.h b/src/core/hle/kernel/svc.h
index 422b8b8719..356c1c109a 100644
--- a/src/core/hle/kernel/svc.h
+++ b/src/core/hle/kernel/svc.h
@@ -22,7 +22,6 @@ namespace Kernel::Svc {
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 SetGpuMemoryAttribute(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);
Result UnmapMemory(Core::System& system, uint64_t dst_address, uint64_t src_address, uint64_t size);
Result QueryMemory(Core::System& system, uint64_t out_memory_info, PageInfo* out_page_info, uint64_t address);
@@ -505,7 +504,6 @@ enum class SvcId : u32 {
CreateResourceLimit = 0x7d,
SetResourceLimitLimitValue = 0x7e,
CallSecureMonitor = 0x7f,
- SetGpuMemoryAttribute = 0x80,
MapInsecureMemory = 0x90,
UnmapInsecureMemory = 0x91,
};
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,
diff --git a/src/core/hle/kernel/svc_types.h b/src/core/hle/kernel/svc_types.h
index c7b68cc0df..b0f4796da4 100644
--- a/src/core/hle/kernel/svc_types.h
+++ b/src/core/hle/kernel/svc_types.h
@@ -50,7 +50,6 @@ enum class MemoryAttribute : u32 {
DeviceShared = (1 << 2),
Uncached = (1 << 3),
PermissionLocked = (1 << 4),
- GpuAccessible = (1 << 5),
};
DECLARE_ENUM_FLAG_OPERATORS(MemoryAttribute);