mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-25 10:52:48 -06:00
kernel: svc: Move all IsValid functions to an anonymous namespace
This commit is contained in:
parent
2726d705f8
commit
5cf93c1346
1 changed files with 15 additions and 3 deletions
|
@ -1169,6 +1169,8 @@ static u32 GetCurrentProcessorNumber32(Core::System& system) {
|
||||||
return GetCurrentProcessorNumber(system);
|
return GetCurrentProcessorNumber(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
constexpr bool IsValidSharedMemoryPermission(Svc::MemoryPermission perm) {
|
constexpr bool IsValidSharedMemoryPermission(Svc::MemoryPermission perm) {
|
||||||
switch (perm) {
|
switch (perm) {
|
||||||
case Svc::MemoryPermission::Read:
|
case Svc::MemoryPermission::Read:
|
||||||
|
@ -1179,7 +1181,7 @@ constexpr bool IsValidSharedMemoryPermission(Svc::MemoryPermission perm) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool IsValidRemoteSharedMemoryPermission(Svc::MemoryPermission perm) {
|
[[maybe_unused]] constexpr bool IsValidRemoteSharedMemoryPermission(Svc::MemoryPermission perm) {
|
||||||
return IsValidSharedMemoryPermission(perm) || perm == Svc::MemoryPermission::DontCare;
|
return IsValidSharedMemoryPermission(perm) || perm == Svc::MemoryPermission::DontCare;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1195,6 +1197,8 @@ constexpr bool IsValidProcessMemoryPermission(Svc::MemoryPermission perm) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // Anonymous namespace
|
||||||
|
|
||||||
static ResultCode MapSharedMemory(Core::System& system, Handle shmem_handle, VAddr address,
|
static ResultCode MapSharedMemory(Core::System& system, Handle shmem_handle, VAddr address,
|
||||||
u64 size, Svc::MemoryPermission map_perm) {
|
u64 size, Svc::MemoryPermission map_perm) {
|
||||||
LOG_TRACE(Kernel_SVC,
|
LOG_TRACE(Kernel_SVC,
|
||||||
|
@ -1499,10 +1503,14 @@ static void ExitProcess32(Core::System& system) {
|
||||||
ExitProcess(system);
|
ExitProcess(system);
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr bool IsValidVirtualCoreId(int32_t core_id) {
|
namespace {
|
||||||
|
|
||||||
|
constexpr bool IsValidVirtualCoreId(int32_t core_id) {
|
||||||
return (0 <= core_id && core_id < static_cast<int32_t>(Core::Hardware::NUM_CPU_CORES));
|
return (0 <= core_id && core_id < static_cast<int32_t>(Core::Hardware::NUM_CPU_CORES));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // Anonymous namespace
|
||||||
|
|
||||||
/// Creates a new thread
|
/// Creates a new thread
|
||||||
static ResultCode CreateThread(Core::System& system, Handle* out_handle, VAddr entry_point, u64 arg,
|
static ResultCode CreateThread(Core::System& system, Handle* out_handle, VAddr entry_point, u64 arg,
|
||||||
VAddr stack_bottom, u32 priority, s32 core_id) {
|
VAddr stack_bottom, u32 priority, s32 core_id) {
|
||||||
|
@ -1886,7 +1894,9 @@ static ResultCode ResetSignal32(Core::System& system, Handle handle) {
|
||||||
return ResetSignal(system, handle);
|
return ResetSignal(system, handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr bool IsValidTransferMemoryPermission(MemoryPermission perm) {
|
namespace {
|
||||||
|
|
||||||
|
constexpr bool IsValidTransferMemoryPermission(MemoryPermission perm) {
|
||||||
switch (perm) {
|
switch (perm) {
|
||||||
case MemoryPermission::None:
|
case MemoryPermission::None:
|
||||||
case MemoryPermission::Read:
|
case MemoryPermission::Read:
|
||||||
|
@ -1897,6 +1907,8 @@ static constexpr bool IsValidTransferMemoryPermission(MemoryPermission perm) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // Anonymous namespace
|
||||||
|
|
||||||
/// Creates a TransferMemory object
|
/// Creates a TransferMemory object
|
||||||
static ResultCode CreateTransferMemory(Core::System& system, Handle* out, VAddr address, u64 size,
|
static ResultCode CreateTransferMemory(Core::System& system, Handle* out, VAddr address, u64 size,
|
||||||
MemoryPermission map_perm) {
|
MemoryPermission map_perm) {
|
||||||
|
|
Loading…
Reference in a new issue