mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2024-12-25 02:35:40 +00:00
hle: kernel: svc_results: Update naming..
This commit is contained in:
parent
c2f6f2ba7a
commit
269d233a94
|
@ -21,7 +21,7 @@ std::shared_ptr<ServerPort> ClientPort::GetServerPort() const {
|
|||
|
||||
ResultVal<std::shared_ptr<ClientSession>> ClientPort::Connect() {
|
||||
if (active_sessions >= max_sessions) {
|
||||
return ResultMaxConnectionsReached;
|
||||
return ResultOutOfSessions;
|
||||
}
|
||||
active_sessions++;
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ ResultCode ClientSession::SendSyncRequest(KThread* thread, Core::Memory::Memory&
|
|||
Core::Timing::CoreTiming& core_timing) {
|
||||
// Keep ServerSession alive until we're done working with it.
|
||||
if (!parent->Server()) {
|
||||
return ResultSessionClosedByRemote;
|
||||
return ResultSessionClosed;
|
||||
}
|
||||
|
||||
// Signal the server session that new data is available
|
||||
|
|
|
@ -68,7 +68,7 @@ ResultVal<Handle> HandleTable::Create(Object* obj) {
|
|||
const u16 slot = next_free_slot;
|
||||
if (slot >= table_size) {
|
||||
LOG_ERROR(Kernel, "Unable to allocate Handle, too many slots in use.");
|
||||
return ResultHandleTableFull;
|
||||
return ResultOutOfHandles;
|
||||
}
|
||||
next_free_slot = generations[slot];
|
||||
|
||||
|
@ -93,7 +93,7 @@ ResultCode HandleTable::Add(Handle* out_handle, KAutoObject* obj, u16 type) {
|
|||
const u16 slot = next_free_slot;
|
||||
if (slot >= table_size) {
|
||||
LOG_ERROR(Kernel, "Unable to allocate Handle, too many slots in use.");
|
||||
return ResultHandleTableFull;
|
||||
return ResultOutOfHandles;
|
||||
}
|
||||
next_free_slot = generations[slot];
|
||||
|
||||
|
|
|
@ -420,7 +420,7 @@ ResultCode KPageTable::MapPhysicalMemory(VAddr addr, std::size_t size) {
|
|||
remaining_size);
|
||||
if (!memory_reservation.Succeeded()) {
|
||||
LOG_ERROR(Kernel, "Could not reserve remaining {:X} bytes", remaining_size);
|
||||
return ResultResourceLimitedExceeded;
|
||||
return ResultLimitReached;
|
||||
}
|
||||
|
||||
KPageLinkedList page_linked_list;
|
||||
|
@ -578,7 +578,7 @@ ResultCode KPageTable::Unmap(VAddr dst_addr, VAddr src_addr, std::size_t size) {
|
|||
AddRegionToPages(dst_addr, num_pages, dst_pages);
|
||||
|
||||
if (!dst_pages.IsEqual(src_pages)) {
|
||||
return ResultInvalidMemoryRange;
|
||||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -790,7 +790,7 @@ ResultVal<VAddr> KPageTable::SetHeapSize(std::size_t size) {
|
|||
|
||||
if (!memory_reservation.Succeeded()) {
|
||||
LOG_ERROR(Kernel, "Could not reserve heap extension of size {:X} bytes", delta);
|
||||
return ResultResourceLimitedExceeded;
|
||||
return ResultLimitReached;
|
||||
}
|
||||
|
||||
KPageLinkedList page_linked_list;
|
||||
|
|
|
@ -276,7 +276,7 @@ ResultCode Process::LoadFromMetadata(const FileSys::ProgramMetadata& metadata,
|
|||
if (!memory_reservation.Succeeded()) {
|
||||
LOG_ERROR(Kernel, "Could not reserve process memory requirements of size {:X} bytes",
|
||||
code_size + system_resource_size);
|
||||
return ResultResourceLimitedExceeded;
|
||||
return ResultLimitReached;
|
||||
}
|
||||
// Initialize proces address space
|
||||
if (const ResultCode result{
|
||||
|
|
|
@ -159,7 +159,7 @@ ResultCode ProcessCapabilities::ParseSingleFlagCapability(u32& set_flags, u32& s
|
|||
const auto type = GetCapabilityType(flag);
|
||||
|
||||
if (type == CapabilityType::Unset) {
|
||||
return ResultInvalidCapabilityDescriptor;
|
||||
return ResultInvalidArgument;
|
||||
}
|
||||
|
||||
// Bail early on ignorable entries, as one would expect,
|
||||
|
@ -202,7 +202,7 @@ ResultCode ProcessCapabilities::ParseSingleFlagCapability(u32& set_flags, u32& s
|
|||
}
|
||||
|
||||
LOG_ERROR(Kernel, "Invalid capability type! type={}", type);
|
||||
return ResultInvalidCapabilityDescriptor;
|
||||
return ResultInvalidArgument;
|
||||
}
|
||||
|
||||
void ProcessCapabilities::Clear() {
|
||||
|
@ -225,7 +225,7 @@ ResultCode ProcessCapabilities::HandlePriorityCoreNumFlags(u32 flags) {
|
|||
if (priority_mask != 0 || core_mask != 0) {
|
||||
LOG_ERROR(Kernel, "Core or priority mask are not zero! priority_mask={}, core_mask={}",
|
||||
priority_mask, core_mask);
|
||||
return ResultInvalidCapabilityDescriptor;
|
||||
return ResultInvalidArgument;
|
||||
}
|
||||
|
||||
const u32 core_num_min = (flags >> 16) & 0xFF;
|
||||
|
@ -329,7 +329,7 @@ ResultCode ProcessCapabilities::HandleProgramTypeFlags(u32 flags) {
|
|||
const u32 reserved = flags >> 17;
|
||||
if (reserved != 0) {
|
||||
LOG_ERROR(Kernel, "Reserved value is non-zero! reserved={}", reserved);
|
||||
return ResultReservedValue;
|
||||
return ResultReservedUsed;
|
||||
}
|
||||
|
||||
program_type = static_cast<ProgramType>((flags >> 14) & 0b111);
|
||||
|
@ -349,7 +349,7 @@ ResultCode ProcessCapabilities::HandleKernelVersionFlags(u32 flags) {
|
|||
LOG_ERROR(Kernel,
|
||||
"Kernel version is non zero or flags are too small! major_version={}, flags={}",
|
||||
major_version, flags);
|
||||
return ResultInvalidCapabilityDescriptor;
|
||||
return ResultInvalidArgument;
|
||||
}
|
||||
|
||||
kernel_version = flags;
|
||||
|
@ -360,7 +360,7 @@ ResultCode ProcessCapabilities::HandleHandleTableFlags(u32 flags) {
|
|||
const u32 reserved = flags >> 26;
|
||||
if (reserved != 0) {
|
||||
LOG_ERROR(Kernel, "Reserved value is non-zero! reserved={}", reserved);
|
||||
return ResultReservedValue;
|
||||
return ResultReservedUsed;
|
||||
}
|
||||
|
||||
handle_table_size = static_cast<s32>((flags >> 16) & 0x3FF);
|
||||
|
@ -371,7 +371,7 @@ ResultCode ProcessCapabilities::HandleDebugFlags(u32 flags) {
|
|||
const u32 reserved = flags >> 19;
|
||||
if (reserved != 0) {
|
||||
LOG_ERROR(Kernel, "Reserved value is non-zero! reserved={}", reserved);
|
||||
return ResultReservedValue;
|
||||
return ResultReservedUsed;
|
||||
}
|
||||
|
||||
is_debuggable = (flags & 0x20000) != 0;
|
||||
|
|
|
@ -113,7 +113,7 @@ ResultCode MapUnmapMemorySanityChecks(const KPageTable& manager, VAddr dst_addr,
|
|||
LOG_ERROR(Kernel_SVC,
|
||||
"Destination is not within the stack region, addr=0x{:016X}, size=0x{:016X}",
|
||||
dst_addr, size);
|
||||
return ResultInvalidMemoryRange;
|
||||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
if (manager.IsInsideHeapRegion(dst_addr, size)) {
|
||||
|
@ -121,7 +121,7 @@ ResultCode MapUnmapMemorySanityChecks(const KPageTable& manager, VAddr dst_addr,
|
|||
"Destination does not fit within the heap region, addr=0x{:016X}, "
|
||||
"size=0x{:016X}",
|
||||
dst_addr, size);
|
||||
return ResultInvalidMemoryRange;
|
||||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
if (manager.IsInsideAliasRegion(dst_addr, size)) {
|
||||
|
@ -129,7 +129,7 @@ ResultCode MapUnmapMemorySanityChecks(const KPageTable& manager, VAddr dst_addr,
|
|||
"Destination does not fit within the map region, addr=0x{:016X}, "
|
||||
"size=0x{:016X}",
|
||||
dst_addr, size);
|
||||
return ResultInvalidMemoryRange;
|
||||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
return RESULT_SUCCESS;
|
||||
|
@ -943,7 +943,7 @@ static ResultCode MapPhysicalMemory(Core::System& system, VAddr addr, u64 size)
|
|||
|
||||
if (!(addr < addr + size)) {
|
||||
LOG_ERROR(Kernel_SVC, "Size causes 64-bit overflow of address");
|
||||
return ResultInvalidMemoryRange;
|
||||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
Process* const current_process{system.Kernel().CurrentProcess()};
|
||||
|
@ -958,14 +958,14 @@ static ResultCode MapPhysicalMemory(Core::System& system, VAddr addr, u64 size)
|
|||
LOG_ERROR(Kernel_SVC,
|
||||
"Address is not within the address space, addr=0x{:016X}, size=0x{:016X}", addr,
|
||||
size);
|
||||
return ResultInvalidMemoryRange;
|
||||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
if (page_table.IsOutsideAliasRegion(addr, size)) {
|
||||
LOG_ERROR(Kernel_SVC,
|
||||
"Address is not within the alias region, addr=0x{:016X}, size=0x{:016X}", addr,
|
||||
size);
|
||||
return ResultInvalidMemoryRange;
|
||||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
return page_table.MapPhysicalMemory(addr, size);
|
||||
|
@ -997,7 +997,7 @@ static ResultCode UnmapPhysicalMemory(Core::System& system, VAddr addr, u64 size
|
|||
|
||||
if (!(addr < addr + size)) {
|
||||
LOG_ERROR(Kernel_SVC, "Size causes 64-bit overflow of address");
|
||||
return ResultInvalidMemoryRange;
|
||||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
Process* const current_process{system.Kernel().CurrentProcess()};
|
||||
|
@ -1012,14 +1012,14 @@ static ResultCode UnmapPhysicalMemory(Core::System& system, VAddr addr, u64 size
|
|||
LOG_ERROR(Kernel_SVC,
|
||||
"Address is not within the address space, addr=0x{:016X}, size=0x{:016X}", addr,
|
||||
size);
|
||||
return ResultInvalidMemoryRange;
|
||||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
if (page_table.IsOutsideAliasRegion(addr, size)) {
|
||||
LOG_ERROR(Kernel_SVC,
|
||||
"Address is not within the alias region, addr=0x{:016X}, size=0x{:016X}", addr,
|
||||
size);
|
||||
return ResultInvalidMemoryRange;
|
||||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
return page_table.UnmapPhysicalMemory(addr, size);
|
||||
|
@ -1138,7 +1138,7 @@ static ResultCode MapSharedMemory(Core::System& system, Handle shared_memory_han
|
|||
if ((permission_type | MemoryPermission::Write) != MemoryPermission::ReadWrite) {
|
||||
LOG_ERROR(Kernel_SVC, "Expected Read or ReadWrite permission but got permissions=0x{:08X}",
|
||||
permissions);
|
||||
return ResultInvalidMemoryPermissions;
|
||||
return ResultInvalidNewMemoryPermission;
|
||||
}
|
||||
|
||||
auto* const current_process{system.Kernel().CurrentProcess()};
|
||||
|
@ -1149,7 +1149,7 @@ static ResultCode MapSharedMemory(Core::System& system, Handle shared_memory_han
|
|||
"Addr does not fit within the valid region, addr=0x{:016X}, "
|
||||
"size=0x{:016X}",
|
||||
addr, size);
|
||||
return ResultInvalidMemoryRange;
|
||||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
if (page_table.IsInsideHeapRegion(addr, size)) {
|
||||
|
@ -1157,7 +1157,7 @@ static ResultCode MapSharedMemory(Core::System& system, Handle shared_memory_han
|
|||
"Addr does not fit within the heap region, addr=0x{:016X}, "
|
||||
"size=0x{:016X}",
|
||||
addr, size);
|
||||
return ResultInvalidMemoryRange;
|
||||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
if (page_table.IsInsideAliasRegion(addr, size)) {
|
||||
|
@ -1165,7 +1165,7 @@ static ResultCode MapSharedMemory(Core::System& system, Handle shared_memory_han
|
|||
"Address does not fit within the map region, addr=0x{:016X}, "
|
||||
"size=0x{:016X}",
|
||||
addr, size);
|
||||
return ResultInvalidMemoryRange;
|
||||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
auto shared_memory{
|
||||
|
@ -1290,7 +1290,7 @@ static ResultCode MapProcessCodeMemory(Core::System& system, Handle process_hand
|
|||
"Destination address range is not within the ASLR region (dst_address=0x{:016X}, "
|
||||
"size=0x{:016X}).",
|
||||
dst_address, size);
|
||||
return ResultInvalidMemoryRange;
|
||||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
return page_table.MapProcessCodeMemory(dst_address, src_address, size);
|
||||
|
@ -1358,7 +1358,7 @@ static ResultCode UnmapProcessCodeMemory(Core::System& system, Handle process_ha
|
|||
"Destination address range is not within the ASLR region (dst_address=0x{:016X}, "
|
||||
"size=0x{:016X}).",
|
||||
dst_address, size);
|
||||
return ResultInvalidMemoryRange;
|
||||
return ResultInvalidMemoryRegion;
|
||||
}
|
||||
|
||||
return page_table.UnmapProcessCodeMemory(dst_address, src_address, size);
|
||||
|
@ -1427,7 +1427,7 @@ static ResultCode CreateThread(Core::System& system, Handle* out_handle, VAddr e
|
|||
system.CoreTiming().GetGlobalTimeNs().count() + 100000000);
|
||||
if (!thread_reservation.Succeeded()) {
|
||||
LOG_ERROR(Kernel_SVC, "Could not reserve a new thread");
|
||||
return ResultResourceLimitedExceeded;
|
||||
return ResultLimitReached;
|
||||
}
|
||||
|
||||
// Create the thread.
|
||||
|
@ -1795,7 +1795,7 @@ static ResultCode CreateTransferMemory(Core::System& system, Handle* handle, VAd
|
|||
if (perms > MemoryPermission::ReadWrite || perms == MemoryPermission::Write) {
|
||||
LOG_ERROR(Kernel_SVC, "Invalid memory permissions for transfer memory! (perms={:08X})",
|
||||
permissions);
|
||||
return ResultInvalidMemoryPermissions;
|
||||
return ResultInvalidNewMemoryPermission;
|
||||
}
|
||||
|
||||
auto& kernel = system.Kernel();
|
||||
|
@ -1804,7 +1804,7 @@ static ResultCode CreateTransferMemory(Core::System& system, Handle* handle, VAd
|
|||
LimitableResource::TransferMemory);
|
||||
if (!trmem_reservation.Succeeded()) {
|
||||
LOG_ERROR(Kernel_SVC, "Could not reserve a new transfer memory");
|
||||
return ResultResourceLimitedExceeded;
|
||||
return ResultLimitReached;
|
||||
}
|
||||
auto transfer_mem_handle = TransferMemory::Create(kernel, system.Memory(), addr, size,
|
||||
static_cast<KMemoryPermission>(perms));
|
||||
|
@ -1940,7 +1940,7 @@ static ResultCode CreateEvent(Core::System& system, Handle* out_write, Handle* o
|
|||
// Reserve a new event from the process resource limit
|
||||
KScopedResourceReservation event_reservation(kernel.CurrentProcess(),
|
||||
LimitableResource::Events);
|
||||
R_UNLESS(event_reservation.Succeeded(), ResultResourceLimitedExceeded);
|
||||
R_UNLESS(event_reservation.Succeeded(), ResultLimitReached);
|
||||
|
||||
// Create a new event.
|
||||
KEvent* event = KEvent::Create(kernel);
|
||||
|
|
|
@ -10,18 +10,18 @@ namespace Kernel {
|
|||
|
||||
// Confirmed Switch kernel error codes
|
||||
|
||||
constexpr ResultCode ResultMaxConnectionsReached{ErrorModule::Kernel, 7};
|
||||
constexpr ResultCode ResultInvalidCapabilityDescriptor{ErrorModule::Kernel, 14};
|
||||
constexpr ResultCode ResultOutOfSessions{ErrorModule::Kernel, 7};
|
||||
constexpr ResultCode ResultInvalidArgument{ErrorModule::Kernel, 14};
|
||||
constexpr ResultCode ResultNoSynchronizationObject{ErrorModule::Kernel, 57};
|
||||
constexpr ResultCode ResultTerminationRequested{ErrorModule::Kernel, 59};
|
||||
constexpr ResultCode ResultInvalidSize{ErrorModule::Kernel, 101};
|
||||
constexpr ResultCode ResultInvalidAddress{ErrorModule::Kernel, 102};
|
||||
constexpr ResultCode ResultOutOfResource{ErrorModule::Kernel, 103};
|
||||
constexpr ResultCode ResultOutOfMemory{ErrorModule::Kernel, 104};
|
||||
constexpr ResultCode ResultHandleTableFull{ErrorModule::Kernel, 105};
|
||||
constexpr ResultCode ResultOutOfHandles{ErrorModule::Kernel, 105};
|
||||
constexpr ResultCode ResultInvalidCurrentMemory{ErrorModule::Kernel, 106};
|
||||
constexpr ResultCode ResultInvalidMemoryPermissions{ErrorModule::Kernel, 108};
|
||||
constexpr ResultCode ResultInvalidMemoryRange{ErrorModule::Kernel, 110};
|
||||
constexpr ResultCode ResultInvalidNewMemoryPermission{ErrorModule::Kernel, 108};
|
||||
constexpr ResultCode ResultInvalidMemoryRegion{ErrorModule::Kernel, 110};
|
||||
constexpr ResultCode ResultInvalidPriority{ErrorModule::Kernel, 112};
|
||||
constexpr ResultCode ResultInvalidCoreId{ErrorModule::Kernel, 113};
|
||||
constexpr ResultCode ResultInvalidHandle{ErrorModule::Kernel, 114};
|
||||
|
@ -33,9 +33,10 @@ constexpr ResultCode ResultOutOfRange{ErrorModule::Kernel, 119};
|
|||
constexpr ResultCode ResultInvalidEnumValue{ErrorModule::Kernel, 120};
|
||||
constexpr ResultCode ResultNotFound{ErrorModule::Kernel, 121};
|
||||
constexpr ResultCode ResultBusy{ErrorModule::Kernel, 122};
|
||||
constexpr ResultCode ResultSessionClosedByRemote{ErrorModule::Kernel, 123};
|
||||
constexpr ResultCode ResultSessionClosed{ErrorModule::Kernel, 123};
|
||||
constexpr ResultCode ResultInvalidState{ErrorModule::Kernel, 125};
|
||||
constexpr ResultCode ResultReservedValue{ErrorModule::Kernel, 126};
|
||||
constexpr ResultCode ResultResourceLimitedExceeded{ErrorModule::Kernel, 132};
|
||||
constexpr ResultCode ResultReservedUsed{ErrorModule::Kernel, 126};
|
||||
constexpr ResultCode ResultLimitReached{ErrorModule::Kernel, 132};
|
||||
constexpr ResultCode ResultInvalidId{ErrorModule::Kernel, 519};
|
||||
|
||||
} // namespace Kernel
|
||||
|
|
Loading…
Reference in a new issue