make rest of kernel use experimental new macro-ing

This commit is contained in:
Michael Scire 2022-02-05 16:34:05 -08:00
parent 4659a5e793
commit b1eea065da
78 changed files with 606 additions and 606 deletions

View File

@ -191,7 +191,7 @@ namespace ams::kern::arch::arm64 {
Result Map(KProcessAddress virt_addr, KPhysicalAddress phys_addr, size_t num_pages, PageTableEntry entry_template, bool disable_head_merge, size_t page_size, PageLinkedList *page_list, bool reuse_ll) { Result Map(KProcessAddress virt_addr, KPhysicalAddress phys_addr, size_t num_pages, PageTableEntry entry_template, bool disable_head_merge, size_t page_size, PageLinkedList *page_list, bool reuse_ll) {
switch (page_size) { switch (page_size) {
case L1BlockSize: case L1BlockSize:
return this->MapL1Blocks(virt_addr, phys_addr, num_pages, entry_template, disable_head_merge, page_list, reuse_ll); R_RETURN(this->MapL1Blocks(virt_addr, phys_addr, num_pages, entry_template, disable_head_merge, page_list, reuse_ll));
case L2ContiguousBlockSize: case L2ContiguousBlockSize:
entry_template.SetContiguous(true); entry_template.SetContiguous(true);
[[fallthrough]]; [[fallthrough]];
@ -199,12 +199,12 @@ namespace ams::kern::arch::arm64 {
case L2TegraSmmuBlockSize: case L2TegraSmmuBlockSize:
#endif #endif
case L2BlockSize: case L2BlockSize:
return this->MapL2Blocks(virt_addr, phys_addr, num_pages, entry_template, disable_head_merge, page_list, reuse_ll); R_RETURN(this->MapL2Blocks(virt_addr, phys_addr, num_pages, entry_template, disable_head_merge, page_list, reuse_ll));
case L3ContiguousBlockSize: case L3ContiguousBlockSize:
entry_template.SetContiguous(true); entry_template.SetContiguous(true);
[[fallthrough]]; [[fallthrough]];
case L3BlockSize: case L3BlockSize:
return this->MapL3Blocks(virt_addr, phys_addr, num_pages, entry_template, disable_head_merge, page_list, reuse_ll); R_RETURN(this->MapL3Blocks(virt_addr, phys_addr, num_pages, entry_template, disable_head_merge, page_list, reuse_ll));
MESOSPHERE_UNREACHABLE_DEFAULT_CASE(); MESOSPHERE_UNREACHABLE_DEFAULT_CASE();
} }
} }

View File

@ -29,7 +29,7 @@ namespace ams::kern::arch::arm64 {
} }
Result Initialize(u32 id, ams::svc::CreateProcessFlag as_type, bool enable_aslr, bool enable_das_merge, bool from_back, KMemoryManager::Pool pool, KProcessAddress code_address, size_t code_size, KMemoryBlockSlabManager *mem_block_slab_manager, KBlockInfoManager *block_info_manager, KPageTableManager *pt_manager, KResourceLimit *resource_limit) { Result Initialize(u32 id, ams::svc::CreateProcessFlag as_type, bool enable_aslr, bool enable_das_merge, bool from_back, KMemoryManager::Pool pool, KProcessAddress code_address, size_t code_size, KMemoryBlockSlabManager *mem_block_slab_manager, KBlockInfoManager *block_info_manager, KPageTableManager *pt_manager, KResourceLimit *resource_limit) {
return m_page_table.InitializeForProcess(id, as_type, enable_aslr, enable_das_merge, from_back, pool, code_address, code_size, mem_block_slab_manager, block_info_manager, pt_manager, resource_limit); R_RETURN(m_page_table.InitializeForProcess(id, as_type, enable_aslr, enable_das_merge, from_back, pool, code_address, code_size, mem_block_slab_manager, block_info_manager, pt_manager, resource_limit));
} }
void Finalize() { m_page_table.Finalize(); } void Finalize() { m_page_table.Finalize(); }
@ -39,231 +39,231 @@ namespace ams::kern::arch::arm64 {
} }
Result SetMemoryPermission(KProcessAddress addr, size_t size, ams::svc::MemoryPermission perm) { Result SetMemoryPermission(KProcessAddress addr, size_t size, ams::svc::MemoryPermission perm) {
return m_page_table.SetMemoryPermission(addr, size, perm); R_RETURN(m_page_table.SetMemoryPermission(addr, size, perm));
} }
Result SetProcessMemoryPermission(KProcessAddress addr, size_t size, ams::svc::MemoryPermission perm) { Result SetProcessMemoryPermission(KProcessAddress addr, size_t size, ams::svc::MemoryPermission perm) {
return m_page_table.SetProcessMemoryPermission(addr, size, perm); R_RETURN(m_page_table.SetProcessMemoryPermission(addr, size, perm));
} }
Result SetMemoryAttribute(KProcessAddress addr, size_t size, u32 mask, u32 attr) { Result SetMemoryAttribute(KProcessAddress addr, size_t size, u32 mask, u32 attr) {
return m_page_table.SetMemoryAttribute(addr, size, mask, attr); R_RETURN(m_page_table.SetMemoryAttribute(addr, size, mask, attr));
} }
Result SetHeapSize(KProcessAddress *out, size_t size) { Result SetHeapSize(KProcessAddress *out, size_t size) {
return m_page_table.SetHeapSize(out, size); R_RETURN(m_page_table.SetHeapSize(out, size));
} }
Result SetMaxHeapSize(size_t size) { Result SetMaxHeapSize(size_t size) {
return m_page_table.SetMaxHeapSize(size); R_RETURN(m_page_table.SetMaxHeapSize(size));
} }
Result QueryInfo(KMemoryInfo *out_info, ams::svc::PageInfo *out_page_info, KProcessAddress addr) const { Result QueryInfo(KMemoryInfo *out_info, ams::svc::PageInfo *out_page_info, KProcessAddress addr) const {
return m_page_table.QueryInfo(out_info, out_page_info, addr); R_RETURN(m_page_table.QueryInfo(out_info, out_page_info, addr));
} }
Result QueryPhysicalAddress(ams::svc::PhysicalMemoryInfo *out, KProcessAddress address) const { Result QueryPhysicalAddress(ams::svc::PhysicalMemoryInfo *out, KProcessAddress address) const {
return m_page_table.QueryPhysicalAddress(out, address); R_RETURN(m_page_table.QueryPhysicalAddress(out, address));
} }
Result QueryStaticMapping(KProcessAddress *out, KPhysicalAddress address, size_t size) const { Result QueryStaticMapping(KProcessAddress *out, KPhysicalAddress address, size_t size) const {
return m_page_table.QueryStaticMapping(out, address, size); R_RETURN(m_page_table.QueryStaticMapping(out, address, size));
} }
Result QueryIoMapping(KProcessAddress *out, KPhysicalAddress address, size_t size) const { Result QueryIoMapping(KProcessAddress *out, KPhysicalAddress address, size_t size) const {
return m_page_table.QueryIoMapping(out, address, size); R_RETURN(m_page_table.QueryIoMapping(out, address, size));
} }
Result MapMemory(KProcessAddress dst_address, KProcessAddress src_address, size_t size) { Result MapMemory(KProcessAddress dst_address, KProcessAddress src_address, size_t size) {
return m_page_table.MapMemory(dst_address, src_address, size); R_RETURN(m_page_table.MapMemory(dst_address, src_address, size));
} }
Result UnmapMemory(KProcessAddress dst_address, KProcessAddress src_address, size_t size) { Result UnmapMemory(KProcessAddress dst_address, KProcessAddress src_address, size_t size) {
return m_page_table.UnmapMemory(dst_address, src_address, size); R_RETURN(m_page_table.UnmapMemory(dst_address, src_address, size));
} }
Result MapCodeMemory(KProcessAddress dst_address, KProcessAddress src_address, size_t size) { Result MapCodeMemory(KProcessAddress dst_address, KProcessAddress src_address, size_t size) {
return m_page_table.MapCodeMemory(dst_address, src_address, size); R_RETURN(m_page_table.MapCodeMemory(dst_address, src_address, size));
} }
Result UnmapCodeMemory(KProcessAddress dst_address, KProcessAddress src_address, size_t size) { Result UnmapCodeMemory(KProcessAddress dst_address, KProcessAddress src_address, size_t size) {
return m_page_table.UnmapCodeMemory(dst_address, src_address, size); R_RETURN(m_page_table.UnmapCodeMemory(dst_address, src_address, size));
} }
Result MapIo(KPhysicalAddress phys_addr, size_t size, KMemoryPermission perm) { Result MapIo(KPhysicalAddress phys_addr, size_t size, KMemoryPermission perm) {
return m_page_table.MapIo(phys_addr, size, perm); R_RETURN(m_page_table.MapIo(phys_addr, size, perm));
} }
Result MapIoRegion(KProcessAddress dst_address, KPhysicalAddress phys_addr, size_t size, ams::svc::MemoryMapping mapping, ams::svc::MemoryPermission perm) { Result MapIoRegion(KProcessAddress dst_address, KPhysicalAddress phys_addr, size_t size, ams::svc::MemoryMapping mapping, ams::svc::MemoryPermission perm) {
return m_page_table.MapIoRegion(dst_address, phys_addr, size, mapping, perm); R_RETURN(m_page_table.MapIoRegion(dst_address, phys_addr, size, mapping, perm));
} }
Result UnmapIoRegion(KProcessAddress dst_address, KPhysicalAddress phys_addr, size_t size) { Result UnmapIoRegion(KProcessAddress dst_address, KPhysicalAddress phys_addr, size_t size) {
return m_page_table.UnmapIoRegion(dst_address, phys_addr, size); R_RETURN(m_page_table.UnmapIoRegion(dst_address, phys_addr, size));
} }
Result MapStatic(KPhysicalAddress phys_addr, size_t size, KMemoryPermission perm) { Result MapStatic(KPhysicalAddress phys_addr, size_t size, KMemoryPermission perm) {
return m_page_table.MapStatic(phys_addr, size, perm); R_RETURN(m_page_table.MapStatic(phys_addr, size, perm));
} }
Result MapRegion(KMemoryRegionType region_type, KMemoryPermission perm) { Result MapRegion(KMemoryRegionType region_type, KMemoryPermission perm) {
return m_page_table.MapRegion(region_type, perm); R_RETURN(m_page_table.MapRegion(region_type, perm));
} }
Result MapPageGroup(KProcessAddress addr, const KPageGroup &pg, KMemoryState state, KMemoryPermission perm) { Result MapPageGroup(KProcessAddress addr, const KPageGroup &pg, KMemoryState state, KMemoryPermission perm) {
return m_page_table.MapPageGroup(addr, pg, state, perm); R_RETURN(m_page_table.MapPageGroup(addr, pg, state, perm));
} }
Result UnmapPageGroup(KProcessAddress address, const KPageGroup &pg, KMemoryState state) { Result UnmapPageGroup(KProcessAddress address, const KPageGroup &pg, KMemoryState state) {
return m_page_table.UnmapPageGroup(address, pg, state); R_RETURN(m_page_table.UnmapPageGroup(address, pg, state));
} }
Result MapPages(KProcessAddress *out_addr, size_t num_pages, size_t alignment, KPhysicalAddress phys_addr, KMemoryState state, KMemoryPermission perm) { Result MapPages(KProcessAddress *out_addr, size_t num_pages, size_t alignment, KPhysicalAddress phys_addr, KMemoryState state, KMemoryPermission perm) {
return m_page_table.MapPages(out_addr, num_pages, alignment, phys_addr, state, perm); R_RETURN(m_page_table.MapPages(out_addr, num_pages, alignment, phys_addr, state, perm));
} }
Result MapPages(KProcessAddress *out_addr, size_t num_pages, KMemoryState state, KMemoryPermission perm) { Result MapPages(KProcessAddress *out_addr, size_t num_pages, KMemoryState state, KMemoryPermission perm) {
return m_page_table.MapPages(out_addr, num_pages, state, perm); R_RETURN(m_page_table.MapPages(out_addr, num_pages, state, perm));
} }
Result MapPages(KProcessAddress address, size_t num_pages, KMemoryState state, KMemoryPermission perm) { Result MapPages(KProcessAddress address, size_t num_pages, KMemoryState state, KMemoryPermission perm) {
return m_page_table.MapPages(address, num_pages, state, perm); R_RETURN(m_page_table.MapPages(address, num_pages, state, perm));
} }
Result UnmapPages(KProcessAddress addr, size_t num_pages, KMemoryState state) { Result UnmapPages(KProcessAddress addr, size_t num_pages, KMemoryState state) {
return m_page_table.UnmapPages(addr, num_pages, state); R_RETURN(m_page_table.UnmapPages(addr, num_pages, state));
} }
Result MakeAndOpenPageGroup(KPageGroup *out, KProcessAddress address, size_t num_pages, u32 state_mask, u32 state, u32 perm_mask, u32 perm, u32 attr_mask, u32 attr) { Result MakeAndOpenPageGroup(KPageGroup *out, KProcessAddress address, size_t num_pages, u32 state_mask, u32 state, u32 perm_mask, u32 perm, u32 attr_mask, u32 attr) {
return m_page_table.MakeAndOpenPageGroup(out, address, num_pages, state_mask, state, perm_mask, perm, attr_mask, attr); R_RETURN(m_page_table.MakeAndOpenPageGroup(out, address, num_pages, state_mask, state, perm_mask, perm, attr_mask, attr));
} }
Result InvalidateProcessDataCache(KProcessAddress address, size_t size) { Result InvalidateProcessDataCache(KProcessAddress address, size_t size) {
return m_page_table.InvalidateProcessDataCache(address, size); R_RETURN(m_page_table.InvalidateProcessDataCache(address, size));
} }
Result ReadDebugMemory(void *buffer, KProcessAddress address, size_t size) { Result ReadDebugMemory(void *buffer, KProcessAddress address, size_t size) {
return m_page_table.ReadDebugMemory(buffer, address, size); R_RETURN(m_page_table.ReadDebugMemory(buffer, address, size));
} }
Result ReadDebugIoMemory(void *buffer, KProcessAddress address, size_t size) { Result ReadDebugIoMemory(void *buffer, KProcessAddress address, size_t size) {
return m_page_table.ReadDebugIoMemory(buffer, address, size); R_RETURN(m_page_table.ReadDebugIoMemory(buffer, address, size));
} }
Result WriteDebugMemory(KProcessAddress address, const void *buffer, size_t size) { Result WriteDebugMemory(KProcessAddress address, const void *buffer, size_t size) {
return m_page_table.WriteDebugMemory(address, buffer, size); R_RETURN(m_page_table.WriteDebugMemory(address, buffer, size));
} }
Result WriteDebugIoMemory(KProcessAddress address, const void *buffer, size_t size) { Result WriteDebugIoMemory(KProcessAddress address, const void *buffer, size_t size) {
return m_page_table.WriteDebugIoMemory(address, buffer, size); R_RETURN(m_page_table.WriteDebugIoMemory(address, buffer, size));
} }
Result LockForMapDeviceAddressSpace(KProcessAddress address, size_t size, KMemoryPermission perm, bool is_aligned) { Result LockForMapDeviceAddressSpace(KProcessAddress address, size_t size, KMemoryPermission perm, bool is_aligned) {
return m_page_table.LockForMapDeviceAddressSpace(address, size, perm, is_aligned); R_RETURN(m_page_table.LockForMapDeviceAddressSpace(address, size, perm, is_aligned));
} }
Result LockForUnmapDeviceAddressSpace(KProcessAddress address, size_t size) { Result LockForUnmapDeviceAddressSpace(KProcessAddress address, size_t size) {
return m_page_table.LockForUnmapDeviceAddressSpace(address, size); R_RETURN(m_page_table.LockForUnmapDeviceAddressSpace(address, size));
} }
Result UnlockForDeviceAddressSpace(KProcessAddress address, size_t size) { Result UnlockForDeviceAddressSpace(KProcessAddress address, size_t size) {
return m_page_table.UnlockForDeviceAddressSpace(address, size); R_RETURN(m_page_table.UnlockForDeviceAddressSpace(address, size));
} }
Result UnlockForDeviceAddressSpacePartialMap(KProcessAddress address, size_t size) { Result UnlockForDeviceAddressSpacePartialMap(KProcessAddress address, size_t size) {
return m_page_table.UnlockForDeviceAddressSpacePartialMap(address, size); R_RETURN(m_page_table.UnlockForDeviceAddressSpacePartialMap(address, size));
} }
Result OpenMemoryRangeForMapDeviceAddressSpace(KPageTableBase::MemoryRange *out, KProcessAddress address, size_t size, KMemoryPermission perm, bool is_aligned) { Result OpenMemoryRangeForMapDeviceAddressSpace(KPageTableBase::MemoryRange *out, KProcessAddress address, size_t size, KMemoryPermission perm, bool is_aligned) {
return m_page_table.OpenMemoryRangeForMapDeviceAddressSpace(out, address, size, perm, is_aligned); R_RETURN(m_page_table.OpenMemoryRangeForMapDeviceAddressSpace(out, address, size, perm, is_aligned));
} }
Result OpenMemoryRangeForUnmapDeviceAddressSpace(KPageTableBase::MemoryRange *out, KProcessAddress address, size_t size) { Result OpenMemoryRangeForUnmapDeviceAddressSpace(KPageTableBase::MemoryRange *out, KProcessAddress address, size_t size) {
return m_page_table.OpenMemoryRangeForUnmapDeviceAddressSpace(out, address, size); R_RETURN(m_page_table.OpenMemoryRangeForUnmapDeviceAddressSpace(out, address, size));
} }
Result LockForIpcUserBuffer(KPhysicalAddress *out, KProcessAddress address, size_t size) { Result LockForIpcUserBuffer(KPhysicalAddress *out, KProcessAddress address, size_t size) {
return m_page_table.LockForIpcUserBuffer(out, address, size); R_RETURN(m_page_table.LockForIpcUserBuffer(out, address, size));
} }
Result UnlockForIpcUserBuffer(KProcessAddress address, size_t size) { Result UnlockForIpcUserBuffer(KProcessAddress address, size_t size) {
return m_page_table.UnlockForIpcUserBuffer(address, size); R_RETURN(m_page_table.UnlockForIpcUserBuffer(address, size));
} }
Result LockForTransferMemory(KPageGroup *out, KProcessAddress address, size_t size, KMemoryPermission perm) { Result LockForTransferMemory(KPageGroup *out, KProcessAddress address, size_t size, KMemoryPermission perm) {
return m_page_table.LockForTransferMemory(out, address, size, perm); R_RETURN(m_page_table.LockForTransferMemory(out, address, size, perm));
} }
Result UnlockForTransferMemory(KProcessAddress address, size_t size, const KPageGroup &pg) { Result UnlockForTransferMemory(KProcessAddress address, size_t size, const KPageGroup &pg) {
return m_page_table.UnlockForTransferMemory(address, size, pg); R_RETURN(m_page_table.UnlockForTransferMemory(address, size, pg));
} }
Result LockForCodeMemory(KPageGroup *out, KProcessAddress address, size_t size) { Result LockForCodeMemory(KPageGroup *out, KProcessAddress address, size_t size) {
return m_page_table.LockForCodeMemory(out, address, size); R_RETURN(m_page_table.LockForCodeMemory(out, address, size));
} }
Result UnlockForCodeMemory(KProcessAddress address, size_t size, const KPageGroup &pg) { Result UnlockForCodeMemory(KProcessAddress address, size_t size, const KPageGroup &pg) {
return m_page_table.UnlockForCodeMemory(address, size, pg); R_RETURN(m_page_table.UnlockForCodeMemory(address, size, pg));
} }
Result OpenMemoryRangeForProcessCacheOperation(KPageTableBase::MemoryRange *out, KProcessAddress address, size_t size) { Result OpenMemoryRangeForProcessCacheOperation(KPageTableBase::MemoryRange *out, KProcessAddress address, size_t size) {
return m_page_table.OpenMemoryRangeForProcessCacheOperation(out, address, size); R_RETURN(m_page_table.OpenMemoryRangeForProcessCacheOperation(out, address, size));
} }
Result CopyMemoryFromLinearToUser(KProcessAddress dst_addr, size_t size, KProcessAddress src_addr, u32 src_state_mask, u32 src_state, KMemoryPermission src_test_perm, u32 src_attr_mask, u32 src_attr) { Result CopyMemoryFromLinearToUser(KProcessAddress dst_addr, size_t size, KProcessAddress src_addr, u32 src_state_mask, u32 src_state, KMemoryPermission src_test_perm, u32 src_attr_mask, u32 src_attr) {
return m_page_table.CopyMemoryFromLinearToUser(dst_addr, size, src_addr, src_state_mask, src_state, src_test_perm, src_attr_mask, src_attr); R_RETURN(m_page_table.CopyMemoryFromLinearToUser(dst_addr, size, src_addr, src_state_mask, src_state, src_test_perm, src_attr_mask, src_attr));
} }
Result CopyMemoryFromLinearToKernel(KProcessAddress dst_addr, size_t size, KProcessAddress src_addr, u32 src_state_mask, u32 src_state, KMemoryPermission src_test_perm, u32 src_attr_mask, u32 src_attr) { Result CopyMemoryFromLinearToKernel(KProcessAddress dst_addr, size_t size, KProcessAddress src_addr, u32 src_state_mask, u32 src_state, KMemoryPermission src_test_perm, u32 src_attr_mask, u32 src_attr) {
return m_page_table.CopyMemoryFromLinearToKernel(dst_addr, size, src_addr, src_state_mask, src_state, src_test_perm, src_attr_mask, src_attr); R_RETURN(m_page_table.CopyMemoryFromLinearToKernel(dst_addr, size, src_addr, src_state_mask, src_state, src_test_perm, src_attr_mask, src_attr));
} }
Result CopyMemoryFromUserToLinear(KProcessAddress dst_addr, size_t size, u32 dst_state_mask, u32 dst_state, KMemoryPermission dst_test_perm, u32 dst_attr_mask, u32 dst_attr, KProcessAddress src_addr) { Result CopyMemoryFromUserToLinear(KProcessAddress dst_addr, size_t size, u32 dst_state_mask, u32 dst_state, KMemoryPermission dst_test_perm, u32 dst_attr_mask, u32 dst_attr, KProcessAddress src_addr) {
return m_page_table.CopyMemoryFromUserToLinear(dst_addr, size, dst_state_mask, dst_state, dst_test_perm, dst_attr_mask, dst_attr, src_addr); R_RETURN(m_page_table.CopyMemoryFromUserToLinear(dst_addr, size, dst_state_mask, dst_state, dst_test_perm, dst_attr_mask, dst_attr, src_addr));
} }
Result CopyMemoryFromKernelToLinear(KProcessAddress dst_addr, size_t size, u32 dst_state_mask, u32 dst_state, KMemoryPermission dst_test_perm, u32 dst_attr_mask, u32 dst_attr, KProcessAddress src_addr) { Result CopyMemoryFromKernelToLinear(KProcessAddress dst_addr, size_t size, u32 dst_state_mask, u32 dst_state, KMemoryPermission dst_test_perm, u32 dst_attr_mask, u32 dst_attr, KProcessAddress src_addr) {
return m_page_table.CopyMemoryFromKernelToLinear(dst_addr, size, dst_state_mask, dst_state, dst_test_perm, dst_attr_mask, dst_attr, src_addr); R_RETURN(m_page_table.CopyMemoryFromKernelToLinear(dst_addr, size, dst_state_mask, dst_state, dst_test_perm, dst_attr_mask, dst_attr, src_addr));
} }
Result CopyMemoryFromHeapToHeap(KProcessPageTable &dst_page_table, KProcessAddress dst_addr, size_t size, u32 dst_state_mask, u32 dst_state, KMemoryPermission dst_test_perm, u32 dst_attr_mask, u32 dst_attr, KProcessAddress src_addr, u32 src_state_mask, u32 src_state, KMemoryPermission src_test_perm, u32 src_attr_mask, u32 src_attr) { Result CopyMemoryFromHeapToHeap(KProcessPageTable &dst_page_table, KProcessAddress dst_addr, size_t size, u32 dst_state_mask, u32 dst_state, KMemoryPermission dst_test_perm, u32 dst_attr_mask, u32 dst_attr, KProcessAddress src_addr, u32 src_state_mask, u32 src_state, KMemoryPermission src_test_perm, u32 src_attr_mask, u32 src_attr) {
return m_page_table.CopyMemoryFromHeapToHeap(dst_page_table.m_page_table, dst_addr, size, dst_state_mask, dst_state, dst_test_perm, dst_attr_mask, dst_attr, src_addr, src_state_mask, src_state, src_test_perm, src_attr_mask, src_attr); R_RETURN(m_page_table.CopyMemoryFromHeapToHeap(dst_page_table.m_page_table, dst_addr, size, dst_state_mask, dst_state, dst_test_perm, dst_attr_mask, dst_attr, src_addr, src_state_mask, src_state, src_test_perm, src_attr_mask, src_attr));
} }
Result CopyMemoryFromHeapToHeapWithoutCheckDestination(KProcessPageTable &dst_page_table, KProcessAddress dst_addr, size_t size, u32 dst_state_mask, u32 dst_state, KMemoryPermission dst_test_perm, u32 dst_attr_mask, u32 dst_attr, KProcessAddress src_addr, u32 src_state_mask, u32 src_state, KMemoryPermission src_test_perm, u32 src_attr_mask, u32 src_attr) { Result CopyMemoryFromHeapToHeapWithoutCheckDestination(KProcessPageTable &dst_page_table, KProcessAddress dst_addr, size_t size, u32 dst_state_mask, u32 dst_state, KMemoryPermission dst_test_perm, u32 dst_attr_mask, u32 dst_attr, KProcessAddress src_addr, u32 src_state_mask, u32 src_state, KMemoryPermission src_test_perm, u32 src_attr_mask, u32 src_attr) {
return m_page_table.CopyMemoryFromHeapToHeapWithoutCheckDestination(dst_page_table.m_page_table, dst_addr, size, dst_state_mask, dst_state, dst_test_perm, dst_attr_mask, dst_attr, src_addr, src_state_mask, src_state, src_test_perm, src_attr_mask, src_attr); R_RETURN(m_page_table.CopyMemoryFromHeapToHeapWithoutCheckDestination(dst_page_table.m_page_table, dst_addr, size, dst_state_mask, dst_state, dst_test_perm, dst_attr_mask, dst_attr, src_addr, src_state_mask, src_state, src_test_perm, src_attr_mask, src_attr));
} }
Result SetupForIpc(KProcessAddress *out_dst_addr, size_t size, KProcessAddress src_addr, KProcessPageTable &src_page_table, KMemoryPermission test_perm, KMemoryState dst_state, bool send) { Result SetupForIpc(KProcessAddress *out_dst_addr, size_t size, KProcessAddress src_addr, KProcessPageTable &src_page_table, KMemoryPermission test_perm, KMemoryState dst_state, bool send) {
return m_page_table.SetupForIpc(out_dst_addr, size, src_addr, src_page_table.m_page_table, test_perm, dst_state, send); R_RETURN(m_page_table.SetupForIpc(out_dst_addr, size, src_addr, src_page_table.m_page_table, test_perm, dst_state, send));
} }
Result CleanupForIpcServer(KProcessAddress address, size_t size, KMemoryState dst_state) { Result CleanupForIpcServer(KProcessAddress address, size_t size, KMemoryState dst_state) {
return m_page_table.CleanupForIpcServer(address, size, dst_state); R_RETURN(m_page_table.CleanupForIpcServer(address, size, dst_state));
} }
Result CleanupForIpcClient(KProcessAddress address, size_t size, KMemoryState dst_state) { Result CleanupForIpcClient(KProcessAddress address, size_t size, KMemoryState dst_state) {
return m_page_table.CleanupForIpcClient(address, size, dst_state); R_RETURN(m_page_table.CleanupForIpcClient(address, size, dst_state));
} }
Result MapPhysicalMemory(KProcessAddress address, size_t size) { Result MapPhysicalMemory(KProcessAddress address, size_t size) {
return m_page_table.MapPhysicalMemory(address, size); R_RETURN(m_page_table.MapPhysicalMemory(address, size));
} }
Result UnmapPhysicalMemory(KProcessAddress address, size_t size) { Result UnmapPhysicalMemory(KProcessAddress address, size_t size) {
return m_page_table.UnmapPhysicalMemory(address, size); R_RETURN(m_page_table.UnmapPhysicalMemory(address, size));
} }
Result MapPhysicalMemoryUnsafe(KProcessAddress address, size_t size) { Result MapPhysicalMemoryUnsafe(KProcessAddress address, size_t size) {
return m_page_table.MapPhysicalMemoryUnsafe(address, size); R_RETURN(m_page_table.MapPhysicalMemoryUnsafe(address, size));
} }
Result UnmapPhysicalMemoryUnsafe(KProcessAddress address, size_t size) { Result UnmapPhysicalMemoryUnsafe(KProcessAddress address, size_t size) {
return m_page_table.UnmapPhysicalMemoryUnsafe(address, size); R_RETURN(m_page_table.UnmapPhysicalMemoryUnsafe(address, size));
} }
Result UnmapProcessMemory(KProcessAddress dst_address, size_t size, KProcessPageTable &src_page_table, KProcessAddress src_address) { Result UnmapProcessMemory(KProcessAddress dst_address, size_t size, KProcessPageTable &src_page_table, KProcessAddress src_address) {
return m_page_table.UnmapProcessMemory(dst_address, size, src_page_table.m_page_table, src_address); R_RETURN(m_page_table.UnmapProcessMemory(dst_address, size, src_page_table.m_page_table, src_address));
} }
void DumpMemoryBlocks() const { void DumpMemoryBlocks() const {

View File

@ -42,19 +42,19 @@ namespace ams::kern::arch::arm64 {
} }
Result MapPages(KProcessAddress *out_addr, size_t num_pages, size_t alignment, KPhysicalAddress phys_addr, KProcessAddress region_start, size_t region_num_pages, KMemoryState state, KMemoryPermission perm) { Result MapPages(KProcessAddress *out_addr, size_t num_pages, size_t alignment, KPhysicalAddress phys_addr, KProcessAddress region_start, size_t region_num_pages, KMemoryState state, KMemoryPermission perm) {
return m_page_table.MapPages(out_addr, num_pages, alignment, phys_addr, region_start, region_num_pages, state, perm); R_RETURN(m_page_table.MapPages(out_addr, num_pages, alignment, phys_addr, region_start, region_num_pages, state, perm));
} }
Result UnmapPages(KProcessAddress address, size_t num_pages, KMemoryState state) { Result UnmapPages(KProcessAddress address, size_t num_pages, KMemoryState state) {
return m_page_table.UnmapPages(address, num_pages, state); R_RETURN(m_page_table.UnmapPages(address, num_pages, state));
} }
Result MapPageGroup(KProcessAddress *out_addr, const KPageGroup &pg, KProcessAddress region_start, size_t region_num_pages, KMemoryState state, KMemoryPermission perm) { Result MapPageGroup(KProcessAddress *out_addr, const KPageGroup &pg, KProcessAddress region_start, size_t region_num_pages, KMemoryState state, KMemoryPermission perm) {
return m_page_table.MapPageGroup(out_addr, pg, region_start, region_num_pages, state, perm); R_RETURN(m_page_table.MapPageGroup(out_addr, pg, region_start, region_num_pages, state, perm));
} }
Result UnmapPageGroup(KProcessAddress address, const KPageGroup &pg, KMemoryState state) { Result UnmapPageGroup(KProcessAddress address, const KPageGroup &pg, KMemoryState state) {
return m_page_table.UnmapPageGroup(address, pg, state); R_RETURN(m_page_table.UnmapPageGroup(address, pg, state));
} }
bool GetPhysicalAddress(KPhysicalAddress *out, KProcessAddress address) const { bool GetPhysicalAddress(KPhysicalAddress *out, KProcessAddress address) const {

View File

@ -29,29 +29,29 @@ namespace ams::kern::board::generic {
Result ALWAYS_INLINE Initialize(u64 space_address, u64 space_size) { Result ALWAYS_INLINE Initialize(u64 space_address, u64 space_size) {
MESOSPHERE_UNUSED(space_address, space_size); MESOSPHERE_UNUSED(space_address, space_size);
return ams::kern::svc::ResultNotImplemented(); R_THROW(ams::kern::svc::ResultNotImplemented());
} }
void ALWAYS_INLINE Finalize() { /* ... */ } void ALWAYS_INLINE Finalize() { /* ... */ }
Result ALWAYS_INLINE Attach(ams::svc::DeviceName device_name, u64 space_address, u64 space_size) { Result ALWAYS_INLINE Attach(ams::svc::DeviceName device_name, u64 space_address, u64 space_size) {
MESOSPHERE_UNUSED(device_name, space_address, space_size); MESOSPHERE_UNUSED(device_name, space_address, space_size);
return ams::kern::svc::ResultNotImplemented(); R_THROW(ams::kern::svc::ResultNotImplemented());
} }
Result ALWAYS_INLINE Detach(ams::svc::DeviceName device_name) { Result ALWAYS_INLINE Detach(ams::svc::DeviceName device_name) {
MESOSPHERE_UNUSED(device_name); MESOSPHERE_UNUSED(device_name);
return ams::kern::svc::ResultNotImplemented(); R_THROW(ams::kern::svc::ResultNotImplemented());
} }
Result ALWAYS_INLINE Map(KProcessPageTable *page_table, KProcessAddress process_address, size_t size, KDeviceVirtualAddress device_address, ams::svc::MemoryPermission device_perm, bool is_aligned) { Result ALWAYS_INLINE Map(KProcessPageTable *page_table, KProcessAddress process_address, size_t size, KDeviceVirtualAddress device_address, ams::svc::MemoryPermission device_perm, bool is_aligned) {
MESOSPHERE_UNUSED(page_table, process_address, size, device_address, device_perm, is_aligned); MESOSPHERE_UNUSED(page_table, process_address, size, device_address, device_perm, is_aligned);
return ams::kern::svc::ResultNotImplemented(); R_THROW(ams::kern::svc::ResultNotImplemented());
} }
Result ALWAYS_INLINE Unmap(KProcessPageTable *page_table, KProcessAddress process_address, size_t size, KDeviceVirtualAddress device_address) { Result ALWAYS_INLINE Unmap(KProcessPageTable *page_table, KProcessAddress process_address, size_t size, KDeviceVirtualAddress device_address) {
MESOSPHERE_UNUSED(page_table, process_address, size, device_address); MESOSPHERE_UNUSED(page_table, process_address, size, device_address);
return ams::kern::svc::ResultNotImplemented(); R_THROW(ams::kern::svc::ResultNotImplemented());
} }
void ALWAYS_INLINE Unmap(KDeviceVirtualAddress device_address, size_t size) { void ALWAYS_INLINE Unmap(KDeviceVirtualAddress device_address, size_t size) {

View File

@ -30,11 +30,11 @@ namespace ams::kern {
Result SignalToAddress(uintptr_t addr, ams::svc::SignalType type, s32 value, s32 count) { Result SignalToAddress(uintptr_t addr, ams::svc::SignalType type, s32 value, s32 count) {
switch (type) { switch (type) {
case ams::svc::SignalType_Signal: case ams::svc::SignalType_Signal:
return this->Signal(addr, count); R_RETURN(this->Signal(addr, count));
case ams::svc::SignalType_SignalAndIncrementIfEqual: case ams::svc::SignalType_SignalAndIncrementIfEqual:
return this->SignalAndIncrementIfEqual(addr, value, count); R_RETURN(this->SignalAndIncrementIfEqual(addr, value, count));
case ams::svc::SignalType_SignalAndModifyByWaitingCountIfEqual: case ams::svc::SignalType_SignalAndModifyByWaitingCountIfEqual:
return this->SignalAndModifyByWaitingCountIfEqual(addr, value, count); R_RETURN(this->SignalAndModifyByWaitingCountIfEqual(addr, value, count));
MESOSPHERE_UNREACHABLE_DEFAULT_CASE(); MESOSPHERE_UNREACHABLE_DEFAULT_CASE();
} }
} }
@ -42,11 +42,11 @@ namespace ams::kern {
Result WaitForAddress(uintptr_t addr, ams::svc::ArbitrationType type, s32 value, s64 timeout) { Result WaitForAddress(uintptr_t addr, ams::svc::ArbitrationType type, s32 value, s64 timeout) {
switch (type) { switch (type) {
case ams::svc::ArbitrationType_WaitIfLessThan: case ams::svc::ArbitrationType_WaitIfLessThan:
return this->WaitIfLessThan(addr, value, false, timeout); R_RETURN(this->WaitIfLessThan(addr, value, false, timeout));
case ams::svc::ArbitrationType_DecrementAndWaitIfLessThan: case ams::svc::ArbitrationType_DecrementAndWaitIfLessThan:
return this->WaitIfLessThan(addr, value, true, timeout); R_RETURN(this->WaitIfLessThan(addr, value, true, timeout));
case ams::svc::ArbitrationType_WaitIfEqual: case ams::svc::ArbitrationType_WaitIfEqual:
return this->WaitIfEqual(addr, value, timeout); R_RETURN(this->WaitIfEqual(addr, value, timeout));
MESOSPHERE_UNREACHABLE_DEFAULT_CASE(); MESOSPHERE_UNREACHABLE_DEFAULT_CASE();
} }
} }

View File

@ -42,11 +42,11 @@ namespace ams::kern {
Result Detach(ams::svc::DeviceName device_name); Result Detach(ams::svc::DeviceName device_name);
Result MapByForce(KProcessPageTable *page_table, KProcessAddress process_address, size_t size, u64 device_address, ams::svc::MemoryPermission device_perm) { Result MapByForce(KProcessPageTable *page_table, KProcessAddress process_address, size_t size, u64 device_address, ams::svc::MemoryPermission device_perm) {
return this->Map(page_table, process_address, size, device_address, device_perm, false); R_RETURN(this->Map(page_table, process_address, size, device_address, device_perm, false));
} }
Result MapAligned(KProcessPageTable *page_table, KProcessAddress process_address, size_t size, u64 device_address, ams::svc::MemoryPermission device_perm) { Result MapAligned(KProcessPageTable *page_table, KProcessAddress process_address, size_t size, u64 device_address, ams::svc::MemoryPermission device_perm) {
return this->Map(page_table, process_address, size, device_address, device_perm, true); R_RETURN(this->Map(page_table, process_address, size, device_address, device_perm, true));
} }
Result Unmap(KProcessPageTable *page_table, KProcessAddress process_address, size_t size, u64 device_address); Result Unmap(KProcessPageTable *page_table, KProcessAddress process_address, size_t size, u64 device_address);

View File

@ -72,7 +72,7 @@ namespace ams::kern {
m_page_bitmap.SetBit(i); m_page_bitmap.SetBit(i);
} }
return ResultSuccess(); R_SUCCEED();
} }
constexpr KVirtualAddress GetAddress() const { return m_address; } constexpr KVirtualAddress GetAddress() const { return m_address; }

View File

@ -93,7 +93,7 @@ namespace ams::kern {
m_free_head_index = i; m_free_head_index = i;
} }
return ResultSuccess(); R_SUCCEED();
} }
constexpr ALWAYS_INLINE size_t GetTableSize() const { return m_table_size; } constexpr ALWAYS_INLINE size_t GetTableSize() const { return m_table_size; }

View File

@ -46,7 +46,7 @@ namespace ams::kern {
/* Try to perform a reset, succeeding unconditionally. */ /* Try to perform a reset, succeeding unconditionally. */
this->Reset(); this->Reset();
return ResultSuccess(); R_SUCCEED();
} }
bool IsInitialized() const { return m_is_initialized; } bool IsInitialized() const { return m_is_initialized; }

View File

@ -62,7 +62,7 @@ namespace ams::kern {
bool IsServerClosed() const { return m_state != State::Normal; } bool IsServerClosed() const { return m_state != State::Normal; }
bool IsClientClosed() const { return m_state != State::Normal; } bool IsClientClosed() const { return m_state != State::Normal; }
Result OnRequest(KThread *request_thread) { return m_server.OnRequest(request_thread); } Result OnRequest(KThread *request_thread) { R_RETURN(m_server.OnRequest(request_thread)); }
KLightClientSession &GetClientSession() { return m_client; } KLightClientSession &GetClientSession() { return m_client; }
KLightServerSession &GetServerSession() { return m_server; } KLightServerSession &GetServerSession() { return m_server; }

View File

@ -41,7 +41,7 @@ namespace ams::kern {
R_UNLESS(m_blocks[m_index + i] != nullptr, svc::ResultOutOfResource()); R_UNLESS(m_blocks[m_index + i] != nullptr, svc::ResultOutOfResource());
} }
return ResultSuccess(); R_SUCCEED();
} }
public: public:
KMemoryBlockManagerUpdateAllocator(Result *out_result, KMemoryBlockSlabManager *sm, size_t num_blocks = MaxBlocks) : m_blocks(), m_index(MaxBlocks), m_slab_manager(sm) { KMemoryBlockManagerUpdateAllocator(Result *out_result, KMemoryBlockSlabManager *sm, size_t num_blocks = MaxBlocks) : m_blocks(), m_index(MaxBlocks), m_slab_manager(sm) {

View File

@ -284,16 +284,16 @@ namespace ams::kern {
Result CheckMemoryStateContiguous(size_t *out_blocks_needed, KProcessAddress addr, size_t size, u32 state_mask, u32 state, u32 perm_mask, u32 perm, u32 attr_mask, u32 attr) const; Result CheckMemoryStateContiguous(size_t *out_blocks_needed, KProcessAddress addr, size_t size, u32 state_mask, u32 state, u32 perm_mask, u32 perm, u32 attr_mask, u32 attr) const;
Result CheckMemoryStateContiguous(KProcessAddress addr, size_t size, u32 state_mask, u32 state, u32 perm_mask, u32 perm, u32 attr_mask, u32 attr) const { Result CheckMemoryStateContiguous(KProcessAddress addr, size_t size, u32 state_mask, u32 state, u32 perm_mask, u32 perm, u32 attr_mask, u32 attr) const {
return this->CheckMemoryStateContiguous(nullptr, addr, size, state_mask, state, perm_mask, perm, attr_mask, attr); R_RETURN(this->CheckMemoryStateContiguous(nullptr, addr, size, state_mask, state, perm_mask, perm, attr_mask, attr));
} }
Result CheckMemoryState(const KMemoryInfo &info, u32 state_mask, u32 state, u32 perm_mask, u32 perm, u32 attr_mask, u32 attr) const; Result CheckMemoryState(const KMemoryInfo &info, u32 state_mask, u32 state, u32 perm_mask, u32 perm, u32 attr_mask, u32 attr) const;
Result CheckMemoryState(KMemoryState *out_state, KMemoryPermission *out_perm, KMemoryAttribute *out_attr, size_t *out_blocks_needed, KProcessAddress addr, size_t size, u32 state_mask, u32 state, u32 perm_mask, u32 perm, u32 attr_mask, u32 attr, u32 ignore_attr = DefaultMemoryIgnoreAttr) const; Result CheckMemoryState(KMemoryState *out_state, KMemoryPermission *out_perm, KMemoryAttribute *out_attr, size_t *out_blocks_needed, KProcessAddress addr, size_t size, u32 state_mask, u32 state, u32 perm_mask, u32 perm, u32 attr_mask, u32 attr, u32 ignore_attr = DefaultMemoryIgnoreAttr) const;
Result CheckMemoryState(size_t *out_blocks_needed, KProcessAddress addr, size_t size, u32 state_mask, u32 state, u32 perm_mask, u32 perm, u32 attr_mask, u32 attr, u32 ignore_attr = DefaultMemoryIgnoreAttr) const { Result CheckMemoryState(size_t *out_blocks_needed, KProcessAddress addr, size_t size, u32 state_mask, u32 state, u32 perm_mask, u32 perm, u32 attr_mask, u32 attr, u32 ignore_attr = DefaultMemoryIgnoreAttr) const {
return this->CheckMemoryState(nullptr, nullptr, nullptr, out_blocks_needed, addr, size, state_mask, state, perm_mask, perm, attr_mask, attr, ignore_attr); R_RETURN(this->CheckMemoryState(nullptr, nullptr, nullptr, out_blocks_needed, addr, size, state_mask, state, perm_mask, perm, attr_mask, attr, ignore_attr));
} }
Result CheckMemoryState(KProcessAddress addr, size_t size, u32 state_mask, u32 state, u32 perm_mask, u32 perm, u32 attr_mask, u32 attr, u32 ignore_attr = DefaultMemoryIgnoreAttr) const { Result CheckMemoryState(KProcessAddress addr, size_t size, u32 state_mask, u32 state, u32 perm_mask, u32 perm, u32 attr_mask, u32 attr, u32 ignore_attr = DefaultMemoryIgnoreAttr) const {
return this->CheckMemoryState(nullptr, addr, size, state_mask, state, perm_mask, perm, attr_mask, attr, ignore_attr); R_RETURN(this->CheckMemoryState(nullptr, addr, size, state_mask, state, perm_mask, perm, attr_mask, attr, ignore_attr));
} }
Result LockMemoryAndOpen(KPageGroup *out_pg, KPhysicalAddress *out_paddr, KProcessAddress addr, size_t size, u32 state_mask, u32 state, u32 perm_mask, u32 perm, u32 attr_mask, u32 attr, KMemoryPermission new_perm, u32 lock_attr); Result LockMemoryAndOpen(KPageGroup *out_pg, KPhysicalAddress *out_paddr, KProcessAddress addr, size_t size, u32 state_mask, u32 state, u32 perm_mask, u32 perm, u32 attr_mask, u32 attr, KMemoryPermission new_perm, u32 lock_attr);
@ -351,8 +351,8 @@ namespace ams::kern {
Result SetMaxHeapSize(size_t size); Result SetMaxHeapSize(size_t size);
Result QueryInfo(KMemoryInfo *out_info, ams::svc::PageInfo *out_page_info, KProcessAddress addr) const; Result QueryInfo(KMemoryInfo *out_info, ams::svc::PageInfo *out_page_info, KProcessAddress addr) const;
Result QueryPhysicalAddress(ams::svc::PhysicalMemoryInfo *out, KProcessAddress address) const; Result QueryPhysicalAddress(ams::svc::PhysicalMemoryInfo *out, KProcessAddress address) const;
Result QueryStaticMapping(KProcessAddress *out, KPhysicalAddress address, size_t size) const { return this->QueryMappingImpl(out, address, size, KMemoryState_Static); } Result QueryStaticMapping(KProcessAddress *out, KPhysicalAddress address, size_t size) const { R_RETURN(this->QueryMappingImpl(out, address, size, KMemoryState_Static)); }
Result QueryIoMapping(KProcessAddress *out, KPhysicalAddress address, size_t size) const { return this->QueryMappingImpl(out, address, size, KMemoryState_Io); } Result QueryIoMapping(KProcessAddress *out, KPhysicalAddress address, size_t size) const { R_RETURN(this->QueryMappingImpl(out, address, size, KMemoryState_Io)); }
Result MapMemory(KProcessAddress dst_address, KProcessAddress src_address, size_t size); Result MapMemory(KProcessAddress dst_address, KProcessAddress src_address, size_t size);
Result UnmapMemory(KProcessAddress dst_address, KProcessAddress src_address, size_t size); Result UnmapMemory(KProcessAddress dst_address, KProcessAddress src_address, size_t size);
Result MapCodeMemory(KProcessAddress dst_address, KProcessAddress src_address, size_t size); Result MapCodeMemory(KProcessAddress dst_address, KProcessAddress src_address, size_t size);
@ -364,15 +364,15 @@ namespace ams::kern {
Result MapRegion(KMemoryRegionType region_type, KMemoryPermission perm); Result MapRegion(KMemoryRegionType region_type, KMemoryPermission perm);
Result MapPages(KProcessAddress *out_addr, size_t num_pages, size_t alignment, KPhysicalAddress phys_addr, KProcessAddress region_start, size_t region_num_pages, KMemoryState state, KMemoryPermission perm) { Result MapPages(KProcessAddress *out_addr, size_t num_pages, size_t alignment, KPhysicalAddress phys_addr, KProcessAddress region_start, size_t region_num_pages, KMemoryState state, KMemoryPermission perm) {
return this->MapPages(out_addr, num_pages, alignment, phys_addr, true, region_start, region_num_pages, state, perm); R_RETURN(this->MapPages(out_addr, num_pages, alignment, phys_addr, true, region_start, region_num_pages, state, perm));
} }
Result MapPages(KProcessAddress *out_addr, size_t num_pages, size_t alignment, KPhysicalAddress phys_addr, KMemoryState state, KMemoryPermission perm) { Result MapPages(KProcessAddress *out_addr, size_t num_pages, size_t alignment, KPhysicalAddress phys_addr, KMemoryState state, KMemoryPermission perm) {
return this->MapPages(out_addr, num_pages, alignment, phys_addr, true, this->GetRegionAddress(state), this->GetRegionSize(state) / PageSize, state, perm); R_RETURN(this->MapPages(out_addr, num_pages, alignment, phys_addr, true, this->GetRegionAddress(state), this->GetRegionSize(state) / PageSize, state, perm));
} }
Result MapPages(KProcessAddress *out_addr, size_t num_pages, KMemoryState state, KMemoryPermission perm) { Result MapPages(KProcessAddress *out_addr, size_t num_pages, KMemoryState state, KMemoryPermission perm) {
return this->MapPages(out_addr, num_pages, PageSize, Null<KPhysicalAddress>, false, this->GetRegionAddress(state), this->GetRegionSize(state) / PageSize, state, perm); R_RETURN(this->MapPages(out_addr, num_pages, PageSize, Null<KPhysicalAddress>, false, this->GetRegionAddress(state), this->GetRegionSize(state) / PageSize, state, perm));
} }
Result MapPages(KProcessAddress address, size_t num_pages, KMemoryState state, KMemoryPermission perm); Result MapPages(KProcessAddress address, size_t num_pages, KMemoryState state, KMemoryPermission perm);

View File

@ -356,15 +356,15 @@ namespace ams::kern {
} }
Result WaitConditionVariable(KProcessAddress address, uintptr_t cv_key, u32 tag, s64 ns) { Result WaitConditionVariable(KProcessAddress address, uintptr_t cv_key, u32 tag, s64 ns) {
return m_cond_var.Wait(address, cv_key, tag, ns); R_RETURN(m_cond_var.Wait(address, cv_key, tag, ns));
} }
Result SignalAddressArbiter(uintptr_t address, ams::svc::SignalType signal_type, s32 value, s32 count) { Result SignalAddressArbiter(uintptr_t address, ams::svc::SignalType signal_type, s32 value, s32 count) {
return m_address_arbiter.SignalToAddress(address, signal_type, value, count); R_RETURN(m_address_arbiter.SignalToAddress(address, signal_type, value, count));
} }
Result WaitAddressArbiter(uintptr_t address, ams::svc::ArbitrationType arb_type, s32 value, s64 timeout) { Result WaitAddressArbiter(uintptr_t address, ams::svc::ArbitrationType arb_type, s32 value, s64 timeout) {
return m_address_arbiter.WaitForAddress(address, arb_type, value, timeout); R_RETURN(m_address_arbiter.WaitForAddress(address, arb_type, value, timeout));
} }
Result GetThreadList(s32 *out_num_threads, ams::kern::svc::KUserPointer<u64 *> out_thread_ids, s32 max_out_count); Result GetThreadList(s32 *out_num_threads, ams::kern::svc::KUserPointer<u64 *> out_thread_ids, s32 max_out_count);
@ -415,7 +415,7 @@ namespace ams::kern {
/* We succeeded, so note that we did. */ /* We succeeded, so note that we did. */
m_is_handle_table_initialized = true; m_is_handle_table_initialized = true;
return ResultSuccess(); R_SUCCEED();
} }
ALWAYS_INLINE void FinalizeHandleTable() { ALWAYS_INLINE void FinalizeHandleTable() {

View File

@ -44,7 +44,7 @@ namespace ams::kern {
/* Try to perform a reset, succeeding unconditionally. */ /* Try to perform a reset, succeeding unconditionally. */
this->Reset(); this->Reset();
return ResultSuccess(); R_SUCCEED();
} }
virtual bool IsSignaled() const override; virtual bool IsSignaled() const override;

View File

@ -75,7 +75,7 @@ namespace ams::kern {
bool IsServerClosed() const { return this->GetState() != State::Normal; } bool IsServerClosed() const { return this->GetState() != State::Normal; }
bool IsClientClosed() const { return this->GetState() != State::Normal; } bool IsClientClosed() const { return this->GetState() != State::Normal; }
Result OnRequest(KSessionRequest *request) { return m_server.OnRequest(request); } Result OnRequest(KSessionRequest *request) { R_RETURN(m_server.OnRequest(request)); }
KClientSession &GetClientSession() { return m_client; } KClientSession &GetClientSession() { return m_client; }
KServerSession &GetServerSession() { return m_server; } KServerSession &GetServerSession() { return m_server; }

View File

@ -190,15 +190,15 @@ namespace ams::kern {
constexpr ALWAYS_INLINE size_t GetExchangeCount() const { return m_mappings.GetExchangeCount(); } constexpr ALWAYS_INLINE size_t GetExchangeCount() const { return m_mappings.GetExchangeCount(); }
ALWAYS_INLINE Result PushSend(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) { ALWAYS_INLINE Result PushSend(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) {
return m_mappings.PushSend(client, server, size, state); R_RETURN(m_mappings.PushSend(client, server, size, state));
} }
ALWAYS_INLINE Result PushReceive(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) { ALWAYS_INLINE Result PushReceive(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) {
return m_mappings.PushReceive(client, server, size, state); R_RETURN(m_mappings.PushReceive(client, server, size, state));
} }
ALWAYS_INLINE Result PushExchange(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) { ALWAYS_INLINE Result PushExchange(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) {
return m_mappings.PushExchange(client, server, size, state); R_RETURN(m_mappings.PushExchange(client, server, size, state));
} }
constexpr ALWAYS_INLINE KProcessAddress GetSendClientAddress(size_t i) const { return m_mappings.GetSendClientAddress(i); } constexpr ALWAYS_INLINE KProcessAddress GetSendClientAddress(size_t i) const { return m_mappings.GetSendClientAddress(i); }

View File

@ -256,15 +256,15 @@ namespace ams::kern {
static Result InitializeThread(KThread *thread, KThreadFunction func, uintptr_t arg, KProcessAddress user_stack_top, s32 prio, s32 virt_core, KProcess *owner, ThreadType type); static Result InitializeThread(KThread *thread, KThreadFunction func, uintptr_t arg, KProcessAddress user_stack_top, s32 prio, s32 virt_core, KProcess *owner, ThreadType type);
public: public:
static Result InitializeKernelThread(KThread *thread, KThreadFunction func, uintptr_t arg, s32 prio, s32 virt_core) { static Result InitializeKernelThread(KThread *thread, KThreadFunction func, uintptr_t arg, s32 prio, s32 virt_core) {
return InitializeThread(thread, func, arg, Null<KProcessAddress>, prio, virt_core, nullptr, ThreadType_Kernel); R_RETURN(InitializeThread(thread, func, arg, Null<KProcessAddress>, prio, virt_core, nullptr, ThreadType_Kernel));
} }
static Result InitializeHighPriorityThread(KThread *thread, KThreadFunction func, uintptr_t arg) { static Result InitializeHighPriorityThread(KThread *thread, KThreadFunction func, uintptr_t arg) {
return InitializeThread(thread, func, arg, Null<KProcessAddress>, 0, GetCurrentCoreId(), nullptr, ThreadType_HighPriority); R_RETURN(InitializeThread(thread, func, arg, Null<KProcessAddress>, 0, GetCurrentCoreId(), nullptr, ThreadType_HighPriority));
} }
static Result InitializeUserThread(KThread *thread, KThreadFunction func, uintptr_t arg, KProcessAddress user_stack_top, s32 prio, s32 virt_core, KProcess *owner) { static Result InitializeUserThread(KThread *thread, KThreadFunction func, uintptr_t arg, KProcessAddress user_stack_top, s32 prio, s32 virt_core, KProcess *owner) {
return InitializeThread(thread, func, arg, user_stack_top, prio, virt_core, owner, ThreadType_User); R_RETURN(InitializeThread(thread, func, arg, user_stack_top, prio, virt_core, owner, ThreadType_User));
} }
static void ResumeThreadsSuspendedForInit(); static void ResumeThreadsSuspendedForInit();

View File

@ -72,7 +72,7 @@ namespace ams::kern {
R_UNLESS(size >= m_current_size, svc::ResultLimitReached()); R_UNLESS(size >= m_current_size, svc::ResultLimitReached());
m_limit_size = size; m_limit_size = size;
return ResultSuccess(); R_SUCCEED();
} }
}; };
} }

View File

@ -41,15 +41,15 @@ namespace ams::kern {
static_assert(std::derived_from<KPageTable, KPageTableBase>); static_assert(std::derived_from<KPageTable, KPageTableBase>);
ALWAYS_INLINE Result KPageTableBase::Operate(PageLinkedList *page_list, KProcessAddress virt_addr, size_t num_pages, KPhysicalAddress phys_addr, bool is_pa_valid, const KPageProperties properties, OperationType operation, bool reuse_ll) { ALWAYS_INLINE Result KPageTableBase::Operate(PageLinkedList *page_list, KProcessAddress virt_addr, size_t num_pages, KPhysicalAddress phys_addr, bool is_pa_valid, const KPageProperties properties, OperationType operation, bool reuse_ll) {
return static_cast<KPageTable *>(this)->OperateImpl(page_list, virt_addr, num_pages, phys_addr, is_pa_valid, properties, operation, reuse_ll); R_RETURN(static_cast<KPageTable *>(this)->OperateImpl(page_list, virt_addr, num_pages, phys_addr, is_pa_valid, properties, operation, reuse_ll));
} }
ALWAYS_INLINE Result KPageTableBase::Operate(PageLinkedList *page_list, KProcessAddress virt_addr, size_t num_pages, const KPageGroup &page_group, const KPageProperties properties, OperationType operation, bool reuse_ll) { ALWAYS_INLINE Result KPageTableBase::Operate(PageLinkedList *page_list, KProcessAddress virt_addr, size_t num_pages, const KPageGroup &page_group, const KPageProperties properties, OperationType operation, bool reuse_ll) {
return static_cast<KPageTable *>(this)->OperateImpl(page_list, virt_addr, num_pages, page_group, properties, operation, reuse_ll); R_RETURN(static_cast<KPageTable *>(this)->OperateImpl(page_list, virt_addr, num_pages, page_group, properties, operation, reuse_ll));
} }
ALWAYS_INLINE void KPageTableBase::FinalizeUpdate(PageLinkedList *page_list) { ALWAYS_INLINE void KPageTableBase::FinalizeUpdate(PageLinkedList *page_list) {
return static_cast<KPageTable *>(this)->FinalizeUpdateImpl(page_list); static_cast<KPageTable *>(this)->FinalizeUpdateImpl(page_list);
} }
} }

View File

@ -56,12 +56,12 @@ namespace ams::kern::svc {
public: public:
static ALWAYS_INLINE Result CopyFromUserspace(void *dst, const void *src, size_t size) { static ALWAYS_INLINE Result CopyFromUserspace(void *dst, const void *src, size_t size) {
R_UNLESS(UserspaceAccess::CopyMemoryFromUser(dst, src, size), svc::ResultInvalidPointer()); R_UNLESS(UserspaceAccess::CopyMemoryFromUser(dst, src, size), svc::ResultInvalidPointer());
return ResultSuccess(); R_SUCCEED();
} }
static ALWAYS_INLINE Result CopyToUserspace(void *dst, const void *src, size_t size) { static ALWAYS_INLINE Result CopyToUserspace(void *dst, const void *src, size_t size) {
R_UNLESS(UserspaceAccess::CopyMemoryToUser(dst, src, size), svc::ResultInvalidPointer()); R_UNLESS(UserspaceAccess::CopyMemoryToUser(dst, src, size), svc::ResultInvalidPointer());
return ResultSuccess(); R_SUCCEED();
} }
}; };
@ -72,12 +72,12 @@ namespace ams::kern::svc {
public: public:
static ALWAYS_INLINE Result CopyFromUserspace(void *dst, const void *src, size_t size) { static ALWAYS_INLINE Result CopyFromUserspace(void *dst, const void *src, size_t size) {
R_UNLESS(UserspaceAccess::CopyMemoryFromUserAligned32Bit(dst, src, size), svc::ResultInvalidPointer()); R_UNLESS(UserspaceAccess::CopyMemoryFromUserAligned32Bit(dst, src, size), svc::ResultInvalidPointer());
return ResultSuccess(); R_SUCCEED();
} }
static ALWAYS_INLINE Result CopyToUserspace(void *dst, const void *src, size_t size) { static ALWAYS_INLINE Result CopyToUserspace(void *dst, const void *src, size_t size) {
R_UNLESS(UserspaceAccess::CopyMemoryToUserAligned32Bit(dst, src, size), svc::ResultInvalidPointer()); R_UNLESS(UserspaceAccess::CopyMemoryToUserAligned32Bit(dst, src, size), svc::ResultInvalidPointer());
return ResultSuccess(); R_SUCCEED();
} }
}; };
@ -88,12 +88,12 @@ namespace ams::kern::svc {
public: public:
static ALWAYS_INLINE Result CopyFromUserspace(void *dst, const void *src, size_t size) { static ALWAYS_INLINE Result CopyFromUserspace(void *dst, const void *src, size_t size) {
R_UNLESS(UserspaceAccess::CopyMemoryFromUserAligned64Bit(dst, src, size), svc::ResultInvalidPointer()); R_UNLESS(UserspaceAccess::CopyMemoryFromUserAligned64Bit(dst, src, size), svc::ResultInvalidPointer());
return ResultSuccess(); R_SUCCEED();
} }
static ALWAYS_INLINE Result CopyToUserspace(void *dst, const void *src, size_t size) { static ALWAYS_INLINE Result CopyToUserspace(void *dst, const void *src, size_t size) {
R_UNLESS(UserspaceAccess::CopyMemoryToUserAligned64Bit(dst, src, size), svc::ResultInvalidPointer()); R_UNLESS(UserspaceAccess::CopyMemoryToUserAligned64Bit(dst, src, size), svc::ResultInvalidPointer());
return ResultSuccess(); R_SUCCEED();
} }
}; };
@ -111,21 +111,21 @@ namespace ams::kern::svc {
CT *m_ptr; CT *m_ptr;
private: private:
ALWAYS_INLINE Result CopyToImpl(void *p, size_t size) const { ALWAYS_INLINE Result CopyToImpl(void *p, size_t size) const {
return Traits::CopyFromUserspace(p, m_ptr, size); R_RETURN(Traits::CopyFromUserspace(p, m_ptr, size));
} }
ALWAYS_INLINE Result CopyFromImpl(const void *p, size_t size) const { ALWAYS_INLINE Result CopyFromImpl(const void *p, size_t size) const {
return Traits::CopyToUserspace(m_ptr, p, size); R_RETURN(Traits::CopyToUserspace(m_ptr, p, size));
} }
protected: protected:
ALWAYS_INLINE Result CopyTo(T *p) const { return this->CopyToImpl(p, sizeof(*p)); } ALWAYS_INLINE Result CopyTo(T *p) const { R_RETURN(this->CopyToImpl(p, sizeof(*p))); }
ALWAYS_INLINE Result CopyFrom(const T *p) const { return this->CopyFromImpl(p, sizeof(*p)); } ALWAYS_INLINE Result CopyFrom(const T *p) const { R_RETURN(this->CopyFromImpl(p, sizeof(*p))); }
ALWAYS_INLINE Result CopyArrayElementTo(T *p, size_t index) const { return Traits::CopyFromUserspace(p, m_ptr + index, sizeof(*p)); } ALWAYS_INLINE Result CopyArrayElementTo(T *p, size_t index) const { R_RETURN(Traits::CopyFromUserspace(p, m_ptr + index, sizeof(*p))); }
ALWAYS_INLINE Result CopyArrayElementFrom(const T *p, size_t index) const { return Traits::CopyToUserspace(m_ptr + index, p, sizeof(*p)); } ALWAYS_INLINE Result CopyArrayElementFrom(const T *p, size_t index) const { R_RETURN(Traits::CopyToUserspace(m_ptr + index, p, sizeof(*p))); }
ALWAYS_INLINE Result CopyArrayTo(T *arr, size_t count) const { return this->CopyToImpl(arr, sizeof(*arr) * count); } ALWAYS_INLINE Result CopyArrayTo(T *arr, size_t count) const { R_RETURN(this->CopyToImpl(arr, sizeof(*arr) * count)); }
ALWAYS_INLINE Result CopyArrayFrom(const T *arr, size_t count) const { return this->CopyFromImpl(arr, sizeof(*arr) * count); } ALWAYS_INLINE Result CopyArrayFrom(const T *arr, size_t count) const { R_RETURN(this->CopyFromImpl(arr, sizeof(*arr) * count)); }
constexpr ALWAYS_INLINE bool IsNull() const { return m_ptr == nullptr; } constexpr ALWAYS_INLINE bool IsNull() const { return m_ptr == nullptr; }
@ -145,11 +145,11 @@ namespace ams::kern::svc {
ALWAYS_INLINE Result CopyStringTo(char *dst, size_t size) const { ALWAYS_INLINE Result CopyStringTo(char *dst, size_t size) const {
static_assert(sizeof(char) == 1); static_assert(sizeof(char) == 1);
R_UNLESS(UserspaceAccess::CopyStringFromUser(dst, m_ptr, size) > 0, svc::ResultInvalidPointer()); R_UNLESS(UserspaceAccess::CopyStringFromUser(dst, m_ptr, size) > 0, svc::ResultInvalidPointer());
return ResultSuccess(); R_SUCCEED();
} }
ALWAYS_INLINE Result CopyArrayElementTo(char *dst, size_t index) const { ALWAYS_INLINE Result CopyArrayElementTo(char *dst, size_t index) const {
return Traits::CopyFromUserspace(dst, m_ptr + index, sizeof(*dst)); R_RETURN(Traits::CopyFromUserspace(dst, m_ptr + index, sizeof(*dst)));
} }
constexpr ALWAYS_INLINE bool IsNull() const { return m_ptr == nullptr; } constexpr ALWAYS_INLINE bool IsNull() const { return m_ptr == nullptr; }

View File

@ -304,7 +304,7 @@ namespace ams::kern::arch::arm64::cpu {
MESOSPHERE_ASSERT(util::IsAligned(end, DataCacheLineSize)); MESOSPHERE_ASSERT(util::IsAligned(end, DataCacheLineSize));
R_UNLESS(UserspaceAccess::InvalidateDataCache(start, end), svc::ResultInvalidCurrentMemory()); R_UNLESS(UserspaceAccess::InvalidateDataCache(start, end), svc::ResultInvalidCurrentMemory());
DataSynchronizationBarrier(); DataSynchronizationBarrier();
return ResultSuccess(); R_SUCCEED();
} }
ALWAYS_INLINE Result StoreDataCacheRange(uintptr_t start, uintptr_t end) { ALWAYS_INLINE Result StoreDataCacheRange(uintptr_t start, uintptr_t end) {
@ -312,7 +312,7 @@ namespace ams::kern::arch::arm64::cpu {
MESOSPHERE_ASSERT(util::IsAligned(end, DataCacheLineSize)); MESOSPHERE_ASSERT(util::IsAligned(end, DataCacheLineSize));
R_UNLESS(UserspaceAccess::StoreDataCache(start, end), svc::ResultInvalidCurrentMemory()); R_UNLESS(UserspaceAccess::StoreDataCache(start, end), svc::ResultInvalidCurrentMemory());
DataSynchronizationBarrier(); DataSynchronizationBarrier();
return ResultSuccess(); R_SUCCEED();
} }
ALWAYS_INLINE Result FlushDataCacheRange(uintptr_t start, uintptr_t end) { ALWAYS_INLINE Result FlushDataCacheRange(uintptr_t start, uintptr_t end) {
@ -320,7 +320,7 @@ namespace ams::kern::arch::arm64::cpu {
MESOSPHERE_ASSERT(util::IsAligned(end, DataCacheLineSize)); MESOSPHERE_ASSERT(util::IsAligned(end, DataCacheLineSize));
R_UNLESS(UserspaceAccess::FlushDataCache(start, end), svc::ResultInvalidCurrentMemory()); R_UNLESS(UserspaceAccess::FlushDataCache(start, end), svc::ResultInvalidCurrentMemory());
DataSynchronizationBarrier(); DataSynchronizationBarrier();
return ResultSuccess(); R_SUCCEED();
} }
ALWAYS_INLINE Result InvalidateInstructionCacheRange(uintptr_t start, uintptr_t end) { ALWAYS_INLINE Result InvalidateInstructionCacheRange(uintptr_t start, uintptr_t end) {
@ -328,7 +328,7 @@ namespace ams::kern::arch::arm64::cpu {
MESOSPHERE_ASSERT(util::IsAligned(end, InstructionCacheLineSize)); MESOSPHERE_ASSERT(util::IsAligned(end, InstructionCacheLineSize));
R_UNLESS(UserspaceAccess::InvalidateInstructionCache(start, end), svc::ResultInvalidCurrentMemory()); R_UNLESS(UserspaceAccess::InvalidateInstructionCache(start, end), svc::ResultInvalidCurrentMemory());
EnsureInstructionConsistency(); EnsureInstructionConsistency();
return ResultSuccess(); R_SUCCEED();
} }
ALWAYS_INLINE void InvalidateEntireInstructionCacheLocalImpl() { ALWAYS_INLINE void InvalidateEntireInstructionCacheLocalImpl() {
@ -440,7 +440,7 @@ namespace ams::kern::arch::arm64::cpu {
R_TRY(InvalidateDataCacheRange(aligned_start, aligned_end)); R_TRY(InvalidateDataCacheRange(aligned_start, aligned_end));
} }
return ResultSuccess(); R_SUCCEED();
} }
Result StoreDataCache(const void *addr, size_t size) { Result StoreDataCache(const void *addr, size_t size) {
@ -448,7 +448,7 @@ namespace ams::kern::arch::arm64::cpu {
const uintptr_t start = util::AlignDown(reinterpret_cast<uintptr_t>(addr), DataCacheLineSize); const uintptr_t start = util::AlignDown(reinterpret_cast<uintptr_t>(addr), DataCacheLineSize);
const uintptr_t end = util::AlignUp( reinterpret_cast<uintptr_t>(addr) + size, DataCacheLineSize); const uintptr_t end = util::AlignUp( reinterpret_cast<uintptr_t>(addr) + size, DataCacheLineSize);
return StoreDataCacheRange(start, end); R_RETURN(StoreDataCacheRange(start, end));
} }
Result FlushDataCache(const void *addr, size_t size) { Result FlushDataCache(const void *addr, size_t size) {
@ -456,7 +456,7 @@ namespace ams::kern::arch::arm64::cpu {
const uintptr_t start = util::AlignDown(reinterpret_cast<uintptr_t>(addr), DataCacheLineSize); const uintptr_t start = util::AlignDown(reinterpret_cast<uintptr_t>(addr), DataCacheLineSize);
const uintptr_t end = util::AlignUp( reinterpret_cast<uintptr_t>(addr) + size, DataCacheLineSize); const uintptr_t end = util::AlignUp( reinterpret_cast<uintptr_t>(addr) + size, DataCacheLineSize);
return FlushDataCacheRange(start, end); R_RETURN(FlushDataCacheRange(start, end));
} }
Result InvalidateInstructionCache(void *addr, size_t size) { Result InvalidateInstructionCache(void *addr, size_t size) {
@ -469,7 +469,7 @@ namespace ams::kern::arch::arm64::cpu {
/* Request the interrupt helper to perform an instruction memory barrier. */ /* Request the interrupt helper to perform an instruction memory barrier. */
g_cache_operation_handler.RequestOperation(KCacheHelperInterruptHandler::Operation::InstructionMemoryBarrier); g_cache_operation_handler.RequestOperation(KCacheHelperInterruptHandler::Operation::InstructionMemoryBarrier);
return ResultSuccess(); R_SUCCEED();
} }
void InvalidateEntireInstructionCache() { void InvalidateEntireInstructionCache() {

View File

@ -131,7 +131,7 @@ namespace ams::kern::arch::arm64 {
} }
/* Get the FPU context. */ /* Get the FPU context. */
return this->GetFpuContext(out, thread, context_flags); R_RETURN(this->GetFpuContext(out, thread, context_flags));
} }
Result KDebug::SetThreadContextImpl(const ams::svc::ThreadContext &ctx, KThread *thread, u32 context_flags) { Result KDebug::SetThreadContextImpl(const ams::svc::ThreadContext &ctx, KThread *thread, u32 context_flags) {
@ -180,7 +180,7 @@ namespace ams::kern::arch::arm64 {
} }
/* Set the FPU context. */ /* Set the FPU context. */
return this->SetFpuContext(ctx, thread, context_flags); R_RETURN(this->SetFpuContext(ctx, thread, context_flags));
} }
Result KDebug::GetFpuContext(ams::svc::ThreadContext *out, KThread *thread, u32 context_flags) { Result KDebug::GetFpuContext(ams::svc::ThreadContext *out, KThread *thread, u32 context_flags) {
@ -218,7 +218,7 @@ namespace ams::kern::arch::arm64 {
} }
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KDebug::SetFpuContext(const ams::svc::ThreadContext &ctx, KThread *thread, u32 context_flags) { Result KDebug::SetFpuContext(const ams::svc::ThreadContext &ctx, KThread *thread, u32 context_flags) {
@ -243,11 +243,11 @@ namespace ams::kern::arch::arm64 {
t_ctx->SetFpuRegisters(ctx.v, this->Is64Bit()); t_ctx->SetFpuRegisters(ctx.v, this->Is64Bit());
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KDebug::BreakIfAttached(ams::svc::BreakReason break_reason, uintptr_t address, size_t size) { Result KDebug::BreakIfAttached(ams::svc::BreakReason break_reason, uintptr_t address, size_t size) {
return KDebugBase::OnDebugEvent(ams::svc::DebugEvent_Exception, ams::svc::DebugException_UserBreak, GetProgramCounter(GetCurrentThread()), break_reason, address, size); R_RETURN(KDebugBase::OnDebugEvent(ams::svc::DebugEvent_Exception, ams::svc::DebugException_UserBreak, GetProgramCounter(GetCurrentThread()), break_reason, address, size));
} }
#define MESOSPHERE_SET_HW_BREAK_POINT(ID, FLAGS, VALUE) \ #define MESOSPHERE_SET_HW_BREAK_POINT(ID, FLAGS, VALUE) \
@ -384,10 +384,10 @@ namespace ams::kern::arch::arm64 {
} }
} else { } else {
/* Invalid name. */ /* Invalid name. */
return svc::ResultInvalidEnumValue(); R_THROW(svc::ResultInvalidEnumValue());
} }
return ResultSuccess(); R_SUCCEED();
} }
#undef MESOSPHERE_SET_HW_WATCH_POINT #undef MESOSPHERE_SET_HW_WATCH_POINT

View File

@ -215,12 +215,12 @@ namespace ams::kern::arch::arm64 {
if (KInterruptController::IsGlobal(irq)) { if (KInterruptController::IsGlobal(irq)) {
KScopedInterruptDisable di; KScopedInterruptDisable di;
KScopedSpinLock lk(this->GetGlobalInterruptLock()); KScopedSpinLock lk(this->GetGlobalInterruptLock());
return this->BindGlobal(handler, irq, core_id, priority, manual_clear, level); R_RETURN(this->BindGlobal(handler, irq, core_id, priority, manual_clear, level));
} else { } else {
MESOSPHERE_ASSERT(core_id == GetCurrentCoreId()); MESOSPHERE_ASSERT(core_id == GetCurrentCoreId());
KScopedInterruptDisable di; KScopedInterruptDisable di;
return this->BindLocal(handler, irq, priority, manual_clear); R_RETURN(this->BindLocal(handler, irq, priority, manual_clear));
} }
} }
@ -234,12 +234,12 @@ namespace ams::kern::arch::arm64 {
KScopedInterruptDisable di; KScopedInterruptDisable di;
KScopedSpinLock lk(this->GetGlobalInterruptLock()); KScopedSpinLock lk(this->GetGlobalInterruptLock());
return this->UnbindGlobal(irq); R_RETURN(this->UnbindGlobal(irq));
} else { } else {
MESOSPHERE_ASSERT(core_id == GetCurrentCoreId()); MESOSPHERE_ASSERT(core_id == GetCurrentCoreId());
KScopedInterruptDisable di; KScopedInterruptDisable di;
return this->UnbindLocal(irq); R_RETURN(this->UnbindLocal(irq));
} }
} }
@ -252,12 +252,12 @@ namespace ams::kern::arch::arm64 {
if (KInterruptController::IsGlobal(irq)) { if (KInterruptController::IsGlobal(irq)) {
KScopedInterruptDisable di; KScopedInterruptDisable di;
KScopedSpinLock lk(this->GetGlobalInterruptLock()); KScopedSpinLock lk(this->GetGlobalInterruptLock());
return this->ClearGlobal(irq); R_RETURN(this->ClearGlobal(irq));
} else { } else {
MESOSPHERE_ASSERT(core_id == GetCurrentCoreId()); MESOSPHERE_ASSERT(core_id == GetCurrentCoreId());
KScopedInterruptDisable di; KScopedInterruptDisable di;
return this->ClearLocal(irq); R_RETURN(this->ClearLocal(irq));
} }
} }
@ -288,7 +288,7 @@ namespace ams::kern::arch::arm64 {
m_interrupt_controller.SetPriorityLevel(irq, priority); m_interrupt_controller.SetPriorityLevel(irq, priority);
m_interrupt_controller.Enable(irq); m_interrupt_controller.Enable(irq);
return ResultSuccess(); R_SUCCEED();
} }
Result KInterruptManager::BindLocal(KInterruptHandler *handler, s32 irq, s32 priority, bool manual_clear) { Result KInterruptManager::BindLocal(KInterruptHandler *handler, s32 irq, s32 priority, bool manual_clear) {
@ -311,7 +311,7 @@ namespace ams::kern::arch::arm64 {
m_interrupt_controller.SetPriorityLevel(irq, priority); m_interrupt_controller.SetPriorityLevel(irq, priority);
m_interrupt_controller.Enable(irq); m_interrupt_controller.Enable(irq);
return ResultSuccess(); R_SUCCEED();
} }
Result KInterruptManager::UnbindGlobal(s32 irq) { Result KInterruptManager::UnbindGlobal(s32 irq) {
@ -323,7 +323,7 @@ namespace ams::kern::arch::arm64 {
GetGlobalInterruptEntry(irq).handler = nullptr; GetGlobalInterruptEntry(irq).handler = nullptr;
return ResultSuccess(); R_SUCCEED();
} }
Result KInterruptManager::UnbindLocal(s32 irq) { Result KInterruptManager::UnbindLocal(s32 irq) {
@ -335,7 +335,7 @@ namespace ams::kern::arch::arm64 {
entry.handler = nullptr; entry.handler = nullptr;
return ResultSuccess(); R_SUCCEED();
} }
Result KInterruptManager::ClearGlobal(s32 irq) { Result KInterruptManager::ClearGlobal(s32 irq) {
@ -350,7 +350,7 @@ namespace ams::kern::arch::arm64 {
/* Clear and enable. */ /* Clear and enable. */
entry.needs_clear = false; entry.needs_clear = false;
m_interrupt_controller.Enable(irq); m_interrupt_controller.Enable(irq);
return ResultSuccess(); R_SUCCEED();
} }
Result KInterruptManager::ClearLocal(s32 irq) { Result KInterruptManager::ClearLocal(s32 irq) {
@ -365,7 +365,7 @@ namespace ams::kern::arch::arm64 {
/* Clear and set priority. */ /* Clear and set priority. */
entry.needs_clear = false; entry.needs_clear = false;
m_interrupt_controller.SetPriorityLevel(irq, entry.priority); m_interrupt_controller.SetPriorityLevel(irq, entry.priority);
return ResultSuccess(); R_SUCCEED();
} }
} }

View File

@ -150,12 +150,12 @@ namespace ams::kern::arch::arm64 {
/* Lock the context, if we're a main thread. */ /* Lock the context, if we're a main thread. */
m_locked = is_main; m_locked = is_main;
return ResultSuccess(); R_SUCCEED();
} }
Result KThreadContext::Finalize() { Result KThreadContext::Finalize() {
/* This doesn't actually do anything. */ /* This doesn't actually do anything. */
return ResultSuccess(); R_SUCCEED();
} }
void KThreadContext::SetArguments(uintptr_t arg0, uintptr_t arg1) { void KThreadContext::SetArguments(uintptr_t arg0, uintptr_t arg1) {

View File

@ -334,7 +334,7 @@ namespace ams::kern::board::nintendo::nx {
for (size_t i = 0; i < num_reserved; i++) { for (size_t i = 0; i < num_reserved; i++) {
this->ReleaseImpl(out[i]); this->ReleaseImpl(out[i]);
} }
return svc::ResultOutOfResource(); R_THROW(svc::ResultOutOfResource());
} }
void Release(u8 asid) { void Release(u8 asid) {

View File

@ -392,7 +392,7 @@ namespace ams::kern::board::nintendo::nx::lps {
/* Instruct BPMP to enable suspend-to-sc7. */ /* Instruct BPMP to enable suspend-to-sc7. */
R_UNLESS(BpmpEnableSuspend(TEGRA_BPMP_PM_SC7, 0) == 0, svc::ResultInvalidState()); R_UNLESS(BpmpEnableSuspend(TEGRA_BPMP_PM_SC7, 0) == 0, svc::ResultInvalidState());
return ResultSuccess(); R_SUCCEED();
} }
void InvokeCpuSleepHandler(uintptr_t arg, uintptr_t entry) { void InvokeCpuSleepHandler(uintptr_t arg, uintptr_t entry) {

View File

@ -55,7 +55,7 @@ namespace ams::kern {
Result PutUserString(ams::kern::svc::KUserPointer<const char *> user_str, size_t len) { Result PutUserString(ams::kern::svc::KUserPointer<const char *> user_str, size_t len) {
/* Only print if the implementation is initialized. */ /* Only print if the implementation is initialized. */
if (!g_initialized_impl) { if (!g_initialized_impl) {
return ResultSuccess(); R_SUCCEED();
} }
#if defined(MESOSPHERE_DEBUG_LOG_USE_SEMIHOSTING) #if defined(MESOSPHERE_DEBUG_LOG_USE_SEMIHOSTING)
@ -78,7 +78,7 @@ namespace ams::kern {
KDebugLogImpl::Flush(); KDebugLogImpl::Flush();
#endif #endif
return ResultSuccess(); R_SUCCEED();
} }
#endif #endif
@ -173,7 +173,7 @@ namespace ams::kern {
MESOSPHERE_UNUSED(user_str, len); MESOSPHERE_UNUSED(user_str, len);
#endif #endif
return ResultSuccess(); R_SUCCEED();
} }
void KDebugLog::Save() { void KDebugLog::Save() {

View File

@ -82,7 +82,7 @@ namespace ams::kern {
++num_waiters; ++num_waiters;
} }
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KAddressArbiter::SignalAndIncrementIfEqual(uintptr_t addr, s32 value, s32 count) { Result KAddressArbiter::SignalAndIncrementIfEqual(uintptr_t addr, s32 value, s32 count) {
@ -109,7 +109,7 @@ namespace ams::kern {
++num_waiters; ++num_waiters;
} }
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KAddressArbiter::SignalAndModifyByWaitingCountIfEqual(uintptr_t addr, s32 value, s32 count) { Result KAddressArbiter::SignalAndModifyByWaitingCountIfEqual(uintptr_t addr, s32 value, s32 count) {
@ -171,7 +171,7 @@ namespace ams::kern {
++num_waiters; ++num_waiters;
} }
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KAddressArbiter::WaitIfLessThan(uintptr_t addr, s32 value, bool decrement, s64 timeout) { Result KAddressArbiter::WaitIfLessThan(uintptr_t addr, s32 value, bool decrement, s64 timeout) {
@ -186,7 +186,7 @@ namespace ams::kern {
/* Check that the thread isn't terminating. */ /* Check that the thread isn't terminating. */
if (cur_thread->IsTerminationRequested()) { if (cur_thread->IsTerminationRequested()) {
slp.CancelSleep(); slp.CancelSleep();
return svc::ResultTerminationRequested(); R_THROW(svc::ResultTerminationRequested());
} }
/* Read the value from userspace. */ /* Read the value from userspace. */
@ -200,19 +200,19 @@ namespace ams::kern {
if (!succeeded) { if (!succeeded) {
slp.CancelSleep(); slp.CancelSleep();
return svc::ResultInvalidCurrentMemory(); R_THROW(svc::ResultInvalidCurrentMemory());
} }
/* Check that the value is less than the specified one. */ /* Check that the value is less than the specified one. */
if (user_value >= value) { if (user_value >= value) {
slp.CancelSleep(); slp.CancelSleep();
return svc::ResultInvalidState(); R_THROW(svc::ResultInvalidState());
} }
/* Check that the timeout is non-zero. */ /* Check that the timeout is non-zero. */
if (timeout == 0) { if (timeout == 0) {
slp.CancelSleep(); slp.CancelSleep();
return svc::ResultTimedOut(); R_THROW(svc::ResultTimedOut());
} }
/* Set the arbiter. */ /* Set the arbiter. */
@ -225,7 +225,7 @@ namespace ams::kern {
} }
/* Get the wait result. */ /* Get the wait result. */
return cur_thread->GetWaitResult(); R_RETURN(cur_thread->GetWaitResult());
} }
Result KAddressArbiter::WaitIfEqual(uintptr_t addr, s32 value, s64 timeout) { Result KAddressArbiter::WaitIfEqual(uintptr_t addr, s32 value, s64 timeout) {
@ -240,26 +240,26 @@ namespace ams::kern {
/* Check that the thread isn't terminating. */ /* Check that the thread isn't terminating. */
if (cur_thread->IsTerminationRequested()) { if (cur_thread->IsTerminationRequested()) {
slp.CancelSleep(); slp.CancelSleep();
return svc::ResultTerminationRequested(); R_THROW(svc::ResultTerminationRequested());
} }
/* Read the value from userspace. */ /* Read the value from userspace. */
s32 user_value; s32 user_value;
if (!ReadFromUser(std::addressof(user_value), addr)) { if (!ReadFromUser(std::addressof(user_value), addr)) {
slp.CancelSleep(); slp.CancelSleep();
return svc::ResultInvalidCurrentMemory(); R_THROW(svc::ResultInvalidCurrentMemory());
} }
/* Check that the value is equal. */ /* Check that the value is equal. */
if (value != user_value) { if (value != user_value) {
slp.CancelSleep(); slp.CancelSleep();
return svc::ResultInvalidState(); R_THROW(svc::ResultInvalidState());
} }
/* Check that the timeout is non-zero. */ /* Check that the timeout is non-zero. */
if (timeout == 0) { if (timeout == 0) {
slp.CancelSleep(); slp.CancelSleep();
return svc::ResultTimedOut(); R_THROW(svc::ResultTimedOut());
} }
/* Set the arbiter. */ /* Set the arbiter. */
@ -272,7 +272,7 @@ namespace ams::kern {
} }
/* Get the wait result. */ /* Get the wait result. */
return cur_thread->GetWaitResult(); R_RETURN(cur_thread->GetWaitResult());
} }
} }

View File

@ -38,7 +38,7 @@ namespace ams::kern {
m_intended_kernel_version.Set<KernelVersion::MinorVersion>(ams::svc::SupportedKernelMinorVersion); m_intended_kernel_version.Set<KernelVersion::MinorVersion>(ams::svc::SupportedKernelMinorVersion);
/* Parse the capabilities array. */ /* Parse the capabilities array. */
return this->SetCapabilities(caps, num_caps, page_table); R_RETURN(this->SetCapabilities(caps, num_caps, page_table));
} }
Result KCapabilities::Initialize(svc::KUserPointer<const u32 *> user_caps, s32 num_caps, KProcessPageTable *page_table) { Result KCapabilities::Initialize(svc::KUserPointer<const u32 *> user_caps, s32 num_caps, KProcessPageTable *page_table) {
@ -55,7 +55,7 @@ namespace ams::kern {
m_priority_mask = 0; m_priority_mask = 0;
/* Parse the user capabilities array. */ /* Parse the user capabilities array. */
return this->SetCapabilities(user_caps, num_caps, page_table); R_RETURN(this->SetCapabilities(user_caps, num_caps, page_table));
} }
Result KCapabilities::SetCorePriorityCapability(const util::BitPack32 cap) { Result KCapabilities::SetCorePriorityCapability(const util::BitPack32 cap) {
@ -93,7 +93,7 @@ namespace ams::kern {
/* Processes must not have access to kernel thread priorities. */ /* Processes must not have access to kernel thread priorities. */
R_UNLESS((m_priority_mask & 0xF) == 0, svc::ResultInvalidArgument()); R_UNLESS((m_priority_mask & 0xF) == 0, svc::ResultInvalidArgument());
return ResultSuccess(); R_SUCCEED();
} }
Result KCapabilities::SetSyscallMaskCapability(const util::BitPack32 cap, u32 &set_svc) { Result KCapabilities::SetSyscallMaskCapability(const util::BitPack32 cap, u32 &set_svc) {
@ -113,7 +113,7 @@ namespace ams::kern {
} }
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KCapabilities::MapRange(const util::BitPack32 cap, const util::BitPack32 size_cap, KProcessPageTable *page_table) { Result KCapabilities::MapRange(const util::BitPack32 cap, const util::BitPack32 size_cap, KProcessPageTable *page_table) {
@ -136,9 +136,9 @@ namespace ams::kern {
/* Do the mapping. */ /* Do the mapping. */
const KMemoryPermission perm = cap.Get<MapRange::ReadOnly>() ? KMemoryPermission_UserRead : KMemoryPermission_UserReadWrite; const KMemoryPermission perm = cap.Get<MapRange::ReadOnly>() ? KMemoryPermission_UserRead : KMemoryPermission_UserReadWrite;
if (size_cap.Get<MapRangeSize::Normal>()) { if (size_cap.Get<MapRangeSize::Normal>()) {
return page_table->MapStatic(phys_addr, size, perm); R_RETURN(page_table->MapStatic(phys_addr, size, perm));
} else { } else {
return page_table->MapIo(phys_addr, size, perm); R_RETURN(page_table->MapIo(phys_addr, size, perm));
} }
} }
@ -153,7 +153,7 @@ namespace ams::kern {
R_UNLESS(((phys_addr + size - 1) & ~PhysicalMapAllowedMask) == 0, svc::ResultInvalidAddress()); R_UNLESS(((phys_addr + size - 1) & ~PhysicalMapAllowedMask) == 0, svc::ResultInvalidAddress());
/* Do the mapping. */ /* Do the mapping. */
return page_table->MapIo(phys_addr, size, KMemoryPermission_UserReadWrite); R_RETURN(page_table->MapIo(phys_addr, size, KMemoryPermission_UserReadWrite));
} }
Result KCapabilities::MapRegion(const util::BitPack32 cap, KProcessPageTable *page_table) { Result KCapabilities::MapRegion(const util::BitPack32 cap, KProcessPageTable *page_table) {
@ -181,11 +181,11 @@ namespace ams::kern {
R_TRY(page_table->MapRegion(MemoryRegions[static_cast<u32>(type)], perm)); R_TRY(page_table->MapRegion(MemoryRegions[static_cast<u32>(type)], perm));
break; break;
default: default:
return svc::ResultNotFound(); R_THROW(svc::ResultNotFound());
} }
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KCapabilities::SetInterruptPairCapability(const util::BitPack32 cap) { Result KCapabilities::SetInterruptPairCapability(const util::BitPack32 cap) {
@ -199,7 +199,7 @@ namespace ams::kern {
} }
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KCapabilities::SetProgramTypeCapability(const util::BitPack32 cap) { Result KCapabilities::SetProgramTypeCapability(const util::BitPack32 cap) {
@ -207,7 +207,7 @@ namespace ams::kern {
R_UNLESS(cap.Get<ProgramType::Reserved>() == 0, svc::ResultReservedUsed()); R_UNLESS(cap.Get<ProgramType::Reserved>() == 0, svc::ResultReservedUsed());
m_program_type = cap.Get<ProgramType::Type>(); m_program_type = cap.Get<ProgramType::Type>();
return ResultSuccess(); R_SUCCEED();
} }
Result KCapabilities::SetKernelVersionCapability(const util::BitPack32 cap) { Result KCapabilities::SetKernelVersionCapability(const util::BitPack32 cap) {
@ -218,7 +218,7 @@ namespace ams::kern {
m_intended_kernel_version = cap; m_intended_kernel_version = cap;
R_UNLESS(m_intended_kernel_version.Get<KernelVersion::MajorVersion>() != 0, svc::ResultInvalidArgument()); R_UNLESS(m_intended_kernel_version.Get<KernelVersion::MajorVersion>() != 0, svc::ResultInvalidArgument());
return ResultSuccess(); R_SUCCEED();
} }
Result KCapabilities::SetHandleTableCapability(const util::BitPack32 cap) { Result KCapabilities::SetHandleTableCapability(const util::BitPack32 cap) {
@ -226,7 +226,7 @@ namespace ams::kern {
R_UNLESS(cap.Get<HandleTable::Reserved>() == 0, svc::ResultReservedUsed()); R_UNLESS(cap.Get<HandleTable::Reserved>() == 0, svc::ResultReservedUsed());
m_handle_table_size = cap.Get<HandleTable::Size>(); m_handle_table_size = cap.Get<HandleTable::Size>();
return ResultSuccess(); R_SUCCEED();
} }
Result KCapabilities::SetDebugFlagsCapability(const util::BitPack32 cap) { Result KCapabilities::SetDebugFlagsCapability(const util::BitPack32 cap) {
@ -235,7 +235,7 @@ namespace ams::kern {
m_debug_capabilities.Set<DebugFlags::AllowDebug>(cap.Get<DebugFlags::AllowDebug>()); m_debug_capabilities.Set<DebugFlags::AllowDebug>(cap.Get<DebugFlags::AllowDebug>());
m_debug_capabilities.Set<DebugFlags::ForceDebug>(cap.Get<DebugFlags::ForceDebug>()); m_debug_capabilities.Set<DebugFlags::ForceDebug>(cap.Get<DebugFlags::ForceDebug>());
return ResultSuccess(); R_SUCCEED();
} }
Result KCapabilities::SetCapability(const util::BitPack32 cap, u32 &set_flags, u32 &set_svc, KProcessPageTable *page_table) { Result KCapabilities::SetCapability(const util::BitPack32 cap, u32 &set_flags, u32 &set_svc, KProcessPageTable *page_table) {
@ -253,16 +253,16 @@ namespace ams::kern {
/* Process the capability. */ /* Process the capability. */
switch (type) { switch (type) {
case CapabilityType::CorePriority: return this->SetCorePriorityCapability(cap); case CapabilityType::CorePriority: R_RETURN(this->SetCorePriorityCapability(cap));
case CapabilityType::SyscallMask: return this->SetSyscallMaskCapability(cap, set_svc); case CapabilityType::SyscallMask: R_RETURN(this->SetSyscallMaskCapability(cap, set_svc));
case CapabilityType::MapIoPage: return this->MapIoPage(cap, page_table); case CapabilityType::MapIoPage: R_RETURN(this->MapIoPage(cap, page_table));
case CapabilityType::MapRegion: return this->MapRegion(cap, page_table); case CapabilityType::MapRegion: R_RETURN(this->MapRegion(cap, page_table));
case CapabilityType::InterruptPair: return this->SetInterruptPairCapability(cap); case CapabilityType::InterruptPair: R_RETURN(this->SetInterruptPairCapability(cap));
case CapabilityType::ProgramType: return this->SetProgramTypeCapability(cap); case CapabilityType::ProgramType: R_RETURN(this->SetProgramTypeCapability(cap));
case CapabilityType::KernelVersion: return this->SetKernelVersionCapability(cap); case CapabilityType::KernelVersion: R_RETURN(this->SetKernelVersionCapability(cap));
case CapabilityType::HandleTable: return this->SetHandleTableCapability(cap); case CapabilityType::HandleTable: R_RETURN(this->SetHandleTableCapability(cap));
case CapabilityType::DebugFlags: return this->SetDebugFlagsCapability(cap); case CapabilityType::DebugFlags: R_RETURN(this->SetDebugFlagsCapability(cap));
default: return svc::ResultInvalidArgument(); default: R_THROW(svc::ResultInvalidArgument());
} }
} }
@ -286,7 +286,7 @@ namespace ams::kern {
} }
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KCapabilities::SetCapabilities(svc::KUserPointer<const u32 *> user_caps, s32 num_caps, KProcessPageTable *page_table) { Result KCapabilities::SetCapabilities(svc::KUserPointer<const u32 *> user_caps, s32 num_caps, KProcessPageTable *page_table) {
@ -317,7 +317,7 @@ namespace ams::kern {
} }
} }
return ResultSuccess(); R_SUCCEED();
} }
} }

View File

@ -40,7 +40,7 @@ namespace ams::kern {
request->Initialize(nullptr, address, size); request->Initialize(nullptr, address, size);
/* Send the request. */ /* Send the request. */
return m_parent->OnRequest(request); R_RETURN(m_parent->OnRequest(request));
} }
Result KClientSession::SendAsyncRequest(KEvent *event, uintptr_t address, size_t size) { Result KClientSession::SendAsyncRequest(KEvent *event, uintptr_t address, size_t size) {
@ -55,7 +55,7 @@ namespace ams::kern {
request->Initialize(event, address, size); request->Initialize(event, address, size);
/* Send the request. */ /* Send the request. */
return m_parent->OnRequest(request); R_RETURN(m_parent->OnRequest(request));
} }
} }

View File

@ -49,7 +49,7 @@ namespace ams::kern {
/* We succeeded. */ /* We succeeded. */
pg_guard.Cancel(); pg_guard.Cancel();
return ResultSuccess(); R_SUCCEED();
} }
void KCodeMemory::Finalize() { void KCodeMemory::Finalize() {
@ -87,7 +87,7 @@ namespace ams::kern {
/* Mark ourselves as mapped. */ /* Mark ourselves as mapped. */
m_is_mapped = true; m_is_mapped = true;
return ResultSuccess(); R_SUCCEED();
} }
Result KCodeMemory::Unmap(KProcessAddress address, size_t size) { Result KCodeMemory::Unmap(KProcessAddress address, size_t size) {
@ -106,7 +106,7 @@ namespace ams::kern {
MESOSPHERE_ASSERT(m_is_mapped); MESOSPHERE_ASSERT(m_is_mapped);
m_is_mapped = false; m_is_mapped = false;
return ResultSuccess(); R_SUCCEED();
} }
Result KCodeMemory::MapToOwner(KProcessAddress address, size_t size, ams::svc::MemoryPermission perm) { Result KCodeMemory::MapToOwner(KProcessAddress address, size_t size, ams::svc::MemoryPermission perm) {
@ -135,7 +135,7 @@ namespace ams::kern {
/* Mark ourselves as mapped. */ /* Mark ourselves as mapped. */
m_is_owner_mapped = true; m_is_owner_mapped = true;
return ResultSuccess(); R_SUCCEED();
} }
Result KCodeMemory::UnmapFromOwner(KProcessAddress address, size_t size) { Result KCodeMemory::UnmapFromOwner(KProcessAddress address, size_t size) {
@ -154,7 +154,7 @@ namespace ams::kern {
MESOSPHERE_ASSERT(m_is_owner_mapped); MESOSPHERE_ASSERT(m_is_owner_mapped);
m_is_owner_mapped = false; m_is_owner_mapped = false;
return ResultSuccess(); R_SUCCEED();
} }
} }

View File

@ -98,12 +98,12 @@ namespace ams::kern {
/* Signal the next owner thread. */ /* Signal the next owner thread. */
next_owner_thread->EndWait(result); next_owner_thread->EndWait(result);
return result; R_RETURN(result);
} else { } else {
/* Just write the value to userspace. */ /* Just write the value to userspace. */
R_UNLESS(WriteToUser(addr, std::addressof(next_value)), svc::ResultInvalidCurrentMemory()); R_UNLESS(WriteToUser(addr, std::addressof(next_value)), svc::ResultInvalidCurrentMemory());
return ResultSuccess(); R_SUCCEED();
} }
} }
} }
@ -143,7 +143,7 @@ namespace ams::kern {
owner_thread->Close(); owner_thread->Close();
/* Get the wait result. */ /* Get the wait result. */
return cur_thread->GetWaitResult(); R_RETURN(cur_thread->GetWaitResult());
} }
void KConditionVariable::SignalImpl(KThread *thread) { void KConditionVariable::SignalImpl(KThread *thread) {
@ -224,7 +224,7 @@ namespace ams::kern {
/* Check that the thread isn't terminating. */ /* Check that the thread isn't terminating. */
if (cur_thread->IsTerminationRequested()) { if (cur_thread->IsTerminationRequested()) {
slp.CancelSleep(); slp.CancelSleep();
return svc::ResultTerminationRequested(); R_THROW(svc::ResultTerminationRequested());
} }
/* Update the value and process for the next owner. */ /* Update the value and process for the next owner. */
@ -256,7 +256,7 @@ namespace ams::kern {
/* Write the value to userspace. */ /* Write the value to userspace. */
if (!WriteToUser(addr, std::addressof(next_value))) { if (!WriteToUser(addr, std::addressof(next_value))) {
slp.CancelSleep(); slp.CancelSleep();
return svc::ResultInvalidCurrentMemory(); R_THROW(svc::ResultInvalidCurrentMemory());
} }
} }
@ -273,7 +273,7 @@ namespace ams::kern {
} }
/* Get the wait result. */ /* Get the wait result. */
return cur_thread->GetWaitResult(); R_RETURN(cur_thread->GetWaitResult());
} }
} }

View File

@ -69,7 +69,7 @@ namespace ams::kern {
/* Write output. */ /* Write output. */
*out_memory_info = info.GetSvcMemoryInfo(); *out_memory_info = info.GetSvcMemoryInfo();
return ResultSuccess(); R_SUCCEED();
} }
Result KDebugBase::ReadMemory(KProcessAddress buffer, KProcessAddress address, size_t size) { Result KDebugBase::ReadMemory(KProcessAddress buffer, KProcessAddress address, size_t size) {
@ -132,7 +132,7 @@ namespace ams::kern {
remaining -= cur_size; remaining -= cur_size;
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KDebugBase::WriteMemory(KProcessAddress buffer, KProcessAddress address, size_t size) { Result KDebugBase::WriteMemory(KProcessAddress buffer, KProcessAddress address, size_t size) {
@ -195,7 +195,7 @@ namespace ams::kern {
remaining -= cur_size; remaining -= cur_size;
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KDebugBase::GetRunningThreadInfo(ams::svc::LastThreadContext *out_context, u64 *out_thread_id) { Result KDebugBase::GetRunningThreadInfo(ams::svc::LastThreadContext *out_context, u64 *out_thread_id) {
@ -233,7 +233,7 @@ namespace ams::kern {
*out_thread_id = thread->GetId(); *out_thread_id = thread->GetId();
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KDebugBase::Attach(KProcess *target) { Result KDebugBase::Attach(KProcess *target) {
@ -265,10 +265,10 @@ namespace ams::kern {
case KProcess::State_CreatedAttached: case KProcess::State_CreatedAttached:
case KProcess::State_RunningAttached: case KProcess::State_RunningAttached:
case KProcess::State_DebugBreak: case KProcess::State_DebugBreak:
return svc::ResultBusy(); R_THROW(svc::ResultBusy());
case KProcess::State_Terminating: case KProcess::State_Terminating:
case KProcess::State_Terminated: case KProcess::State_Terminated:
return svc::ResultProcessTerminated(); R_THROW(svc::ResultProcessTerminated());
MESOSPHERE_UNREACHABLE_DEFAULT_CASE(); MESOSPHERE_UNREACHABLE_DEFAULT_CASE();
} }
@ -313,7 +313,7 @@ namespace ams::kern {
} }
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KDebugBase::BreakProcess() { Result KDebugBase::BreakProcess() {
@ -385,7 +385,7 @@ namespace ams::kern {
/* Set the process as breaked. */ /* Set the process as breaked. */
target->SetDebugBreak(); target->SetDebugBreak();
return ResultSuccess(); R_SUCCEED();
} }
Result KDebugBase::TerminateProcess() { Result KDebugBase::TerminateProcess() {
@ -467,7 +467,7 @@ namespace ams::kern {
/* Terminate the process. */ /* Terminate the process. */
target->Terminate(); target->Terminate();
return ResultSuccess(); R_SUCCEED();
} }
Result KDebugBase::GetThreadContext(ams::svc::ThreadContext *out, u64 thread_id, u32 context_flags) { Result KDebugBase::GetThreadContext(ams::svc::ThreadContext *out, u64 thread_id, u32 context_flags) {
@ -529,7 +529,7 @@ namespace ams::kern {
/* Get the thread context. */ /* Get the thread context. */
static_assert(std::derived_from<KDebug, KDebugBase>); static_assert(std::derived_from<KDebug, KDebugBase>);
return static_cast<KDebug *>(this)->GetThreadContextImpl(out, thread, context_flags); R_RETURN(static_cast<KDebug *>(this)->GetThreadContextImpl(out, thread, context_flags));
} }
} }
@ -621,7 +621,7 @@ namespace ams::kern {
/* Set the thread context. */ /* Set the thread context. */
static_assert(std::derived_from<KDebug, KDebugBase>); static_assert(std::derived_from<KDebug, KDebugBase>);
return static_cast<KDebug *>(this)->SetThreadContextImpl(ctx, thread, context_flags); R_RETURN(static_cast<KDebug *>(this)->SetThreadContextImpl(ctx, thread, context_flags));
} }
} }
@ -722,7 +722,7 @@ namespace ams::kern {
target->SetAttached(); target->SetAttached();
} }
return ResultSuccess(); R_SUCCEED();
} }
KEventInfo *KDebugBase::CreateDebugEvent(ams::svc::DebugEvent event, uintptr_t param0, uintptr_t param1, uintptr_t param2, uintptr_t param3, uintptr_t param4, u64 cur_thread_id) { KEventInfo *KDebugBase::CreateDebugEvent(ams::svc::DebugEvent event, uintptr_t param0, uintptr_t param1, uintptr_t param2, uintptr_t param3, uintptr_t param4, u64 cur_thread_id) {
@ -975,15 +975,15 @@ namespace ams::kern {
break; break;
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KDebugBase::GetDebugEventInfo(ams::svc::lp64::DebugEventInfo *out) { Result KDebugBase::GetDebugEventInfo(ams::svc::lp64::DebugEventInfo *out) {
return this->GetDebugEventInfoImpl(out); R_RETURN(this->GetDebugEventInfoImpl(out));
} }
Result KDebugBase::GetDebugEventInfo(ams::svc::ilp32::DebugEventInfo *out) { Result KDebugBase::GetDebugEventInfo(ams::svc::ilp32::DebugEventInfo *out) {
return this->GetDebugEventInfoImpl(out); R_RETURN(this->GetDebugEventInfoImpl(out));
} }
void KDebugBase::Finalize() { void KDebugBase::Finalize() {
@ -1091,7 +1091,7 @@ namespace ams::kern {
/* If the event is an exception and we don't have exception events enabled, we can't handle the event. */ /* If the event is an exception and we don't have exception events enabled, we can't handle the event. */
if (event == ams::svc::DebugEvent_Exception && (debug->m_continue_flags & ams::svc::ContinueFlag_EnableExceptionEvent) == 0) { if (event == ams::svc::DebugEvent_Exception && (debug->m_continue_flags & ams::svc::ContinueFlag_EnableExceptionEvent) == 0) {
GetCurrentThread().SetDebugExceptionResult(ResultSuccess()); GetCurrentThread().SetDebugExceptionResult(ResultSuccess());
return svc::ResultNotHandled(); R_THROW(svc::ResultNotHandled());
} }
/* If the current thread is suspended, retry. */ /* If the current thread is suspended, retry. */
@ -1134,21 +1134,21 @@ namespace ams::kern {
/* Get the debug object. */ /* Get the debug object. */
if (KDebugBase *debug = GetDebugObject(process); debug != nullptr) { if (KDebugBase *debug = GetDebugObject(process); debug != nullptr) {
/* If we have one, check the debug exception. */ /* If we have one, check the debug exception. */
return GetCurrentThread().GetDebugExceptionResult(); R_RETURN(GetCurrentThread().GetDebugExceptionResult());
} else { } else {
/* We don't have a debug object, so stop processing the exception. */ /* We don't have a debug object, so stop processing the exception. */
return svc::ResultStopProcessingException(); R_THROW(svc::ResultStopProcessingException());
} }
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KDebugBase::OnDebugEvent(ams::svc::DebugEvent event, uintptr_t param0, uintptr_t param1, uintptr_t param2, uintptr_t param3, uintptr_t param4) { Result KDebugBase::OnDebugEvent(ams::svc::DebugEvent event, uintptr_t param0, uintptr_t param1, uintptr_t param2, uintptr_t param3, uintptr_t param4) {
if (KProcess *process = GetCurrentProcessPointer(); process != nullptr && process->IsAttachedToDebugger()) { if (KProcess *process = GetCurrentProcessPointer(); process != nullptr && process->IsAttachedToDebugger()) {
return ProcessDebugEvent(event, param0, param1, param2, param3, param4); R_RETURN(ProcessDebugEvent(event, param0, param1, param2, param3, param4));
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KDebugBase::OnExitProcess(KProcess *process) { Result KDebugBase::OnExitProcess(KProcess *process) {
@ -1166,7 +1166,7 @@ namespace ams::kern {
} }
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KDebugBase::OnTerminateProcess(KProcess *process) { Result KDebugBase::OnTerminateProcess(KProcess *process) {
@ -1184,7 +1184,7 @@ namespace ams::kern {
} }
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KDebugBase::OnExitThread(KThread *thread) { Result KDebugBase::OnExitThread(KThread *thread) {
@ -1196,7 +1196,7 @@ namespace ams::kern {
R_TRY(OnDebugEvent(ams::svc::DebugEvent_ExitThread, thread->GetId(), thread->IsTerminationRequested() ? ams::svc::ThreadExitReason_TerminateThread : ams::svc::ThreadExitReason_ExitThread)); R_TRY(OnDebugEvent(ams::svc::DebugEvent_ExitThread, thread->GetId(), thread->IsTerminationRequested() ? ams::svc::ThreadExitReason_TerminateThread : ams::svc::ThreadExitReason_ExitThread));
} }
return ResultSuccess(); R_SUCCEED();
} }
} }

View File

@ -43,7 +43,7 @@ namespace ams::kern {
R_SUCCEED_IF(m_readable_event_destroyed); R_SUCCEED_IF(m_readable_event_destroyed);
return m_readable_event.Signal(); R_RETURN(m_readable_event.Signal());
} }
Result KEvent::Clear() { Result KEvent::Clear() {
@ -51,7 +51,7 @@ namespace ams::kern {
R_SUCCEED_IF(m_readable_event_destroyed); R_SUCCEED_IF(m_readable_event_destroyed);
return m_readable_event.Clear(); R_RETURN(m_readable_event.Clear());
} }
void KEvent::PostDestroy(uintptr_t arg) { void KEvent::PostDestroy(uintptr_t arg) {

View File

@ -36,7 +36,7 @@ namespace ams::kern {
} }
} }
return ResultSuccess(); R_SUCCEED();
} }
bool KHandleTable::Remove(ams::svc::Handle handle) { bool KHandleTable::Remove(ams::svc::Handle handle) {
@ -95,7 +95,7 @@ namespace ams::kern {
*out_handle = EncodeHandle(index, linear_id); *out_handle = EncodeHandle(index, linear_id);
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KHandleTable::Reserve(ams::svc::Handle *out_handle) { Result KHandleTable::Reserve(ams::svc::Handle *out_handle) {
@ -107,7 +107,7 @@ namespace ams::kern {
R_UNLESS(m_count < m_table_size, svc::ResultOutOfHandles()); R_UNLESS(m_count < m_table_size, svc::ResultOutOfHandles());
*out_handle = EncodeHandle(this->AllocateEntry(), this->AllocateLinearId()); *out_handle = EncodeHandle(this->AllocateEntry(), this->AllocateLinearId());
return ResultSuccess(); R_SUCCEED();
} }
void KHandleTable::Unreserve(ams::svc::Handle handle) { void KHandleTable::Unreserve(ams::svc::Handle handle) {

View File

@ -143,7 +143,7 @@ namespace ams::kern {
/* All initial processes should disable device address space merge. */ /* All initial processes should disable device address space merge. */
out->flags |= ams::svc::CreateProcessFlag_DisableDeviceAddressSpaceMerge; out->flags |= ams::svc::CreateProcessFlag_DisableDeviceAddressSpaceMerge;
return ResultSuccess(); R_SUCCEED();
} }
Result KInitialProcessReader::Load(KProcessAddress address, const ams::svc::CreateProcessParameter &params, KProcessAddress src) const { Result KInitialProcessReader::Load(KProcessAddress address, const ams::svc::CreateProcessParameter &params, KProcessAddress src) const {
@ -187,7 +187,7 @@ namespace ams::kern {
cpu::FlushEntireDataCache(); cpu::FlushEntireDataCache();
cpu::InvalidateEntireInstructionCache(); cpu::InvalidateEntireInstructionCache();
return ResultSuccess(); R_SUCCEED();
} }
Result KInitialProcessReader::SetMemoryPermissions(KProcessPageTable &page_table, const ams::svc::CreateProcessParameter &params) const { Result KInitialProcessReader::SetMemoryPermissions(KProcessPageTable &page_table, const ams::svc::CreateProcessParameter &params) const {
@ -215,7 +215,7 @@ namespace ams::kern {
R_TRY(page_table.SetProcessMemoryPermission(start, util::AlignUp(end - start, PageSize), ams::svc::MemoryPermission_ReadWrite)); R_TRY(page_table.SetProcessMemoryPermission(start, util::AlignUp(end - start, PageSize), ams::svc::MemoryPermission_ReadWrite));
} }
return ResultSuccess(); R_SUCCEED();
} }
} }

View File

@ -80,7 +80,7 @@ namespace ams::kern {
m_pool_type = pool_type; m_pool_type = pool_type;
m_is_initialized = true; m_is_initialized = true;
return ResultSuccess(); R_SUCCEED();
} }
void KIoPool::Finalize() { void KIoPool::Finalize() {
@ -113,7 +113,7 @@ namespace ams::kern {
/* Add the region to our pool. */ /* Add the region to our pool. */
m_io_region_list.push_back(*new_region); m_io_region_list.push_back(*new_region);
return ResultSuccess(); R_SUCCEED();
} }
void KIoPool::RemoveIoRegion(KIoRegion *region) { void KIoPool::RemoveIoRegion(KIoRegion *region) {

View File

@ -37,7 +37,7 @@ namespace ams::kern {
/* Mark ourselves as initialized. */ /* Mark ourselves as initialized. */
m_is_initialized = true; m_is_initialized = true;
return ResultSuccess(); R_SUCCEED();
} }
void KIoRegion::Finalize() { void KIoRegion::Finalize() {
@ -72,7 +72,7 @@ namespace ams::kern {
/* Note that we're mapped. */ /* Note that we're mapped. */
m_is_mapped = true; m_is_mapped = true;
return ResultSuccess(); R_SUCCEED();
} }
Result KIoRegion::Unmap(KProcessAddress address, size_t size) { Result KIoRegion::Unmap(KProcessAddress address, size_t size) {
@ -93,7 +93,7 @@ namespace ams::kern {
/* Note that we're unmapped. */ /* Note that we're unmapped. */
m_is_mapped = false; m_is_mapped = false;
return ResultSuccess(); R_SUCCEED();
} }
} }

View File

@ -37,7 +37,7 @@ namespace ams::kern {
cur_thread->SetLightSessionData(data); cur_thread->SetLightSessionData(data);
/* Send the request. */ /* Send the request. */
return m_parent->OnRequest(cur_thread); R_RETURN(m_parent->OnRequest(cur_thread));
} }
} }

View File

@ -120,7 +120,7 @@ namespace ams::kern {
/* NOTE: Nintendo returns GetCurrentThread().GetWaitResult() here. */ /* NOTE: Nintendo returns GetCurrentThread().GetWaitResult() here. */
/* This is technically incorrect, although it doesn't cause problems in practice */ /* This is technically incorrect, although it doesn't cause problems in practice */
/* because this is only ever called with request_thread = GetCurrentThreadPointer(). */ /* because this is only ever called with request_thread = GetCurrentThreadPointer(). */
return request_thread->GetWaitResult(); R_RETURN(request_thread->GetWaitResult());
} }
Result KLightServerSession::ReplyAndReceive(u32 *data) { Result KLightServerSession::ReplyAndReceive(u32 *data) {
@ -193,7 +193,7 @@ namespace ams::kern {
std::memcpy(GetCurrentThread().GetLightSessionData(), m_current_request->GetLightSessionData(), KLightSession::DataSize); std::memcpy(GetCurrentThread().GetLightSessionData(), m_current_request->GetLightSessionData(), KLightSession::DataSize);
/* We successfully received. */ /* We successfully received. */
return ResultSuccess(); R_SUCCEED();
} }
/* We need to wait for a request to come in. */ /* We need to wait for a request to come in. */
@ -201,7 +201,7 @@ namespace ams::kern {
/* Check if we were cancelled. */ /* Check if we were cancelled. */
if (GetCurrentThread().IsWaitCancelled()) { if (GetCurrentThread().IsWaitCancelled()) {
GetCurrentThread().ClearWaitCancelled(); GetCurrentThread().ClearWaitCancelled();
return svc::ResultCancelled(); R_THROW(svc::ResultCancelled());
} }
/* Mark ourselves as cancellable. */ /* Mark ourselves as cancellable. */

View File

@ -102,7 +102,7 @@ namespace ams::kern {
start_block->Initialize(m_start_address, (m_end_address - m_start_address) / PageSize, KMemoryState_Free, KMemoryPermission_None, KMemoryAttribute_None); start_block->Initialize(m_start_address, (m_end_address - m_start_address) / PageSize, KMemoryState_Free, KMemoryPermission_None, KMemoryAttribute_None);
m_memory_block_tree.insert(*start_block); m_memory_block_tree.insert(*start_block);
return ResultSuccess(); R_SUCCEED();
} }
void KMemoryBlockManager::Finalize(KMemoryBlockSlabManager *slab_manager) { void KMemoryBlockManager::Finalize(KMemoryBlockSlabManager *slab_manager) {

View File

@ -55,14 +55,14 @@ namespace ams::kern {
KScopedAutoObject existing_object = FindImpl(name); KScopedAutoObject existing_object = FindImpl(name);
if (existing_object.IsNull()) { if (existing_object.IsNull()) {
g_object_list.push_back(*new_name); g_object_list.push_back(*new_name);
return ResultSuccess(); R_SUCCEED();
} }
} }
/* The object already exists, which is an error condition. Perform cleanup. */ /* The object already exists, which is an error condition. Perform cleanup. */
obj->Close(); obj->Close();
KObjectName::Free(new_name); KObjectName::Free(new_name);
return svc::ResultInvalidState(); R_THROW(svc::ResultInvalidState());
} }
Result KObjectName::Delete(KAutoObject *obj, const char *compare_name) { Result KObjectName::Delete(KAutoObject *obj, const char *compare_name) {
@ -76,12 +76,12 @@ namespace ams::kern {
obj->Close(); obj->Close();
g_object_list.erase(g_object_list.iterator_to(name)); g_object_list.erase(g_object_list.iterator_to(name));
KObjectName::Free(std::addressof(name)); KObjectName::Free(std::addressof(name));
return ResultSuccess(); R_SUCCEED();
} }
} }
/* We didn't find the object in the list. */ /* We didn't find the object in the list. */
return svc::ResultNotFound(); R_THROW(svc::ResultNotFound());
} }
KScopedAutoObject<KAutoObject> KObjectName::Find(const char *name) { KScopedAutoObject<KAutoObject> KObjectName::Find(const char *name) {

View File

@ -81,7 +81,7 @@ namespace ams::kern {
} }
m_last_block = new_block; m_last_block = new_block;
return ResultSuccess(); R_SUCCEED();
} }
void KPageGroup::Open() const { void KPageGroup::Open() const {

View File

@ -2829,57 +2829,57 @@ namespace ams::kern {
} }
Result KPageTableBase::LockForIpcUserBuffer(KPhysicalAddress *out, KProcessAddress address, size_t size) { Result KPageTableBase::LockForIpcUserBuffer(KPhysicalAddress *out, KProcessAddress address, size_t size) {
return this->LockMemoryAndOpen(nullptr, out, address, size, R_RETURN(this->LockMemoryAndOpen(nullptr, out, address, size,
KMemoryState_FlagCanIpcUserBuffer, KMemoryState_FlagCanIpcUserBuffer, KMemoryState_FlagCanIpcUserBuffer, KMemoryState_FlagCanIpcUserBuffer,
KMemoryPermission_All, KMemoryPermission_UserReadWrite, KMemoryPermission_All, KMemoryPermission_UserReadWrite,
KMemoryAttribute_All, KMemoryAttribute_None, KMemoryAttribute_All, KMemoryAttribute_None,
static_cast<KMemoryPermission>(KMemoryPermission_NotMapped | KMemoryPermission_KernelReadWrite), static_cast<KMemoryPermission>(KMemoryPermission_NotMapped | KMemoryPermission_KernelReadWrite),
KMemoryAttribute_Locked); KMemoryAttribute_Locked));
} }
Result KPageTableBase::UnlockForIpcUserBuffer(KProcessAddress address, size_t size) { Result KPageTableBase::UnlockForIpcUserBuffer(KProcessAddress address, size_t size) {
return this->UnlockMemory(address, size, R_RETURN(this->UnlockMemory(address, size,
KMemoryState_FlagCanIpcUserBuffer, KMemoryState_FlagCanIpcUserBuffer, KMemoryState_FlagCanIpcUserBuffer, KMemoryState_FlagCanIpcUserBuffer,
KMemoryPermission_None, KMemoryPermission_None, KMemoryPermission_None, KMemoryPermission_None,
KMemoryAttribute_All, KMemoryAttribute_Locked, KMemoryAttribute_All, KMemoryAttribute_Locked,
KMemoryPermission_UserReadWrite, KMemoryPermission_UserReadWrite,
KMemoryAttribute_Locked, nullptr); KMemoryAttribute_Locked, nullptr));
} }
Result KPageTableBase::LockForTransferMemory(KPageGroup *out, KProcessAddress address, size_t size, KMemoryPermission perm) { Result KPageTableBase::LockForTransferMemory(KPageGroup *out, KProcessAddress address, size_t size, KMemoryPermission perm) {
return this->LockMemoryAndOpen(out, nullptr, address, size, R_RETURN(this->LockMemoryAndOpen(out, nullptr, address, size,
KMemoryState_FlagCanTransfer, KMemoryState_FlagCanTransfer, KMemoryState_FlagCanTransfer, KMemoryState_FlagCanTransfer,
KMemoryPermission_All, KMemoryPermission_UserReadWrite, KMemoryPermission_All, KMemoryPermission_UserReadWrite,
KMemoryAttribute_All, KMemoryAttribute_None, KMemoryAttribute_All, KMemoryAttribute_None,
perm, perm,
KMemoryAttribute_Locked); KMemoryAttribute_Locked));
} }
Result KPageTableBase::UnlockForTransferMemory(KProcessAddress address, size_t size, const KPageGroup &pg) { Result KPageTableBase::UnlockForTransferMemory(KProcessAddress address, size_t size, const KPageGroup &pg) {
return this->UnlockMemory(address, size, R_RETURN(this->UnlockMemory(address, size,
KMemoryState_FlagCanTransfer, KMemoryState_FlagCanTransfer, KMemoryState_FlagCanTransfer, KMemoryState_FlagCanTransfer,
KMemoryPermission_None, KMemoryPermission_None, KMemoryPermission_None, KMemoryPermission_None,
KMemoryAttribute_All, KMemoryAttribute_Locked, KMemoryAttribute_All, KMemoryAttribute_Locked,
KMemoryPermission_UserReadWrite, KMemoryPermission_UserReadWrite,
KMemoryAttribute_Locked, std::addressof(pg)); KMemoryAttribute_Locked, std::addressof(pg)));
} }
Result KPageTableBase::LockForCodeMemory(KPageGroup *out, KProcessAddress address, size_t size) { Result KPageTableBase::LockForCodeMemory(KPageGroup *out, KProcessAddress address, size_t size) {
return this->LockMemoryAndOpen(out, nullptr, address, size, R_RETURN(this->LockMemoryAndOpen(out, nullptr, address, size,
KMemoryState_FlagCanCodeMemory, KMemoryState_FlagCanCodeMemory, KMemoryState_FlagCanCodeMemory, KMemoryState_FlagCanCodeMemory,
KMemoryPermission_All, KMemoryPermission_UserReadWrite, KMemoryPermission_All, KMemoryPermission_UserReadWrite,
KMemoryAttribute_All, KMemoryAttribute_None, KMemoryAttribute_All, KMemoryAttribute_None,
static_cast<KMemoryPermission>(KMemoryPermission_NotMapped | KMemoryPermission_KernelReadWrite), static_cast<KMemoryPermission>(KMemoryPermission_NotMapped | KMemoryPermission_KernelReadWrite),
KMemoryAttribute_Locked); KMemoryAttribute_Locked));
} }
Result KPageTableBase::UnlockForCodeMemory(KProcessAddress address, size_t size, const KPageGroup &pg) { Result KPageTableBase::UnlockForCodeMemory(KProcessAddress address, size_t size, const KPageGroup &pg) {
return this->UnlockMemory(address, size, R_RETURN(this->UnlockMemory(address, size,
KMemoryState_FlagCanCodeMemory, KMemoryState_FlagCanCodeMemory, KMemoryState_FlagCanCodeMemory, KMemoryState_FlagCanCodeMemory,
KMemoryPermission_None, KMemoryPermission_None, KMemoryPermission_None, KMemoryPermission_None,
KMemoryAttribute_All, KMemoryAttribute_Locked, KMemoryAttribute_All, KMemoryAttribute_Locked,
KMemoryPermission_UserReadWrite, KMemoryPermission_UserReadWrite,
KMemoryAttribute_Locked, std::addressof(pg)); KMemoryAttribute_Locked, std::addressof(pg)));
} }
Result KPageTableBase::OpenMemoryRangeForProcessCacheOperation(MemoryRange *out, KProcessAddress address, size_t size) { Result KPageTableBase::OpenMemoryRangeForProcessCacheOperation(MemoryRange *out, KProcessAddress address, size_t size) {

View File

@ -59,7 +59,7 @@ namespace ams::kern {
R_UNLESS(m_state == State::Normal, svc::ResultPortClosed()); R_UNLESS(m_state == State::Normal, svc::ResultPortClosed());
m_server.EnqueueSession(session); m_server.EnqueueSession(session);
return ResultSuccess(); R_SUCCEED();
} }
Result KPort::EnqueueSession(KLightServerSession *session) { Result KPort::EnqueueSession(KLightServerSession *session) {
@ -68,7 +68,7 @@ namespace ams::kern {
R_UNLESS(m_state == State::Normal, svc::ResultPortClosed()); R_UNLESS(m_state == State::Normal, svc::ResultPortClosed());
m_server.EnqueueSession(session); m_server.EnqueueSession(session);
return ResultSuccess(); R_SUCCEED();
} }
} }

View File

@ -56,7 +56,7 @@ namespace ams::kern {
this->NotifyAvailable(); this->NotifyAvailable();
} }
return ResultSuccess(); R_SUCCEED();
} }
Result KReadableEvent::Reset() { Result KReadableEvent::Reset() {
@ -67,7 +67,7 @@ namespace ams::kern {
R_UNLESS(m_is_signaled, svc::ResultInvalidState()); R_UNLESS(m_is_signaled, svc::ResultInvalidState());
m_is_signaled = false; m_is_signaled = false;
return ResultSuccess(); R_SUCCEED();
} }
} }

View File

@ -108,7 +108,7 @@ namespace ams::kern {
m_limit_values[which] = value; m_limit_values[which] = value;
m_peak_values[which] = m_current_values[which]; m_peak_values[which] = m_current_values[which];
return ResultSuccess(); R_SUCCEED();
} }
void KResourceLimit::Add(ams::svc::LimitableResource which, s64 value) { void KResourceLimit::Add(ams::svc::LimitableResource which, s64 value) {

View File

@ -40,22 +40,22 @@ namespace ams::kern {
/* Set the mapping. */ /* Set the mapping. */
mapping->Set(client, server, size, state); mapping->Set(client, server, size, state);
return ResultSuccess(); R_SUCCEED();
} }
Result KSessionRequest::SessionMappings::PushSend(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) { Result KSessionRequest::SessionMappings::PushSend(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) {
MESOSPHERE_ASSERT(m_num_recv == 0); MESOSPHERE_ASSERT(m_num_recv == 0);
MESOSPHERE_ASSERT(m_num_exch == 0); MESOSPHERE_ASSERT(m_num_exch == 0);
return this->PushMap(client, server, size, state, m_num_send++); R_RETURN(this->PushMap(client, server, size, state, m_num_send++));
} }
Result KSessionRequest::SessionMappings::PushReceive(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) { Result KSessionRequest::SessionMappings::PushReceive(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) {
MESOSPHERE_ASSERT(m_num_exch == 0); MESOSPHERE_ASSERT(m_num_exch == 0);
return this->PushMap(client, server, size, state, m_num_send + m_num_recv++); R_RETURN(this->PushMap(client, server, size, state, m_num_send + m_num_recv++));
} }
Result KSessionRequest::SessionMappings::PushExchange(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) { Result KSessionRequest::SessionMappings::PushExchange(KProcessAddress client, KProcessAddress server, size_t size, KMemoryState state) {
return this->PushMap(client, server, size, state, m_num_send + m_num_recv + m_num_exch++); R_RETURN(this->PushMap(client, server, size, state, m_num_send + m_num_recv + m_num_exch++));
} }
void KSessionRequest::SessionMappings::Finalize() { void KSessionRequest::SessionMappings::Finalize() {

View File

@ -54,7 +54,7 @@ namespace ams::kern {
std::memset(GetVoidPointer(KMemoryLayout::GetLinearVirtualAddress(block.GetAddress())), 0, block.GetSize()); std::memset(GetVoidPointer(KMemoryLayout::GetLinearVirtualAddress(block.GetAddress())), 0, block.GetSize());
} }
return ResultSuccess(); R_SUCCEED();
} }
void KSharedMemory::Finalize() { void KSharedMemory::Finalize() {
@ -88,7 +88,7 @@ namespace ams::kern {
} }
/* Map the memory. */ /* Map the memory. */
return table->MapPageGroup(address, m_page_group, KMemoryState_Shared, ConvertToKMemoryPermission(map_perm)); R_RETURN(table->MapPageGroup(address, m_page_group, KMemoryState_Shared, ConvertToKMemoryPermission(map_perm)));
} }
Result KSharedMemory::Unmap(KProcessPageTable *table, KProcessAddress address, size_t size, KProcess *process) { Result KSharedMemory::Unmap(KProcessPageTable *table, KProcessAddress address, size_t size, KProcess *process) {
@ -99,7 +99,7 @@ namespace ams::kern {
R_UNLESS(m_page_group.GetNumPages() == util::DivideUp(size, PageSize), svc::ResultInvalidSize()); R_UNLESS(m_page_group.GetNumPages() == util::DivideUp(size, PageSize), svc::ResultInvalidSize());
/* Unmap the memory. */ /* Unmap the memory. */
return table->UnmapPageGroup(address, m_page_group, KMemoryState_Shared); R_RETURN(table->UnmapPageGroup(address, m_page_group, KMemoryState_Shared));
} }
} }

View File

@ -103,7 +103,7 @@ namespace ams::kern {
/* Check if the thread should terminate. */ /* Check if the thread should terminate. */
if (thread->IsTerminationRequested()) { if (thread->IsTerminationRequested()) {
slp.CancelSleep(); slp.CancelSleep();
return svc::ResultTerminationRequested(); R_THROW(svc::ResultTerminationRequested());
} }
/* Check if any of the objects are already signaled. */ /* Check if any of the objects are already signaled. */
@ -113,21 +113,21 @@ namespace ams::kern {
if (objects[i]->IsSignaled()) { if (objects[i]->IsSignaled()) {
*out_index = i; *out_index = i;
slp.CancelSleep(); slp.CancelSleep();
return ResultSuccess(); R_SUCCEED();
} }
} }
/* Check if the timeout is zero. */ /* Check if the timeout is zero. */
if (timeout == 0) { if (timeout == 0) {
slp.CancelSleep(); slp.CancelSleep();
return svc::ResultTimedOut(); R_THROW(svc::ResultTimedOut());
} }
/* Check if waiting was canceled. */ /* Check if waiting was canceled. */
if (thread->IsWaitCancelled()) { if (thread->IsWaitCancelled()) {
slp.CancelSleep(); slp.CancelSleep();
thread->ClearWaitCancelled(); thread->ClearWaitCancelled();
return svc::ResultCancelled(); R_THROW(svc::ResultCancelled());
} }
/* Add the waiters. */ /* Add the waiters. */
@ -153,7 +153,7 @@ namespace ams::kern {
*out_index = thread->GetSyncedIndex(); *out_index = thread->GetSyncedIndex();
/* Get the wait result. */ /* Get the wait result. */
return thread->GetWaitResult(); R_RETURN(thread->GetWaitResult());
} }
void KSynchronizationObject::NotifyAvailable(Result result) { void KSynchronizationObject::NotifyAvailable(Result result) {

View File

@ -177,7 +177,7 @@ namespace ams::kern {
Result KSystemControlBase::ReadWriteRegister(u32 *out, ams::svc::PhysicalAddress address, u32 mask, u32 value) { Result KSystemControlBase::ReadWriteRegister(u32 *out, ams::svc::PhysicalAddress address, u32 mask, u32 value) {
MESOSPHERE_UNUSED(out, address, mask, value); MESOSPHERE_UNUSED(out, address, mask, value);
return svc::ResultNotImplemented(); R_THROW(svc::ResultNotImplemented());
} }
/* Randomness. */ /* Randomness. */
@ -278,7 +278,7 @@ namespace ams::kern {
R_UNLESS(paddr != Null<KPhysicalAddress>, svc::ResultOutOfMemory()); R_UNLESS(paddr != Null<KPhysicalAddress>, svc::ResultOutOfMemory());
*out = KPageTable::GetHeapVirtualAddress(paddr); *out = KPageTable::GetHeapVirtualAddress(paddr);
return ResultSuccess(); R_SUCCEED();
} }
void KSystemControlBase::FreeSecureMemory(KVirtualAddress address, size_t size, u32 pool) { void KSystemControlBase::FreeSecureMemory(KVirtualAddress address, size_t size, u32 pool) {

View File

@ -41,7 +41,7 @@ namespace ams::kern {
/* We succeeded. */ /* We succeeded. */
pg_guard.Cancel(); pg_guard.Cancel();
return ResultSuccess(); R_SUCCEED();
} }
void KTransferMemory::Finalize() { void KTransferMemory::Finalize() {
@ -86,7 +86,7 @@ namespace ams::kern {
/* Mark ourselves as mapped. */ /* Mark ourselves as mapped. */
m_is_mapped = true; m_is_mapped = true;
return ResultSuccess(); R_SUCCEED();
} }
Result KTransferMemory::Unmap(KProcessAddress address, size_t size) { Result KTransferMemory::Unmap(KProcessAddress address, size_t size) {
@ -106,7 +106,7 @@ namespace ams::kern {
MESOSPHERE_ASSERT(m_is_mapped); MESOSPHERE_ASSERT(m_is_mapped);
m_is_mapped = false; m_is_mapped = false;
return ResultSuccess(); R_SUCCEED();
} }
} }

View File

@ -61,7 +61,7 @@ namespace ams::kern {
/* Check that the thread isn't terminating. */ /* Check that the thread isn't terminating. */
if (cur_thread->IsTerminationRequested()) { if (cur_thread->IsTerminationRequested()) {
slp.CancelSleep(); slp.CancelSleep();
return svc::ResultTerminationRequested(); R_THROW(svc::ResultTerminationRequested());
} }
/* Handle the case where timeout is non-negative/infinite. */ /* Handle the case where timeout is non-negative/infinite. */
@ -69,7 +69,7 @@ namespace ams::kern {
/* Check if we're already waiting. */ /* Check if we're already waiting. */
if (m_next_thread != nullptr) { if (m_next_thread != nullptr) {
slp.CancelSleep(); slp.CancelSleep();
return svc::ResultBusy(); R_THROW(svc::ResultBusy());
} }
/* If timeout is zero, handle the special case by canceling all waiting threads. */ /* If timeout is zero, handle the special case by canceling all waiting threads. */
@ -79,7 +79,7 @@ namespace ams::kern {
} }
slp.CancelSleep(); slp.CancelSleep();
return ResultSuccess(); R_SUCCEED();
} }
} }
@ -96,7 +96,7 @@ namespace ams::kern {
cur_thread->BeginWait(std::addressof(wait_queue)); cur_thread->BeginWait(std::addressof(wait_queue));
} }
return ResultSuccess(); R_SUCCEED();
} }
} }

View File

@ -56,7 +56,7 @@ namespace ams::kern::svc {
/* Set the activity. */ /* Set the activity. */
R_TRY(thread->SetActivity(thread_activity)); R_TRY(thread->SetActivity(thread_activity));
return ResultSuccess(); R_SUCCEED();
} }
Result SetProcessActivity(ams::svc::Handle process_handle, ams::svc::ProcessActivity process_activity) { Result SetProcessActivity(ams::svc::Handle process_handle, ams::svc::ProcessActivity process_activity) {
@ -73,7 +73,7 @@ namespace ams::kern::svc {
/* Set the activity. */ /* Set the activity. */
R_TRY(process->SetActivity(process_activity)); R_TRY(process->SetActivity(process_activity));
return ResultSuccess(); R_SUCCEED();
} }
} }
@ -81,21 +81,21 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result SetThreadActivity64(ams::svc::Handle thread_handle, ams::svc::ThreadActivity thread_activity) { Result SetThreadActivity64(ams::svc::Handle thread_handle, ams::svc::ThreadActivity thread_activity) {
return SetThreadActivity(thread_handle, thread_activity); R_RETURN(SetThreadActivity(thread_handle, thread_activity));
} }
Result SetProcessActivity64(ams::svc::Handle process_handle, ams::svc::ProcessActivity process_activity) { Result SetProcessActivity64(ams::svc::Handle process_handle, ams::svc::ProcessActivity process_activity) {
return SetProcessActivity(process_handle, process_activity); R_RETURN(SetProcessActivity(process_handle, process_activity));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result SetThreadActivity64From32(ams::svc::Handle thread_handle, ams::svc::ThreadActivity thread_activity) { Result SetThreadActivity64From32(ams::svc::Handle thread_handle, ams::svc::ThreadActivity thread_activity) {
return SetThreadActivity(thread_handle, thread_activity); R_RETURN(SetThreadActivity(thread_handle, thread_activity));
} }
Result SetProcessActivity64From32(ams::svc::Handle process_handle, ams::svc::ProcessActivity process_activity) { Result SetProcessActivity64From32(ams::svc::Handle process_handle, ams::svc::ProcessActivity process_activity) {
return SetProcessActivity(process_handle, process_activity); R_RETURN(SetProcessActivity(process_handle, process_activity));
} }
} }

View File

@ -69,7 +69,7 @@ namespace ams::kern::svc {
timeout = timeout_ns; timeout = timeout_ns;
} }
return GetCurrentProcess().WaitAddressArbiter(address, arb_type, value, timeout); R_RETURN(GetCurrentProcess().WaitAddressArbiter(address, arb_type, value, timeout));
} }
Result SignalToAddress(uintptr_t address, ams::svc::SignalType signal_type, int32_t value, int32_t count) { Result SignalToAddress(uintptr_t address, ams::svc::SignalType signal_type, int32_t value, int32_t count) {
@ -78,7 +78,7 @@ namespace ams::kern::svc {
R_UNLESS(util::IsAligned(address, sizeof(int32_t)), svc::ResultInvalidAddress()); R_UNLESS(util::IsAligned(address, sizeof(int32_t)), svc::ResultInvalidAddress());
R_UNLESS(IsValidSignalType(signal_type), svc::ResultInvalidEnumValue()); R_UNLESS(IsValidSignalType(signal_type), svc::ResultInvalidEnumValue());
return GetCurrentProcess().SignalAddressArbiter(address, signal_type, value, count); R_RETURN(GetCurrentProcess().SignalAddressArbiter(address, signal_type, value, count));
} }
} }
@ -86,21 +86,21 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result WaitForAddress64(ams::svc::Address address, ams::svc::ArbitrationType arb_type, int32_t value, int64_t timeout_ns) { Result WaitForAddress64(ams::svc::Address address, ams::svc::ArbitrationType arb_type, int32_t value, int64_t timeout_ns) {
return WaitForAddress(address, arb_type, value, timeout_ns); R_RETURN(WaitForAddress(address, arb_type, value, timeout_ns));
} }
Result SignalToAddress64(ams::svc::Address address, ams::svc::SignalType signal_type, int32_t value, int32_t count) { Result SignalToAddress64(ams::svc::Address address, ams::svc::SignalType signal_type, int32_t value, int32_t count) {
return SignalToAddress(address, signal_type, value, count); R_RETURN(SignalToAddress(address, signal_type, value, count));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result WaitForAddress64From32(ams::svc::Address address, ams::svc::ArbitrationType arb_type, int32_t value, int64_t timeout_ns) { Result WaitForAddress64From32(ams::svc::Address address, ams::svc::ArbitrationType arb_type, int32_t value, int64_t timeout_ns) {
return WaitForAddress(address, arb_type, value, timeout_ns); R_RETURN(WaitForAddress(address, arb_type, value, timeout_ns));
} }
Result SignalToAddress64From32(ams::svc::Address address, ams::svc::SignalType signal_type, int32_t value, int32_t count) { Result SignalToAddress64From32(ams::svc::Address address, ams::svc::SignalType signal_type, int32_t value, int32_t count) {
return SignalToAddress(address, signal_type, value, count); R_RETURN(SignalToAddress(address, signal_type, value, count));
} }
} }

View File

@ -34,7 +34,7 @@ namespace ams::kern::svc {
/* Query the physical mapping. */ /* Query the physical mapping. */
R_TRY(pt.QueryPhysicalAddress(out_info, address)); R_TRY(pt.QueryPhysicalAddress(out_info, address));
return ResultSuccess(); R_SUCCEED();
} }
Result QueryIoMapping(uintptr_t *out_address, size_t *out_size, uint64_t phys_addr, size_t size) { Result QueryIoMapping(uintptr_t *out_address, size_t *out_size, uint64_t phys_addr, size_t size) {
@ -61,7 +61,7 @@ namespace ams::kern::svc {
/* Use the size as the found size. */ /* Use the size as the found size. */
found_size = size; found_size = size;
return ResultSuccess(); R_SUCCEED();
}; };
if (aligned) { if (aligned) {
@ -109,7 +109,7 @@ namespace ams::kern::svc {
if (out_size != nullptr) { if (out_size != nullptr) {
*out_size = found_size; *out_size = found_size;
} }
return ResultSuccess(); R_SUCCEED();
} }
} }
@ -117,18 +117,18 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result QueryPhysicalAddress64(ams::svc::lp64::PhysicalMemoryInfo *out_info, ams::svc::Address address) { Result QueryPhysicalAddress64(ams::svc::lp64::PhysicalMemoryInfo *out_info, ams::svc::Address address) {
return QueryPhysicalAddress(out_info, address); R_RETURN(QueryPhysicalAddress(out_info, address));
} }
Result QueryIoMapping64(ams::svc::Address *out_address, ams::svc::Size *out_size, ams::svc::PhysicalAddress physical_address, ams::svc::Size size) { Result QueryIoMapping64(ams::svc::Address *out_address, ams::svc::Size *out_size, ams::svc::PhysicalAddress physical_address, ams::svc::Size size) {
static_assert(sizeof(*out_address) == sizeof(uintptr_t)); static_assert(sizeof(*out_address) == sizeof(uintptr_t));
static_assert(sizeof(*out_size) == sizeof(size_t)); static_assert(sizeof(*out_size) == sizeof(size_t));
return QueryIoMapping(reinterpret_cast<uintptr_t *>(out_address), reinterpret_cast<size_t *>(out_size), physical_address, size); R_RETURN(QueryIoMapping(reinterpret_cast<uintptr_t *>(out_address), reinterpret_cast<size_t *>(out_size), physical_address, size));
} }
Result LegacyQueryIoMapping64(ams::svc::Address *out_address, ams::svc::PhysicalAddress physical_address, ams::svc::Size size) { Result LegacyQueryIoMapping64(ams::svc::Address *out_address, ams::svc::PhysicalAddress physical_address, ams::svc::Size size) {
static_assert(sizeof(*out_address) == sizeof(uintptr_t)); static_assert(sizeof(*out_address) == sizeof(uintptr_t));
return QueryIoMapping(reinterpret_cast<uintptr_t *>(out_address), nullptr, physical_address, size); R_RETURN(QueryIoMapping(reinterpret_cast<uintptr_t *>(out_address), nullptr, physical_address, size));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
@ -142,18 +142,18 @@ namespace ams::kern::svc {
.virtual_address = static_cast<u32>(info.virtual_address), .virtual_address = static_cast<u32>(info.virtual_address),
.size = static_cast<u32>(info.size), .size = static_cast<u32>(info.size),
}; };
return ResultSuccess(); R_SUCCEED();
} }
Result QueryIoMapping64From32(ams::svc::Address *out_address, ams::svc::Size *out_size, ams::svc::PhysicalAddress physical_address, ams::svc::Size size) { Result QueryIoMapping64From32(ams::svc::Address *out_address, ams::svc::Size *out_size, ams::svc::PhysicalAddress physical_address, ams::svc::Size size) {
static_assert(sizeof(*out_address) == sizeof(uintptr_t)); static_assert(sizeof(*out_address) == sizeof(uintptr_t));
static_assert(sizeof(*out_size) == sizeof(size_t)); static_assert(sizeof(*out_size) == sizeof(size_t));
return QueryIoMapping(reinterpret_cast<uintptr_t *>(out_address), reinterpret_cast<size_t *>(out_size), physical_address, size); R_RETURN(QueryIoMapping(reinterpret_cast<uintptr_t *>(out_address), reinterpret_cast<size_t *>(out_size), physical_address, size));
} }
Result LegacyQueryIoMapping64From32(ams::svc::Address *out_address, ams::svc::PhysicalAddress physical_address, ams::svc::Size size) { Result LegacyQueryIoMapping64From32(ams::svc::Address *out_address, ams::svc::PhysicalAddress physical_address, ams::svc::Size size) {
static_assert(sizeof(*out_address) == sizeof(uintptr_t)); static_assert(sizeof(*out_address) == sizeof(uintptr_t));
return QueryIoMapping(reinterpret_cast<uintptr_t *>(out_address), nullptr, physical_address, size); R_RETURN(QueryIoMapping(reinterpret_cast<uintptr_t *>(out_address), nullptr, physical_address, size));
} }
} }

View File

@ -62,7 +62,7 @@ namespace ams::kern::svc {
} }
MESOSPHERE_ASSERT(remaining == 0); MESOSPHERE_ASSERT(remaining == 0);
return ResultSuccess(); R_SUCCEED();
} }
void FlushEntireDataCache() { void FlushEntireDataCache() {
@ -88,7 +88,7 @@ namespace ams::kern::svc {
/* Flush the cache. */ /* Flush the cache. */
R_TRY(cpu::FlushDataCache(reinterpret_cast<void *>(address), size)); R_TRY(cpu::FlushDataCache(reinterpret_cast<void *>(address), size));
return ResultSuccess(); R_SUCCEED();
} }
Result InvalidateProcessDataCache(ams::svc::Handle process_handle, uint64_t address, uint64_t size) { Result InvalidateProcessDataCache(ams::svc::Handle process_handle, uint64_t address, uint64_t size) {
@ -104,7 +104,7 @@ namespace ams::kern::svc {
/* Invalidate the cache. */ /* Invalidate the cache. */
R_TRY(process->GetPageTable().InvalidateProcessDataCache(address, size)); R_TRY(process->GetPageTable().InvalidateProcessDataCache(address, size));
return ResultSuccess(); R_SUCCEED();
} }
Result StoreProcessDataCache(ams::svc::Handle process_handle, uint64_t address, uint64_t size) { Result StoreProcessDataCache(ams::svc::Handle process_handle, uint64_t address, uint64_t size) {
@ -123,14 +123,14 @@ namespace ams::kern::svc {
/* Perform the operation. */ /* Perform the operation. */
if (process.GetPointerUnsafe() == GetCurrentProcessPointer()) { if (process.GetPointerUnsafe() == GetCurrentProcessPointer()) {
return cpu::StoreDataCache(reinterpret_cast<void *>(address), size); R_RETURN(cpu::StoreDataCache(reinterpret_cast<void *>(address), size));
} else { } else {
class StoreCacheOperation : public CacheOperation { class StoreCacheOperation : public CacheOperation {
public: public:
virtual void Operate(void *address, size_t size) const override { cpu::StoreDataCache(address, size); } virtual void Operate(void *address, size_t size) const override { cpu::StoreDataCache(address, size); }
} operation; } operation;
return DoProcessCacheOperation(operation, page_table, address, size); R_RETURN(DoProcessCacheOperation(operation, page_table, address, size));
} }
} }
@ -150,14 +150,14 @@ namespace ams::kern::svc {
/* Perform the operation. */ /* Perform the operation. */
if (process.GetPointerUnsafe() == GetCurrentProcessPointer()) { if (process.GetPointerUnsafe() == GetCurrentProcessPointer()) {
return cpu::FlushDataCache(reinterpret_cast<void *>(address), size); R_RETURN(cpu::FlushDataCache(reinterpret_cast<void *>(address), size));
} else { } else {
class FlushCacheOperation : public CacheOperation { class FlushCacheOperation : public CacheOperation {
public: public:
virtual void Operate(void *address, size_t size) const override { cpu::FlushDataCache(address, size); } virtual void Operate(void *address, size_t size) const override { cpu::FlushDataCache(address, size); }
} operation; } operation;
return DoProcessCacheOperation(operation, page_table, address, size); R_RETURN(DoProcessCacheOperation(operation, page_table, address, size));
} }
} }
@ -170,19 +170,19 @@ namespace ams::kern::svc {
} }
Result FlushDataCache64(ams::svc::Address address, ams::svc::Size size) { Result FlushDataCache64(ams::svc::Address address, ams::svc::Size size) {
return FlushDataCache(address, size); R_RETURN(FlushDataCache(address, size));
} }
Result InvalidateProcessDataCache64(ams::svc::Handle process_handle, uint64_t address, uint64_t size) { Result InvalidateProcessDataCache64(ams::svc::Handle process_handle, uint64_t address, uint64_t size) {
return InvalidateProcessDataCache(process_handle, address, size); R_RETURN(InvalidateProcessDataCache(process_handle, address, size));
} }
Result StoreProcessDataCache64(ams::svc::Handle process_handle, uint64_t address, uint64_t size) { Result StoreProcessDataCache64(ams::svc::Handle process_handle, uint64_t address, uint64_t size) {
return StoreProcessDataCache(process_handle, address, size); R_RETURN(StoreProcessDataCache(process_handle, address, size));
} }
Result FlushProcessDataCache64(ams::svc::Handle process_handle, uint64_t address, uint64_t size) { Result FlushProcessDataCache64(ams::svc::Handle process_handle, uint64_t address, uint64_t size) {
return FlushProcessDataCache(process_handle, address, size); R_RETURN(FlushProcessDataCache(process_handle, address, size));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
@ -192,19 +192,19 @@ namespace ams::kern::svc {
} }
Result FlushDataCache64From32(ams::svc::Address address, ams::svc::Size size) { Result FlushDataCache64From32(ams::svc::Address address, ams::svc::Size size) {
return FlushDataCache(address, size); R_RETURN(FlushDataCache(address, size));
} }
Result InvalidateProcessDataCache64From32(ams::svc::Handle process_handle, uint64_t address, uint64_t size) { Result InvalidateProcessDataCache64From32(ams::svc::Handle process_handle, uint64_t address, uint64_t size) {
return InvalidateProcessDataCache(process_handle, address, size); R_RETURN(InvalidateProcessDataCache(process_handle, address, size));
} }
Result StoreProcessDataCache64From32(ams::svc::Handle process_handle, uint64_t address, uint64_t size) { Result StoreProcessDataCache64From32(ams::svc::Handle process_handle, uint64_t address, uint64_t size) {
return StoreProcessDataCache(process_handle, address, size); R_RETURN(StoreProcessDataCache(process_handle, address, size));
} }
Result FlushProcessDataCache64From32(ams::svc::Handle process_handle, uint64_t address, uint64_t size) { Result FlushProcessDataCache64From32(ams::svc::Handle process_handle, uint64_t address, uint64_t size) {
return FlushProcessDataCache(process_handle, address, size); R_RETURN(FlushProcessDataCache(process_handle, address, size));
} }
} }

View File

@ -61,7 +61,7 @@ namespace ams::kern::svc {
/* Add the code memory to the handle table. */ /* Add the code memory to the handle table. */
R_TRY(GetCurrentProcess().GetHandleTable().Add(out, code_mem)); R_TRY(GetCurrentProcess().GetHandleTable().Add(out, code_mem));
return ResultSuccess(); R_SUCCEED();
} }
Result ControlCodeMemory(ams::svc::Handle code_memory_handle, ams::svc::CodeMemoryOperation operation, uint64_t address, uint64_t size, ams::svc::MemoryPermission perm) { Result ControlCodeMemory(ams::svc::Handle code_memory_handle, ams::svc::CodeMemoryOperation operation, uint64_t address, uint64_t size, ams::svc::MemoryPermission perm) {
@ -132,10 +132,10 @@ namespace ams::kern::svc {
} }
break; break;
default: default:
return svc::ResultInvalidEnumValue(); R_THROW(svc::ResultInvalidEnumValue());
} }
return ResultSuccess(); R_SUCCEED();
} }
} }
@ -143,21 +143,21 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result CreateCodeMemory64(ams::svc::Handle *out_handle, ams::svc::Address address, ams::svc::Size size) { Result CreateCodeMemory64(ams::svc::Handle *out_handle, ams::svc::Address address, ams::svc::Size size) {
return CreateCodeMemory(out_handle, address, size); R_RETURN(CreateCodeMemory(out_handle, address, size));
} }
Result ControlCodeMemory64(ams::svc::Handle code_memory_handle, ams::svc::CodeMemoryOperation operation, uint64_t address, uint64_t size, ams::svc::MemoryPermission perm) { Result ControlCodeMemory64(ams::svc::Handle code_memory_handle, ams::svc::CodeMemoryOperation operation, uint64_t address, uint64_t size, ams::svc::MemoryPermission perm) {
return ControlCodeMemory(code_memory_handle, operation, address, size, perm); R_RETURN(ControlCodeMemory(code_memory_handle, operation, address, size, perm));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result CreateCodeMemory64From32(ams::svc::Handle *out_handle, ams::svc::Address address, ams::svc::Size size) { Result CreateCodeMemory64From32(ams::svc::Handle *out_handle, ams::svc::Address address, ams::svc::Size size) {
return CreateCodeMemory(out_handle, address, size); R_RETURN(CreateCodeMemory(out_handle, address, size));
} }
Result ControlCodeMemory64From32(ams::svc::Handle code_memory_handle, ams::svc::CodeMemoryOperation operation, uint64_t address, uint64_t size, ams::svc::MemoryPermission perm) { Result ControlCodeMemory64From32(ams::svc::Handle code_memory_handle, ams::svc::CodeMemoryOperation operation, uint64_t address, uint64_t size, ams::svc::MemoryPermission perm) {
return ControlCodeMemory(code_memory_handle, operation, address, size, perm); R_RETURN(ControlCodeMemory(code_memory_handle, operation, address, size, perm));
} }
} }

View File

@ -47,7 +47,7 @@ namespace ams::kern::svc {
} }
/* Wait on the condition variable. */ /* Wait on the condition variable. */
return GetCurrentProcess().WaitConditionVariable(address, util::AlignDown(cv_key, sizeof(u32)), tag, timeout); R_RETURN(GetCurrentProcess().WaitConditionVariable(address, util::AlignDown(cv_key, sizeof(u32)), tag, timeout));
} }
void SignalProcessWideKey(uintptr_t cv_key, int32_t count) { void SignalProcessWideKey(uintptr_t cv_key, int32_t count) {
@ -60,7 +60,7 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result WaitProcessWideKeyAtomic64(ams::svc::Address address, ams::svc::Address cv_key, uint32_t tag, int64_t timeout_ns) { Result WaitProcessWideKeyAtomic64(ams::svc::Address address, ams::svc::Address cv_key, uint32_t tag, int64_t timeout_ns) {
return WaitProcessWideKeyAtomic(address, cv_key, tag, timeout_ns); R_RETURN(WaitProcessWideKeyAtomic(address, cv_key, tag, timeout_ns));
} }
void SignalProcessWideKey64(ams::svc::Address cv_key, int32_t count) { void SignalProcessWideKey64(ams::svc::Address cv_key, int32_t count) {
@ -70,7 +70,7 @@ namespace ams::kern::svc {
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result WaitProcessWideKeyAtomic64From32(ams::svc::Address address, ams::svc::Address cv_key, uint32_t tag, int64_t timeout_ns) { Result WaitProcessWideKeyAtomic64From32(ams::svc::Address address, ams::svc::Address cv_key, uint32_t tag, int64_t timeout_ns) {
return WaitProcessWideKeyAtomic(address, cv_key, tag, timeout_ns); R_RETURN(WaitProcessWideKeyAtomic(address, cv_key, tag, timeout_ns));
} }
void SignalProcessWideKey64From32(ams::svc::Address cv_key, int32_t count) { void SignalProcessWideKey64From32(ams::svc::Address cv_key, int32_t count) {

View File

@ -59,7 +59,7 @@ namespace ams::kern::svc {
/* Add the new debug object to the handle table. */ /* Add the new debug object to the handle table. */
R_TRY(handle_table.Add(out_handle, debug)); R_TRY(handle_table.Add(out_handle, debug));
return ResultSuccess(); R_SUCCEED();
} }
Result BreakDebugProcess(ams::svc::Handle debug_handle) { Result BreakDebugProcess(ams::svc::Handle debug_handle) {
@ -73,7 +73,7 @@ namespace ams::kern::svc {
/* Break the process. */ /* Break the process. */
R_TRY(debug->BreakProcess()); R_TRY(debug->BreakProcess());
return ResultSuccess(); R_SUCCEED();
} }
Result TerminateDebugProcess(ams::svc::Handle debug_handle) { Result TerminateDebugProcess(ams::svc::Handle debug_handle) {
@ -87,7 +87,7 @@ namespace ams::kern::svc {
/* Terminate the process. */ /* Terminate the process. */
R_TRY(debug->TerminateProcess()); R_TRY(debug->TerminateProcess());
return ResultSuccess(); R_SUCCEED();
} }
template<typename EventInfoType> template<typename EventInfoType>
@ -106,7 +106,7 @@ namespace ams::kern::svc {
/* Copy the info out to the user. */ /* Copy the info out to the user. */
R_TRY(out_info.CopyFrom(std::addressof(info))); R_TRY(out_info.CopyFrom(std::addressof(info)));
return ResultSuccess(); R_SUCCEED();
} }
Result ContinueDebugEventImpl(ams::svc::Handle debug_handle, uint32_t flags, const uint64_t *thread_ids, int32_t num_thread_ids) { Result ContinueDebugEventImpl(ams::svc::Handle debug_handle, uint32_t flags, const uint64_t *thread_ids, int32_t num_thread_ids) {
@ -117,7 +117,7 @@ namespace ams::kern::svc {
/* Continue the event. */ /* Continue the event. */
R_TRY(debug->ContinueDebug(flags, thread_ids, num_thread_ids)); R_TRY(debug->ContinueDebug(flags, thread_ids, num_thread_ids));
return ResultSuccess(); R_SUCCEED();
} }
Result ContinueDebugEvent(ams::svc::Handle debug_handle, uint32_t flags, KUserPointer<const uint64_t *> user_thread_ids, int32_t num_thread_ids) { Result ContinueDebugEvent(ams::svc::Handle debug_handle, uint32_t flags, KUserPointer<const uint64_t *> user_thread_ids, int32_t num_thread_ids) {
@ -143,7 +143,7 @@ namespace ams::kern::svc {
/* Continue the event. */ /* Continue the event. */
R_TRY(ContinueDebugEventImpl(debug_handle, flags, thread_ids, num_thread_ids)); R_TRY(ContinueDebugEventImpl(debug_handle, flags, thread_ids, num_thread_ids));
return ResultSuccess(); R_SUCCEED();
} }
Result LegacyContinueDebugEvent(ams::svc::Handle debug_handle, uint32_t flags, uint64_t thread_id) { Result LegacyContinueDebugEvent(ams::svc::Handle debug_handle, uint32_t flags, uint64_t thread_id) {
@ -160,7 +160,7 @@ namespace ams::kern::svc {
/* Continue the event. */ /* Continue the event. */
R_TRY(ContinueDebugEventImpl(debug_handle, flags, std::addressof(thread_id), 1)); R_TRY(ContinueDebugEventImpl(debug_handle, flags, std::addressof(thread_id), 1));
return ResultSuccess(); R_SUCCEED();
} }
Result GetDebugThreadContext(KUserPointer<ams::svc::ThreadContext *> out_context, ams::svc::Handle debug_handle, uint64_t thread_id, uint32_t context_flags) { Result GetDebugThreadContext(KUserPointer<ams::svc::ThreadContext *> out_context, ams::svc::Handle debug_handle, uint64_t thread_id, uint32_t context_flags) {
@ -178,7 +178,7 @@ namespace ams::kern::svc {
/* Copy the context to userspace. */ /* Copy the context to userspace. */
R_TRY(out_context.CopyFrom(std::addressof(context))); R_TRY(out_context.CopyFrom(std::addressof(context)));
return ResultSuccess(); R_SUCCEED();
} }
Result SetDebugThreadContext(ams::svc::Handle debug_handle, uint64_t thread_id, KUserPointer<const ams::svc::ThreadContext *> user_context, uint32_t context_flags) { Result SetDebugThreadContext(ams::svc::Handle debug_handle, uint64_t thread_id, KUserPointer<const ams::svc::ThreadContext *> user_context, uint32_t context_flags) {
@ -216,7 +216,7 @@ namespace ams::kern::svc {
/* Set the thread context. */ /* Set the thread context. */
R_TRY(debug->SetThreadContext(context, thread_id, context_flags)); R_TRY(debug->SetThreadContext(context, thread_id, context_flags));
return ResultSuccess(); R_SUCCEED();
} }
Result QueryDebugProcessMemory(ams::svc::MemoryInfo *out_memory_info, ams::svc::PageInfo *out_page_info, ams::svc::Handle debug_handle, uintptr_t address) { Result QueryDebugProcessMemory(ams::svc::MemoryInfo *out_memory_info, ams::svc::PageInfo *out_page_info, ams::svc::Handle debug_handle, uintptr_t address) {
@ -227,7 +227,7 @@ namespace ams::kern::svc {
/* Query the mapping's info. */ /* Query the mapping's info. */
R_TRY(debug->QueryMemoryInfo(out_memory_info, out_page_info, address)); R_TRY(debug->QueryMemoryInfo(out_memory_info, out_page_info, address));
return ResultSuccess(); R_SUCCEED();
} }
template<typename T> template<typename T>
@ -257,7 +257,7 @@ namespace ams::kern::svc {
R_TRY(out_memory_info.CopyFrom(std::addressof(converted_info))); R_TRY(out_memory_info.CopyFrom(std::addressof(converted_info)));
} }
return ResultSuccess(); R_SUCCEED();
} }
Result ReadDebugProcessMemory(uintptr_t buffer, ams::svc::Handle debug_handle, uintptr_t address, size_t size) { Result ReadDebugProcessMemory(uintptr_t buffer, ams::svc::Handle debug_handle, uintptr_t address, size_t size) {
@ -273,7 +273,7 @@ namespace ams::kern::svc {
/* Read the memory. */ /* Read the memory. */
R_TRY(debug->ReadMemory(buffer, address, size)); R_TRY(debug->ReadMemory(buffer, address, size));
return ResultSuccess(); R_SUCCEED();
} }
Result WriteDebugProcessMemory(ams::svc::Handle debug_handle, uintptr_t buffer, uintptr_t address, size_t size) { Result WriteDebugProcessMemory(ams::svc::Handle debug_handle, uintptr_t buffer, uintptr_t address, size_t size) {
@ -292,7 +292,7 @@ namespace ams::kern::svc {
/* Write the memory. */ /* Write the memory. */
R_TRY(debug->WriteMemory(buffer, address, size)); R_TRY(debug->WriteMemory(buffer, address, size));
return ResultSuccess(); R_SUCCEED();
} }
Result SetHardwareBreakPoint(ams::svc::HardwareBreakPointRegisterName name, uint64_t flags, uint64_t value) { Result SetHardwareBreakPoint(ams::svc::HardwareBreakPointRegisterName name, uint64_t flags, uint64_t value) {
@ -302,7 +302,7 @@ namespace ams::kern::svc {
/* Set the breakpoint. */ /* Set the breakpoint. */
R_TRY(KDebug::SetHardwareBreakPoint(name, flags, value)); R_TRY(KDebug::SetHardwareBreakPoint(name, flags, value));
return ResultSuccess(); R_SUCCEED();
} }
Result GetDebugThreadParam(uint64_t *out_64, uint32_t *out_32, ams::svc::Handle debug_handle, uint64_t thread_id, ams::svc::DebugThreadParam param) { Result GetDebugThreadParam(uint64_t *out_64, uint32_t *out_32, ams::svc::Handle debug_handle, uint64_t thread_id, ams::svc::DebugThreadParam param) {
@ -382,7 +382,7 @@ namespace ams::kern::svc {
} }
break; break;
default: default:
return svc::ResultInvalidState(); R_THROW(svc::ResultInvalidState());
} }
} }
break; break;
@ -413,10 +413,10 @@ namespace ams::kern::svc {
} }
break; break;
default: default:
return ams::svc::ResultInvalidEnumValue(); R_THROW(ams::svc::ResultInvalidEnumValue());
} }
return ResultSuccess(); R_SUCCEED();
} }
} }
@ -424,109 +424,109 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result DebugActiveProcess64(ams::svc::Handle *out_handle, uint64_t process_id) { Result DebugActiveProcess64(ams::svc::Handle *out_handle, uint64_t process_id) {
return DebugActiveProcess(out_handle, process_id); R_RETURN(DebugActiveProcess(out_handle, process_id));
} }
Result BreakDebugProcess64(ams::svc::Handle debug_handle) { Result BreakDebugProcess64(ams::svc::Handle debug_handle) {
return BreakDebugProcess(debug_handle); R_RETURN(BreakDebugProcess(debug_handle));
} }
Result TerminateDebugProcess64(ams::svc::Handle debug_handle) { Result TerminateDebugProcess64(ams::svc::Handle debug_handle) {
return TerminateDebugProcess(debug_handle); R_RETURN(TerminateDebugProcess(debug_handle));
} }
Result GetDebugEvent64(KUserPointer<ams::svc::lp64::DebugEventInfo *> out_info, ams::svc::Handle debug_handle) { Result GetDebugEvent64(KUserPointer<ams::svc::lp64::DebugEventInfo *> out_info, ams::svc::Handle debug_handle) {
return GetDebugEvent(out_info, debug_handle); R_RETURN(GetDebugEvent(out_info, debug_handle));
} }
Result ContinueDebugEvent64(ams::svc::Handle debug_handle, uint32_t flags, KUserPointer<const uint64_t *> thread_ids, int32_t num_thread_ids) { Result ContinueDebugEvent64(ams::svc::Handle debug_handle, uint32_t flags, KUserPointer<const uint64_t *> thread_ids, int32_t num_thread_ids) {
return ContinueDebugEvent(debug_handle, flags, thread_ids, num_thread_ids); R_RETURN(ContinueDebugEvent(debug_handle, flags, thread_ids, num_thread_ids));
} }
Result LegacyContinueDebugEvent64(ams::svc::Handle debug_handle, uint32_t flags, uint64_t thread_id) { Result LegacyContinueDebugEvent64(ams::svc::Handle debug_handle, uint32_t flags, uint64_t thread_id) {
return LegacyContinueDebugEvent(debug_handle, flags, thread_id); R_RETURN(LegacyContinueDebugEvent(debug_handle, flags, thread_id));
} }
Result GetDebugThreadContext64(KUserPointer<ams::svc::ThreadContext *> out_context, ams::svc::Handle debug_handle, uint64_t thread_id, uint32_t context_flags) { Result GetDebugThreadContext64(KUserPointer<ams::svc::ThreadContext *> out_context, ams::svc::Handle debug_handle, uint64_t thread_id, uint32_t context_flags) {
return GetDebugThreadContext(out_context, debug_handle, thread_id, context_flags); R_RETURN(GetDebugThreadContext(out_context, debug_handle, thread_id, context_flags));
} }
Result SetDebugThreadContext64(ams::svc::Handle debug_handle, uint64_t thread_id, KUserPointer<const ams::svc::ThreadContext *> context, uint32_t context_flags) { Result SetDebugThreadContext64(ams::svc::Handle debug_handle, uint64_t thread_id, KUserPointer<const ams::svc::ThreadContext *> context, uint32_t context_flags) {
return SetDebugThreadContext(debug_handle, thread_id, context, context_flags); R_RETURN(SetDebugThreadContext(debug_handle, thread_id, context, context_flags));
} }
Result QueryDebugProcessMemory64(KUserPointer<ams::svc::lp64::MemoryInfo *> out_memory_info, ams::svc::PageInfo *out_page_info, ams::svc::Handle debug_handle, ams::svc::Address address) { Result QueryDebugProcessMemory64(KUserPointer<ams::svc::lp64::MemoryInfo *> out_memory_info, ams::svc::PageInfo *out_page_info, ams::svc::Handle debug_handle, ams::svc::Address address) {
return QueryDebugProcessMemory(out_memory_info, out_page_info, debug_handle, address); R_RETURN(QueryDebugProcessMemory(out_memory_info, out_page_info, debug_handle, address));
} }
Result ReadDebugProcessMemory64(ams::svc::Address buffer, ams::svc::Handle debug_handle, ams::svc::Address address, ams::svc::Size size) { Result ReadDebugProcessMemory64(ams::svc::Address buffer, ams::svc::Handle debug_handle, ams::svc::Address address, ams::svc::Size size) {
return ReadDebugProcessMemory(buffer, debug_handle, address, size); R_RETURN(ReadDebugProcessMemory(buffer, debug_handle, address, size));
} }
Result WriteDebugProcessMemory64(ams::svc::Handle debug_handle, ams::svc::Address buffer, ams::svc::Address address, ams::svc::Size size) { Result WriteDebugProcessMemory64(ams::svc::Handle debug_handle, ams::svc::Address buffer, ams::svc::Address address, ams::svc::Size size) {
return WriteDebugProcessMemory(debug_handle, buffer, address, size); R_RETURN(WriteDebugProcessMemory(debug_handle, buffer, address, size));
} }
Result SetHardwareBreakPoint64(ams::svc::HardwareBreakPointRegisterName name, uint64_t flags, uint64_t value) { Result SetHardwareBreakPoint64(ams::svc::HardwareBreakPointRegisterName name, uint64_t flags, uint64_t value) {
return SetHardwareBreakPoint(name, flags, value); R_RETURN(SetHardwareBreakPoint(name, flags, value));
} }
Result GetDebugThreadParam64(uint64_t *out_64, uint32_t *out_32, ams::svc::Handle debug_handle, uint64_t thread_id, ams::svc::DebugThreadParam param) { Result GetDebugThreadParam64(uint64_t *out_64, uint32_t *out_32, ams::svc::Handle debug_handle, uint64_t thread_id, ams::svc::DebugThreadParam param) {
return GetDebugThreadParam(out_64, out_32, debug_handle, thread_id, param); R_RETURN(GetDebugThreadParam(out_64, out_32, debug_handle, thread_id, param));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result DebugActiveProcess64From32(ams::svc::Handle *out_handle, uint64_t process_id) { Result DebugActiveProcess64From32(ams::svc::Handle *out_handle, uint64_t process_id) {
return DebugActiveProcess(out_handle, process_id); R_RETURN(DebugActiveProcess(out_handle, process_id));
} }
Result BreakDebugProcess64From32(ams::svc::Handle debug_handle) { Result BreakDebugProcess64From32(ams::svc::Handle debug_handle) {
return BreakDebugProcess(debug_handle); R_RETURN(BreakDebugProcess(debug_handle));
} }
Result TerminateDebugProcess64From32(ams::svc::Handle debug_handle) { Result TerminateDebugProcess64From32(ams::svc::Handle debug_handle) {
return TerminateDebugProcess(debug_handle); R_RETURN(TerminateDebugProcess(debug_handle));
} }
Result GetDebugEvent64From32(KUserPointer<ams::svc::ilp32::DebugEventInfo *> out_info, ams::svc::Handle debug_handle) { Result GetDebugEvent64From32(KUserPointer<ams::svc::ilp32::DebugEventInfo *> out_info, ams::svc::Handle debug_handle) {
return GetDebugEvent(out_info, debug_handle); R_RETURN(GetDebugEvent(out_info, debug_handle));
} }
Result ContinueDebugEvent64From32(ams::svc::Handle debug_handle, uint32_t flags, KUserPointer<const uint64_t *> thread_ids, int32_t num_thread_ids) { Result ContinueDebugEvent64From32(ams::svc::Handle debug_handle, uint32_t flags, KUserPointer<const uint64_t *> thread_ids, int32_t num_thread_ids) {
return ContinueDebugEvent(debug_handle, flags, thread_ids, num_thread_ids); R_RETURN(ContinueDebugEvent(debug_handle, flags, thread_ids, num_thread_ids));
} }
Result LegacyContinueDebugEvent64From32(ams::svc::Handle debug_handle, uint32_t flags, uint64_t thread_id) { Result LegacyContinueDebugEvent64From32(ams::svc::Handle debug_handle, uint32_t flags, uint64_t thread_id) {
return LegacyContinueDebugEvent(debug_handle, flags, thread_id); R_RETURN(LegacyContinueDebugEvent(debug_handle, flags, thread_id));
} }
Result GetDebugThreadContext64From32(KUserPointer<ams::svc::ThreadContext *> out_context, ams::svc::Handle debug_handle, uint64_t thread_id, uint32_t context_flags) { Result GetDebugThreadContext64From32(KUserPointer<ams::svc::ThreadContext *> out_context, ams::svc::Handle debug_handle, uint64_t thread_id, uint32_t context_flags) {
return GetDebugThreadContext(out_context, debug_handle, thread_id, context_flags); R_RETURN(GetDebugThreadContext(out_context, debug_handle, thread_id, context_flags));
} }
Result SetDebugThreadContext64From32(ams::svc::Handle debug_handle, uint64_t thread_id, KUserPointer<const ams::svc::ThreadContext *> context, uint32_t context_flags) { Result SetDebugThreadContext64From32(ams::svc::Handle debug_handle, uint64_t thread_id, KUserPointer<const ams::svc::ThreadContext *> context, uint32_t context_flags) {
return SetDebugThreadContext(debug_handle, thread_id, context, context_flags); R_RETURN(SetDebugThreadContext(debug_handle, thread_id, context, context_flags));
} }
Result QueryDebugProcessMemory64From32(KUserPointer<ams::svc::ilp32::MemoryInfo *> out_memory_info, ams::svc::PageInfo *out_page_info, ams::svc::Handle debug_handle, ams::svc::Address address) { Result QueryDebugProcessMemory64From32(KUserPointer<ams::svc::ilp32::MemoryInfo *> out_memory_info, ams::svc::PageInfo *out_page_info, ams::svc::Handle debug_handle, ams::svc::Address address) {
return QueryDebugProcessMemory(out_memory_info, out_page_info, debug_handle, address); R_RETURN(QueryDebugProcessMemory(out_memory_info, out_page_info, debug_handle, address));
} }
Result ReadDebugProcessMemory64From32(ams::svc::Address buffer, ams::svc::Handle debug_handle, ams::svc::Address address, ams::svc::Size size) { Result ReadDebugProcessMemory64From32(ams::svc::Address buffer, ams::svc::Handle debug_handle, ams::svc::Address address, ams::svc::Size size) {
return ReadDebugProcessMemory(buffer, debug_handle, address, size); R_RETURN(ReadDebugProcessMemory(buffer, debug_handle, address, size));
} }
Result WriteDebugProcessMemory64From32(ams::svc::Handle debug_handle, ams::svc::Address buffer, ams::svc::Address address, ams::svc::Size size) { Result WriteDebugProcessMemory64From32(ams::svc::Handle debug_handle, ams::svc::Address buffer, ams::svc::Address address, ams::svc::Size size) {
return WriteDebugProcessMemory(debug_handle, buffer, address, size); R_RETURN(WriteDebugProcessMemory(debug_handle, buffer, address, size));
} }
Result SetHardwareBreakPoint64From32(ams::svc::HardwareBreakPointRegisterName name, uint64_t flags, uint64_t value) { Result SetHardwareBreakPoint64From32(ams::svc::HardwareBreakPointRegisterName name, uint64_t flags, uint64_t value) {
return SetHardwareBreakPoint(name, flags, value); R_RETURN(SetHardwareBreakPoint(name, flags, value));
} }
Result GetDebugThreadParam64From32(uint64_t *out_64, uint32_t *out_32, ams::svc::Handle debug_handle, uint64_t thread_id, ams::svc::DebugThreadParam param) { Result GetDebugThreadParam64From32(uint64_t *out_64, uint32_t *out_32, ams::svc::Handle debug_handle, uint64_t thread_id, ams::svc::DebugThreadParam param) {
return GetDebugThreadParam(out_64, out_32, debug_handle, thread_id, param); R_RETURN(GetDebugThreadParam(out_64, out_32, debug_handle, thread_id, param));
} }
} }

View File

@ -29,7 +29,7 @@ namespace ams::kern::svc {
R_UNLESS(GetCurrentProcess().GetPageTable().Contains(KProcessAddress(debug_str.GetUnsafePointer()), len), svc::ResultInvalidCurrentMemory()); R_UNLESS(GetCurrentProcess().GetPageTable().Contains(KProcessAddress(debug_str.GetUnsafePointer()), len), svc::ResultInvalidCurrentMemory());
/* Output the string. */ /* Output the string. */
return KDebugLog::PrintUserString(debug_str, len); R_RETURN(KDebugLog::PrintUserString(debug_str, len));
} }
} }
@ -37,13 +37,13 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result OutputDebugString64(KUserPointer<const char *> debug_str, ams::svc::Size len) { Result OutputDebugString64(KUserPointer<const char *> debug_str, ams::svc::Size len) {
return OutputDebugString(debug_str, len); R_RETURN(OutputDebugString(debug_str, len));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result OutputDebugString64From32(KUserPointer<const char *> debug_str, ams::svc::Size len) { Result OutputDebugString64From32(KUserPointer<const char *> debug_str, ams::svc::Size len) {
return OutputDebugString(debug_str, len); R_RETURN(OutputDebugString(debug_str, len));
} }
} }

View File

@ -48,7 +48,7 @@ namespace ams::kern::svc {
/* Add to the handle table. */ /* Add to the handle table. */
R_TRY(GetCurrentProcess().GetHandleTable().Add(out, das)); R_TRY(GetCurrentProcess().GetHandleTable().Add(out, das));
return ResultSuccess(); R_SUCCEED();
} }
Result AttachDeviceAddressSpace(ams::svc::DeviceName device_name, ams::svc::Handle das_handle) { Result AttachDeviceAddressSpace(ams::svc::DeviceName device_name, ams::svc::Handle das_handle) {
@ -57,7 +57,7 @@ namespace ams::kern::svc {
R_UNLESS(das.IsNotNull(), svc::ResultInvalidHandle()); R_UNLESS(das.IsNotNull(), svc::ResultInvalidHandle());
/* Attach. */ /* Attach. */
return das->Attach(device_name); R_RETURN(das->Attach(device_name));
} }
Result DetachDeviceAddressSpace(ams::svc::DeviceName device_name, ams::svc::Handle das_handle) { Result DetachDeviceAddressSpace(ams::svc::DeviceName device_name, ams::svc::Handle das_handle) {
@ -66,7 +66,7 @@ namespace ams::kern::svc {
R_UNLESS(das.IsNotNull(), svc::ResultInvalidHandle()); R_UNLESS(das.IsNotNull(), svc::ResultInvalidHandle());
/* Detach. */ /* Detach. */
return das->Detach(device_name); R_RETURN(das->Detach(device_name));
} }
constexpr bool IsValidDeviceMemoryPermission(ams::svc::MemoryPermission device_perm) { constexpr bool IsValidDeviceMemoryPermission(ams::svc::MemoryPermission device_perm) {
@ -104,7 +104,7 @@ namespace ams::kern::svc {
R_UNLESS(page_table.Contains(process_address, size), svc::ResultInvalidCurrentMemory()); R_UNLESS(page_table.Contains(process_address, size), svc::ResultInvalidCurrentMemory());
/* Map. */ /* Map. */
return das->MapByForce(std::addressof(page_table), KProcessAddress(process_address), size, device_address, device_perm); R_RETURN(das->MapByForce(std::addressof(page_table), KProcessAddress(process_address), size, device_address, device_perm));
} }
Result MapDeviceAddressSpaceAligned(ams::svc::Handle das_handle, ams::svc::Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address, ams::svc::MemoryPermission device_perm) { Result MapDeviceAddressSpaceAligned(ams::svc::Handle das_handle, ams::svc::Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address, ams::svc::MemoryPermission device_perm) {
@ -132,7 +132,7 @@ namespace ams::kern::svc {
R_UNLESS(page_table.Contains(process_address, size), svc::ResultInvalidCurrentMemory()); R_UNLESS(page_table.Contains(process_address, size), svc::ResultInvalidCurrentMemory());
/* Map. */ /* Map. */
return das->MapAligned(std::addressof(page_table), KProcessAddress(process_address), size, device_address, device_perm); R_RETURN(das->MapAligned(std::addressof(page_table), KProcessAddress(process_address), size, device_address, device_perm));
} }
Result UnmapDeviceAddressSpace(ams::svc::Handle das_handle, ams::svc::Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address) { Result UnmapDeviceAddressSpace(ams::svc::Handle das_handle, ams::svc::Handle process_handle, uint64_t process_address, size_t size, uint64_t device_address) {
@ -157,7 +157,7 @@ namespace ams::kern::svc {
auto &page_table = process->GetPageTable(); auto &page_table = process->GetPageTable();
R_UNLESS(page_table.Contains(process_address, size), svc::ResultInvalidCurrentMemory()); R_UNLESS(page_table.Contains(process_address, size), svc::ResultInvalidCurrentMemory());
return das->Unmap(std::addressof(page_table), KProcessAddress(process_address), size, device_address); R_RETURN(das->Unmap(std::addressof(page_table), KProcessAddress(process_address), size, device_address));
} }
} }
@ -165,53 +165,53 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result CreateDeviceAddressSpace64(ams::svc::Handle *out_handle, uint64_t das_address, uint64_t das_size) { Result CreateDeviceAddressSpace64(ams::svc::Handle *out_handle, uint64_t das_address, uint64_t das_size) {
return CreateDeviceAddressSpace(out_handle, das_address, das_size); R_RETURN(CreateDeviceAddressSpace(out_handle, das_address, das_size));
} }
Result AttachDeviceAddressSpace64(ams::svc::DeviceName device_name, ams::svc::Handle das_handle) { Result AttachDeviceAddressSpace64(ams::svc::DeviceName device_name, ams::svc::Handle das_handle) {
return AttachDeviceAddressSpace(device_name, das_handle); R_RETURN(AttachDeviceAddressSpace(device_name, das_handle));
} }
Result DetachDeviceAddressSpace64(ams::svc::DeviceName device_name, ams::svc::Handle das_handle) { Result DetachDeviceAddressSpace64(ams::svc::DeviceName device_name, ams::svc::Handle das_handle) {
return DetachDeviceAddressSpace(device_name, das_handle); R_RETURN(DetachDeviceAddressSpace(device_name, das_handle));
} }
Result MapDeviceAddressSpaceByForce64(ams::svc::Handle das_handle, ams::svc::Handle process_handle, uint64_t process_address, ams::svc::Size size, uint64_t device_address, ams::svc::MemoryPermission device_perm) { Result MapDeviceAddressSpaceByForce64(ams::svc::Handle das_handle, ams::svc::Handle process_handle, uint64_t process_address, ams::svc::Size size, uint64_t device_address, ams::svc::MemoryPermission device_perm) {
return MapDeviceAddressSpaceByForce(das_handle, process_handle, process_address, size, device_address, device_perm); R_RETURN(MapDeviceAddressSpaceByForce(das_handle, process_handle, process_address, size, device_address, device_perm));
} }
Result MapDeviceAddressSpaceAligned64(ams::svc::Handle das_handle, ams::svc::Handle process_handle, uint64_t process_address, ams::svc::Size size, uint64_t device_address, ams::svc::MemoryPermission device_perm) { Result MapDeviceAddressSpaceAligned64(ams::svc::Handle das_handle, ams::svc::Handle process_handle, uint64_t process_address, ams::svc::Size size, uint64_t device_address, ams::svc::MemoryPermission device_perm) {
return MapDeviceAddressSpaceAligned(das_handle, process_handle, process_address, size, device_address, device_perm); R_RETURN(MapDeviceAddressSpaceAligned(das_handle, process_handle, process_address, size, device_address, device_perm));
} }
Result UnmapDeviceAddressSpace64(ams::svc::Handle das_handle, ams::svc::Handle process_handle, uint64_t process_address, ams::svc::Size size, uint64_t device_address) { Result UnmapDeviceAddressSpace64(ams::svc::Handle das_handle, ams::svc::Handle process_handle, uint64_t process_address, ams::svc::Size size, uint64_t device_address) {
return UnmapDeviceAddressSpace(das_handle, process_handle, process_address, size, device_address); R_RETURN(UnmapDeviceAddressSpace(das_handle, process_handle, process_address, size, device_address));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result CreateDeviceAddressSpace64From32(ams::svc::Handle *out_handle, uint64_t das_address, uint64_t das_size) { Result CreateDeviceAddressSpace64From32(ams::svc::Handle *out_handle, uint64_t das_address, uint64_t das_size) {
return CreateDeviceAddressSpace(out_handle, das_address, das_size); R_RETURN(CreateDeviceAddressSpace(out_handle, das_address, das_size));
} }
Result AttachDeviceAddressSpace64From32(ams::svc::DeviceName device_name, ams::svc::Handle das_handle) { Result AttachDeviceAddressSpace64From32(ams::svc::DeviceName device_name, ams::svc::Handle das_handle) {
return AttachDeviceAddressSpace(device_name, das_handle); R_RETURN(AttachDeviceAddressSpace(device_name, das_handle));
} }
Result DetachDeviceAddressSpace64From32(ams::svc::DeviceName device_name, ams::svc::Handle das_handle) { Result DetachDeviceAddressSpace64From32(ams::svc::DeviceName device_name, ams::svc::Handle das_handle) {
return DetachDeviceAddressSpace(device_name, das_handle); R_RETURN(DetachDeviceAddressSpace(device_name, das_handle));
} }
Result MapDeviceAddressSpaceByForce64From32(ams::svc::Handle das_handle, ams::svc::Handle process_handle, uint64_t process_address, ams::svc::Size size, uint64_t device_address, ams::svc::MemoryPermission device_perm) { Result MapDeviceAddressSpaceByForce64From32(ams::svc::Handle das_handle, ams::svc::Handle process_handle, uint64_t process_address, ams::svc::Size size, uint64_t device_address, ams::svc::MemoryPermission device_perm) {
return MapDeviceAddressSpaceByForce(das_handle, process_handle, process_address, size, device_address, device_perm); R_RETURN(MapDeviceAddressSpaceByForce(das_handle, process_handle, process_address, size, device_address, device_perm));
} }
Result MapDeviceAddressSpaceAligned64From32(ams::svc::Handle das_handle, ams::svc::Handle process_handle, uint64_t process_address, ams::svc::Size size, uint64_t device_address, ams::svc::MemoryPermission device_perm) { Result MapDeviceAddressSpaceAligned64From32(ams::svc::Handle das_handle, ams::svc::Handle process_handle, uint64_t process_address, ams::svc::Size size, uint64_t device_address, ams::svc::MemoryPermission device_perm) {
return MapDeviceAddressSpaceAligned(das_handle, process_handle, process_address, size, device_address, device_perm); R_RETURN(MapDeviceAddressSpaceAligned(das_handle, process_handle, process_address, size, device_address, device_perm));
} }
Result UnmapDeviceAddressSpace64From32(ams::svc::Handle das_handle, ams::svc::Handle process_handle, uint64_t process_address, ams::svc::Size size, uint64_t device_address) { Result UnmapDeviceAddressSpace64From32(ams::svc::Handle das_handle, ams::svc::Handle process_handle, uint64_t process_address, ams::svc::Size size, uint64_t device_address) {
return UnmapDeviceAddressSpace(das_handle, process_handle, process_address, size, device_address); R_RETURN(UnmapDeviceAddressSpace(das_handle, process_handle, process_address, size, device_address));
} }
} }

View File

@ -32,10 +32,10 @@ namespace ams::kern::svc {
*out = GetInitialProcessIdMax(); *out = GetInitialProcessIdMax();
break; break;
default: default:
return svc::ResultInvalidCombination(); R_THROW(svc::ResultInvalidCombination());
} }
return ResultSuccess(); R_SUCCEED();
} }
Result GetInfoImpl(u64 *out, ams::svc::InfoType info_type, KProcess *process) { Result GetInfoImpl(u64 *out, ams::svc::InfoType info_type, KProcess *process) {
@ -109,7 +109,7 @@ namespace ams::kern::svc {
MESOSPHERE_UNREACHABLE_DEFAULT_CASE(); MESOSPHERE_UNREACHABLE_DEFAULT_CASE();
} }
return ResultSuccess(); R_SUCCEED();
} }
Result GetInfo(u64 *out, ams::svc::InfoType info_type, ams::svc::Handle handle, u64 info_subtype) { Result GetInfo(u64 *out, ams::svc::InfoType info_type, ams::svc::Handle handle, u64 info_subtype) {
@ -144,7 +144,7 @@ namespace ams::kern::svc {
#if defined(MESOSPHERE_ENABLE_GET_INFO_OF_DEBUG_PROCESS) #if defined(MESOSPHERE_ENABLE_GET_INFO_OF_DEBUG_PROCESS)
/* If we the process is valid, use it. */ /* If we the process is valid, use it. */
if (process.IsNotNull()) { if (process.IsNotNull()) {
return GetInfoImpl(out, info_type, process.GetPointerUnsafe()); R_RETURN(GetInfoImpl(out, info_type, process.GetPointerUnsafe()));
} }
/* Otherwise, as a mesosphere extension check if we were passed a usable KDebug. */ /* Otherwise, as a mesosphere extension check if we were passed a usable KDebug. */
@ -160,13 +160,13 @@ namespace ams::kern::svc {
ON_SCOPE_EXIT { debug->CloseProcess(); }; ON_SCOPE_EXIT { debug->CloseProcess(); };
/* Return the info. */ /* Return the info. */
return GetInfoImpl(out, info_type, debug->GetProcessUnsafe()); R_RETURN(GetInfoImpl(out, info_type, debug->GetProcessUnsafe()));
#else #else
/* Verify that the process is valid. */ /* Verify that the process is valid. */
R_UNLESS(process.IsNotNull(), svc::ResultInvalidHandle()); R_UNLESS(process.IsNotNull(), svc::ResultInvalidHandle());
/* Return the relevant info. */ /* Return the relevant info. */
return GetInfoImpl(out, info_type, process.GetPointerUnsafe()); R_RETURN(GetInfoImpl(out, info_type, process.GetPointerUnsafe()));
#endif #endif
} }
break; break;
@ -315,7 +315,7 @@ namespace ams::kern::svc {
} }
break; break;
default: default:
return svc::ResultInvalidCombination(); R_THROW(svc::ResultInvalidCombination());
} }
} }
break; break;
@ -343,10 +343,10 @@ namespace ams::kern::svc {
/* For debug, log the invalid info call. */ /* For debug, log the invalid info call. */
MESOSPHERE_LOG("GetInfo(%p, %u, %08x, %lu) was called\n", out, static_cast<u32>(info_type), static_cast<u32>(handle), info_subtype); MESOSPHERE_LOG("GetInfo(%p, %u, %08x, %lu) was called\n", out, static_cast<u32>(info_type), static_cast<u32>(handle), info_subtype);
} }
return svc::ResultInvalidEnumValue(); R_THROW(svc::ResultInvalidEnumValue());
} }
return ResultSuccess(); R_SUCCEED();
} }
constexpr bool IsValidMemoryPool(u64 pool) { constexpr bool IsValidMemoryPool(u64 pool) {
@ -398,10 +398,10 @@ namespace ams::kern::svc {
} }
break; break;
default: default:
return svc::ResultInvalidEnumValue(); R_THROW(svc::ResultInvalidEnumValue());
} }
return ResultSuccess(); R_SUCCEED();
} }
} }
@ -409,21 +409,21 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result GetInfo64(uint64_t *out, ams::svc::InfoType info_type, ams::svc::Handle handle, uint64_t info_subtype) { Result GetInfo64(uint64_t *out, ams::svc::InfoType info_type, ams::svc::Handle handle, uint64_t info_subtype) {
return GetInfo(out, info_type, handle, info_subtype); R_RETURN(GetInfo(out, info_type, handle, info_subtype));
} }
Result GetSystemInfo64(uint64_t *out, ams::svc::SystemInfoType info_type, ams::svc::Handle handle, uint64_t info_subtype) { Result GetSystemInfo64(uint64_t *out, ams::svc::SystemInfoType info_type, ams::svc::Handle handle, uint64_t info_subtype) {
return GetSystemInfo(out, info_type, handle, info_subtype); R_RETURN(GetSystemInfo(out, info_type, handle, info_subtype));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result GetInfo64From32(uint64_t *out, ams::svc::InfoType info_type, ams::svc::Handle handle, uint64_t info_subtype) { Result GetInfo64From32(uint64_t *out, ams::svc::InfoType info_type, ams::svc::Handle handle, uint64_t info_subtype) {
return GetInfo(out, info_type, handle, info_subtype); R_RETURN(GetInfo(out, info_type, handle, info_subtype));
} }
Result GetSystemInfo64From32(uint64_t *out, ams::svc::SystemInfoType info_type, ams::svc::Handle handle, uint64_t info_subtype) { Result GetSystemInfo64From32(uint64_t *out, ams::svc::SystemInfoType info_type, ams::svc::Handle handle, uint64_t info_subtype) {
return GetSystemInfo(out, info_type, handle, info_subtype); R_RETURN(GetSystemInfo(out, info_type, handle, info_subtype));
} }
} }

View File

@ -56,7 +56,7 @@ namespace ams::kern::svc {
/* Add the event to the handle table. */ /* Add the event to the handle table. */
R_TRY(handle_table.Add(out, event)); R_TRY(handle_table.Add(out, event));
return ResultSuccess(); R_SUCCEED();
} }
} }
@ -64,13 +64,13 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result CreateInterruptEvent64(ams::svc::Handle *out_read_handle, int32_t interrupt_id, ams::svc::InterruptType interrupt_type) { Result CreateInterruptEvent64(ams::svc::Handle *out_read_handle, int32_t interrupt_id, ams::svc::InterruptType interrupt_type) {
return CreateInterruptEvent(out_read_handle, interrupt_id, interrupt_type); R_RETURN(CreateInterruptEvent(out_read_handle, interrupt_id, interrupt_type));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result CreateInterruptEvent64From32(ams::svc::Handle *out_read_handle, int32_t interrupt_id, ams::svc::InterruptType interrupt_type) { Result CreateInterruptEvent64From32(ams::svc::Handle *out_read_handle, int32_t interrupt_id, ams::svc::InterruptType interrupt_type) {
return CreateInterruptEvent(out_read_handle, interrupt_id, interrupt_type); R_RETURN(CreateInterruptEvent(out_read_handle, interrupt_id, interrupt_type));
} }
} }

View File

@ -69,10 +69,10 @@ namespace ams::kern::svc {
/* Add the io pool to the handle table. */ /* Add the io pool to the handle table. */
R_TRY(GetCurrentProcess().GetHandleTable().Add(out, io_pool)); R_TRY(GetCurrentProcess().GetHandleTable().Add(out, io_pool));
return ResultSuccess(); R_SUCCEED();
} else { } else {
MESOSPHERE_UNUSED(out, pool_type); MESOSPHERE_UNUSED(out, pool_type);
return svc::ResultNotImplemented(); R_THROW(svc::ResultNotImplemented());
} }
} }
@ -111,10 +111,10 @@ namespace ams::kern::svc {
/* Add the io region to the handle table. */ /* Add the io region to the handle table. */
R_TRY(handle_table.Add(out, io_region)); R_TRY(handle_table.Add(out, io_region));
return ResultSuccess(); R_SUCCEED();
} else { } else {
MESOSPHERE_UNUSED(out, io_pool_handle, phys_addr, size, mapping, perm); MESOSPHERE_UNUSED(out, io_pool_handle, phys_addr, size, mapping, perm);
return svc::ResultNotImplemented(); R_THROW(svc::ResultNotImplemented());
} }
} }
@ -140,10 +140,10 @@ namespace ams::kern::svc {
R_TRY(io_region->Map(address, size, map_perm)); R_TRY(io_region->Map(address, size, map_perm));
/* We succeeded. */ /* We succeeded. */
return ResultSuccess(); R_SUCCEED();
} else { } else {
MESOSPHERE_UNUSED(io_region_handle, address, size, map_perm); MESOSPHERE_UNUSED(io_region_handle, address, size, map_perm);
return svc::ResultNotImplemented(); R_THROW(svc::ResultNotImplemented());
} }
} }
@ -166,10 +166,10 @@ namespace ams::kern::svc {
R_TRY(io_region->Unmap(address, size)); R_TRY(io_region->Unmap(address, size));
/* We succeeded. */ /* We succeeded. */
return ResultSuccess(); R_SUCCEED();
} else { } else {
MESOSPHERE_UNUSED(io_region_handle, address, size); MESOSPHERE_UNUSED(io_region_handle, address, size);
return svc::ResultNotImplemented(); R_THROW(svc::ResultNotImplemented());
} }
} }
@ -178,37 +178,37 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result CreateIoPool64(ams::svc::Handle *out_handle, ams::svc::IoPoolType pool_type) { Result CreateIoPool64(ams::svc::Handle *out_handle, ams::svc::IoPoolType pool_type) {
return CreateIoPool(out_handle, pool_type); R_RETURN(CreateIoPool(out_handle, pool_type));
} }
Result CreateIoRegion64(ams::svc::Handle *out_handle, ams::svc::Handle io_pool, ams::svc::PhysicalAddress physical_address, ams::svc::Size size, ams::svc::MemoryMapping mapping, ams::svc::MemoryPermission perm) { Result CreateIoRegion64(ams::svc::Handle *out_handle, ams::svc::Handle io_pool, ams::svc::PhysicalAddress physical_address, ams::svc::Size size, ams::svc::MemoryMapping mapping, ams::svc::MemoryPermission perm) {
return CreateIoRegion(out_handle, io_pool, physical_address, size, mapping, perm); R_RETURN(CreateIoRegion(out_handle, io_pool, physical_address, size, mapping, perm));
} }
Result MapIoRegion64(ams::svc::Handle io_region, ams::svc::Address address, ams::svc::Size size, ams::svc::MemoryPermission perm) { Result MapIoRegion64(ams::svc::Handle io_region, ams::svc::Address address, ams::svc::Size size, ams::svc::MemoryPermission perm) {
return MapIoRegion(io_region, address, size, perm); R_RETURN(MapIoRegion(io_region, address, size, perm));
} }
Result UnmapIoRegion64(ams::svc::Handle io_region, ams::svc::Address address, ams::svc::Size size) { Result UnmapIoRegion64(ams::svc::Handle io_region, ams::svc::Address address, ams::svc::Size size) {
return UnmapIoRegion(io_region, address, size); R_RETURN(UnmapIoRegion(io_region, address, size));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result CreateIoPool64From32(ams::svc::Handle *out_handle, ams::svc::IoPoolType pool_type) { Result CreateIoPool64From32(ams::svc::Handle *out_handle, ams::svc::IoPoolType pool_type) {
return CreateIoPool(out_handle, pool_type); R_RETURN(CreateIoPool(out_handle, pool_type));
} }
Result CreateIoRegion64From32(ams::svc::Handle *out_handle, ams::svc::Handle io_pool, ams::svc::PhysicalAddress physical_address, ams::svc::Size size, ams::svc::MemoryMapping mapping, ams::svc::MemoryPermission perm) { Result CreateIoRegion64From32(ams::svc::Handle *out_handle, ams::svc::Handle io_pool, ams::svc::PhysicalAddress physical_address, ams::svc::Size size, ams::svc::MemoryMapping mapping, ams::svc::MemoryPermission perm) {
return CreateIoRegion(out_handle, io_pool, physical_address, size, mapping, perm); R_RETURN(CreateIoRegion(out_handle, io_pool, physical_address, size, mapping, perm));
} }
Result MapIoRegion64From32(ams::svc::Handle io_region, ams::svc::Address address, ams::svc::Size size, ams::svc::MemoryPermission perm) { Result MapIoRegion64From32(ams::svc::Handle io_region, ams::svc::Address address, ams::svc::Size size, ams::svc::MemoryPermission perm) {
return MapIoRegion(io_region, address, size, perm); R_RETURN(MapIoRegion(io_region, address, size, perm));
} }
Result UnmapIoRegion64From32(ams::svc::Handle io_region, ams::svc::Address address, ams::svc::Size size) { Result UnmapIoRegion64From32(ams::svc::Handle io_region, ams::svc::Address address, ams::svc::Size size) {
return UnmapIoRegion(io_region, address, size); R_RETURN(UnmapIoRegion(io_region, address, size));
} }
} }

View File

@ -29,7 +29,7 @@ namespace ams::kern::svc {
/* Send the request. */ /* Send the request. */
R_TRY(session->SendSyncRequest(args)); R_TRY(session->SendSyncRequest(args));
return ResultSuccess(); R_SUCCEED();
} }
ALWAYS_INLINE Result ReplyAndReceiveLight(ams::svc::Handle session_handle, u32 *args) { ALWAYS_INLINE Result ReplyAndReceiveLight(ams::svc::Handle session_handle, u32 *args) {
@ -40,7 +40,7 @@ namespace ams::kern::svc {
/* Handle the request. */ /* Handle the request. */
R_TRY(session->ReplyAndReceive(args)); R_TRY(session->ReplyAndReceive(args));
return ResultSuccess(); R_SUCCEED();
} }
} }
@ -48,21 +48,21 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result SendSyncRequestLight64(ams::svc::Handle session_handle, u32 *args) { Result SendSyncRequestLight64(ams::svc::Handle session_handle, u32 *args) {
return SendSyncRequestLight(session_handle, args); R_RETURN(SendSyncRequestLight(session_handle, args));
} }
Result ReplyAndReceiveLight64(ams::svc::Handle session_handle, u32 *args) { Result ReplyAndReceiveLight64(ams::svc::Handle session_handle, u32 *args) {
return ReplyAndReceiveLight(session_handle, args); R_RETURN(ReplyAndReceiveLight(session_handle, args));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result SendSyncRequestLight64From32(ams::svc::Handle session_handle, u32 *args) { Result SendSyncRequestLight64From32(ams::svc::Handle session_handle, u32 *args) {
return SendSyncRequestLight(session_handle, args); R_RETURN(SendSyncRequestLight(session_handle, args));
} }
Result ReplyAndReceiveLight64From32(ams::svc::Handle session_handle, u32 *args) { Result ReplyAndReceiveLight64From32(ams::svc::Handle session_handle, u32 *args) {
return ReplyAndReceiveLight(session_handle, args); R_RETURN(ReplyAndReceiveLight(session_handle, args));
} }
} }

View File

@ -30,7 +30,7 @@ namespace ams::kern::svc {
R_UNLESS(!IsKernelAddress(address), svc::ResultInvalidCurrentMemory()); R_UNLESS(!IsKernelAddress(address), svc::ResultInvalidCurrentMemory());
R_UNLESS(util::IsAligned(address, sizeof(u32)), svc::ResultInvalidAddress()); R_UNLESS(util::IsAligned(address, sizeof(u32)), svc::ResultInvalidAddress());
return KConditionVariable::WaitForAddress(thread_handle, address, tag); R_RETURN(KConditionVariable::WaitForAddress(thread_handle, address, tag));
} }
Result ArbitrateUnlock(uintptr_t address) { Result ArbitrateUnlock(uintptr_t address) {
@ -38,7 +38,7 @@ namespace ams::kern::svc {
R_UNLESS(!IsKernelAddress(address), svc::ResultInvalidCurrentMemory()); R_UNLESS(!IsKernelAddress(address), svc::ResultInvalidCurrentMemory());
R_UNLESS(util::IsAligned(address, sizeof(u32)), svc::ResultInvalidAddress()); R_UNLESS(util::IsAligned(address, sizeof(u32)), svc::ResultInvalidAddress());
return KConditionVariable::SignalToAddress(address); R_RETURN(KConditionVariable::SignalToAddress(address));
} }
} }
@ -46,21 +46,21 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result ArbitrateLock64(ams::svc::Handle thread_handle, ams::svc::Address address, uint32_t tag) { Result ArbitrateLock64(ams::svc::Handle thread_handle, ams::svc::Address address, uint32_t tag) {
return ArbitrateLock(thread_handle, address, tag); R_RETURN(ArbitrateLock(thread_handle, address, tag));
} }
Result ArbitrateUnlock64(ams::svc::Address address) { Result ArbitrateUnlock64(ams::svc::Address address) {
return ArbitrateUnlock(address); R_RETURN(ArbitrateUnlock(address));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result ArbitrateLock64From32(ams::svc::Handle thread_handle, ams::svc::Address address, uint32_t tag) { Result ArbitrateLock64From32(ams::svc::Handle thread_handle, ams::svc::Address address, uint32_t tag) {
return ArbitrateLock(thread_handle, address, tag); R_RETURN(ArbitrateLock(thread_handle, address, tag));
} }
Result ArbitrateUnlock64From32(ams::svc::Address address) { Result ArbitrateUnlock64From32(ams::svc::Address address) {
return ArbitrateUnlock(address); R_RETURN(ArbitrateUnlock(address));
} }
} }

View File

@ -47,7 +47,7 @@ namespace ams::kern::svc {
R_UNLESS(page_table.Contains(address, size), svc::ResultInvalidCurrentMemory()); R_UNLESS(page_table.Contains(address, size), svc::ResultInvalidCurrentMemory());
/* Set the memory attribute. */ /* Set the memory attribute. */
return page_table.SetMemoryPermission(address, size, perm); R_RETURN(page_table.SetMemoryPermission(address, size, perm));
} }
Result SetMemoryAttribute(uintptr_t address, size_t size, uint32_t mask, uint32_t attr) { Result SetMemoryAttribute(uintptr_t address, size_t size, uint32_t mask, uint32_t attr) {
@ -67,7 +67,7 @@ namespace ams::kern::svc {
R_UNLESS(page_table.Contains(address, size), svc::ResultInvalidCurrentMemory()); R_UNLESS(page_table.Contains(address, size), svc::ResultInvalidCurrentMemory());
/* Set the memory attribute. */ /* Set the memory attribute. */
return page_table.SetMemoryAttribute(address, size, mask, attr); R_RETURN(page_table.SetMemoryAttribute(address, size, mask, attr));
} }
Result MapMemory(uintptr_t dst_address, uintptr_t src_address, size_t size) { Result MapMemory(uintptr_t dst_address, uintptr_t src_address, size_t size) {
@ -91,7 +91,7 @@ namespace ams::kern::svc {
R_UNLESS(page_table.CanContain(dst_address, size, KMemoryState_Stack), svc::ResultInvalidMemoryRegion()); R_UNLESS(page_table.CanContain(dst_address, size, KMemoryState_Stack), svc::ResultInvalidMemoryRegion());
/* Map the memory. */ /* Map the memory. */
return page_table.MapMemory(dst_address, src_address, size); R_RETURN(page_table.MapMemory(dst_address, src_address, size));
} }
Result UnmapMemory(uintptr_t dst_address, uintptr_t src_address, size_t size) { Result UnmapMemory(uintptr_t dst_address, uintptr_t src_address, size_t size) {
@ -115,7 +115,7 @@ namespace ams::kern::svc {
R_UNLESS(page_table.CanContain(dst_address, size, KMemoryState_Stack), svc::ResultInvalidMemoryRegion()); R_UNLESS(page_table.CanContain(dst_address, size, KMemoryState_Stack), svc::ResultInvalidMemoryRegion());
/* Unmap the memory. */ /* Unmap the memory. */
return page_table.UnmapMemory(dst_address, src_address, size); R_RETURN(page_table.UnmapMemory(dst_address, src_address, size));
} }
} }
@ -123,37 +123,37 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result SetMemoryPermission64(ams::svc::Address address, ams::svc::Size size, ams::svc::MemoryPermission perm) { Result SetMemoryPermission64(ams::svc::Address address, ams::svc::Size size, ams::svc::MemoryPermission perm) {
return SetMemoryPermission(address, size, perm); R_RETURN(SetMemoryPermission(address, size, perm));
} }
Result SetMemoryAttribute64(ams::svc::Address address, ams::svc::Size size, uint32_t mask, uint32_t attr) { Result SetMemoryAttribute64(ams::svc::Address address, ams::svc::Size size, uint32_t mask, uint32_t attr) {
return SetMemoryAttribute(address, size, mask, attr); R_RETURN(SetMemoryAttribute(address, size, mask, attr));
} }
Result MapMemory64(ams::svc::Address dst_address, ams::svc::Address src_address, ams::svc::Size size) { Result MapMemory64(ams::svc::Address dst_address, ams::svc::Address src_address, ams::svc::Size size) {
return MapMemory(dst_address, src_address, size); R_RETURN(MapMemory(dst_address, src_address, size));
} }
Result UnmapMemory64(ams::svc::Address dst_address, ams::svc::Address src_address, ams::svc::Size size) { Result UnmapMemory64(ams::svc::Address dst_address, ams::svc::Address src_address, ams::svc::Size size) {
return UnmapMemory(dst_address, src_address, size); R_RETURN(UnmapMemory(dst_address, src_address, size));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result SetMemoryPermission64From32(ams::svc::Address address, ams::svc::Size size, ams::svc::MemoryPermission perm) { Result SetMemoryPermission64From32(ams::svc::Address address, ams::svc::Size size, ams::svc::MemoryPermission perm) {
return SetMemoryPermission(address, size, perm); R_RETURN(SetMemoryPermission(address, size, perm));
} }
Result SetMemoryAttribute64From32(ams::svc::Address address, ams::svc::Size size, uint32_t mask, uint32_t attr) { Result SetMemoryAttribute64From32(ams::svc::Address address, ams::svc::Size size, uint32_t mask, uint32_t attr) {
return SetMemoryAttribute(address, size, mask, attr); R_RETURN(SetMemoryAttribute(address, size, mask, attr));
} }
Result MapMemory64From32(ams::svc::Address dst_address, ams::svc::Address src_address, ams::svc::Size size) { Result MapMemory64From32(ams::svc::Address dst_address, ams::svc::Address src_address, ams::svc::Size size) {
return MapMemory(dst_address, src_address, size); R_RETURN(MapMemory(dst_address, src_address, size));
} }
Result UnmapMemory64From32(ams::svc::Address dst_address, ams::svc::Address src_address, ams::svc::Size size) { Result UnmapMemory64From32(ams::svc::Address dst_address, ams::svc::Address src_address, ams::svc::Size size) {
return UnmapMemory(dst_address, src_address, size); R_RETURN(UnmapMemory(dst_address, src_address, size));
} }
} }

View File

@ -32,7 +32,7 @@ namespace ams::kern::svc {
/* Set the output. */ /* Set the output. */
*out_address = GetInteger(address); *out_address = GetInteger(address);
return ResultSuccess(); R_SUCCEED();
} }
Result SetUnsafeLimit(size_t limit) { Result SetUnsafeLimit(size_t limit) {
@ -43,7 +43,7 @@ namespace ams::kern::svc {
R_UNLESS(limit <= Kernel::GetMemoryManager().GetSize(KMemoryManager::Pool_Unsafe), svc::ResultOutOfRange()); R_UNLESS(limit <= Kernel::GetMemoryManager().GetSize(KMemoryManager::Pool_Unsafe), svc::ResultOutOfRange());
/* Set the size. */ /* Set the size. */
return Kernel::GetUnsafeMemory().SetLimitSize(limit); R_RETURN(Kernel::GetUnsafeMemory().SetLimitSize(limit));
} }
Result MapPhysicalMemory(uintptr_t address, size_t size) { Result MapPhysicalMemory(uintptr_t address, size_t size) {
@ -64,7 +64,7 @@ namespace ams::kern::svc {
/* Map the memory. */ /* Map the memory. */
R_TRY(page_table.MapPhysicalMemory(address, size)); R_TRY(page_table.MapPhysicalMemory(address, size));
return ResultSuccess(); R_SUCCEED();
} }
Result UnmapPhysicalMemory(uintptr_t address, size_t size) { Result UnmapPhysicalMemory(uintptr_t address, size_t size) {
@ -85,7 +85,7 @@ namespace ams::kern::svc {
/* Unmap the memory. */ /* Unmap the memory. */
R_TRY(page_table.UnmapPhysicalMemory(address, size)); R_TRY(page_table.UnmapPhysicalMemory(address, size));
return ResultSuccess(); R_SUCCEED();
} }
Result MapPhysicalMemoryUnsafe(uintptr_t address, size_t size) { Result MapPhysicalMemoryUnsafe(uintptr_t address, size_t size) {
@ -106,7 +106,7 @@ namespace ams::kern::svc {
/* Map the memory. */ /* Map the memory. */
R_TRY(page_table.MapPhysicalMemoryUnsafe(address, size)); R_TRY(page_table.MapPhysicalMemoryUnsafe(address, size));
return ResultSuccess(); R_SUCCEED();
} }
Result UnmapPhysicalMemoryUnsafe(uintptr_t address, size_t size) { Result UnmapPhysicalMemoryUnsafe(uintptr_t address, size_t size) {
@ -124,7 +124,7 @@ namespace ams::kern::svc {
/* Unmap the memory. */ /* Unmap the memory. */
R_TRY(page_table.UnmapPhysicalMemoryUnsafe(address, size)); R_TRY(page_table.UnmapPhysicalMemoryUnsafe(address, size));
return ResultSuccess(); R_SUCCEED();
} }
} }
@ -133,54 +133,54 @@ namespace ams::kern::svc {
Result SetHeapSize64(ams::svc::Address *out_address, ams::svc::Size size) { Result SetHeapSize64(ams::svc::Address *out_address, ams::svc::Size size) {
static_assert(sizeof(*out_address) == sizeof(uintptr_t)); static_assert(sizeof(*out_address) == sizeof(uintptr_t));
return SetHeapSize(reinterpret_cast<uintptr_t *>(out_address), size); R_RETURN(SetHeapSize(reinterpret_cast<uintptr_t *>(out_address), size));
} }
Result MapPhysicalMemory64(ams::svc::Address address, ams::svc::Size size) { Result MapPhysicalMemory64(ams::svc::Address address, ams::svc::Size size) {
return MapPhysicalMemory(address, size); R_RETURN(MapPhysicalMemory(address, size));
} }
Result UnmapPhysicalMemory64(ams::svc::Address address, ams::svc::Size size) { Result UnmapPhysicalMemory64(ams::svc::Address address, ams::svc::Size size) {
return UnmapPhysicalMemory(address, size); R_RETURN(UnmapPhysicalMemory(address, size));
} }
Result MapPhysicalMemoryUnsafe64(ams::svc::Address address, ams::svc::Size size) { Result MapPhysicalMemoryUnsafe64(ams::svc::Address address, ams::svc::Size size) {
return MapPhysicalMemoryUnsafe(address, size); R_RETURN(MapPhysicalMemoryUnsafe(address, size));
} }
Result UnmapPhysicalMemoryUnsafe64(ams::svc::Address address, ams::svc::Size size) { Result UnmapPhysicalMemoryUnsafe64(ams::svc::Address address, ams::svc::Size size) {
return UnmapPhysicalMemoryUnsafe(address, size); R_RETURN(UnmapPhysicalMemoryUnsafe(address, size));
} }
Result SetUnsafeLimit64(ams::svc::Size limit) { Result SetUnsafeLimit64(ams::svc::Size limit) {
return SetUnsafeLimit(limit); R_RETURN(SetUnsafeLimit(limit));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result SetHeapSize64From32(ams::svc::Address *out_address, ams::svc::Size size) { Result SetHeapSize64From32(ams::svc::Address *out_address, ams::svc::Size size) {
static_assert(sizeof(*out_address) == sizeof(uintptr_t)); static_assert(sizeof(*out_address) == sizeof(uintptr_t));
return SetHeapSize(reinterpret_cast<uintptr_t *>(out_address), size); R_RETURN(SetHeapSize(reinterpret_cast<uintptr_t *>(out_address), size));
} }
Result MapPhysicalMemory64From32(ams::svc::Address address, ams::svc::Size size) { Result MapPhysicalMemory64From32(ams::svc::Address address, ams::svc::Size size) {
return MapPhysicalMemory(address, size); R_RETURN(MapPhysicalMemory(address, size));
} }
Result UnmapPhysicalMemory64From32(ams::svc::Address address, ams::svc::Size size) { Result UnmapPhysicalMemory64From32(ams::svc::Address address, ams::svc::Size size) {
return UnmapPhysicalMemory(address, size); R_RETURN(UnmapPhysicalMemory(address, size));
} }
Result MapPhysicalMemoryUnsafe64From32(ams::svc::Address address, ams::svc::Size size) { Result MapPhysicalMemoryUnsafe64From32(ams::svc::Address address, ams::svc::Size size) {
return MapPhysicalMemoryUnsafe(address, size); R_RETURN(MapPhysicalMemoryUnsafe(address, size));
} }
Result UnmapPhysicalMemoryUnsafe64From32(ams::svc::Address address, ams::svc::Size size) { Result UnmapPhysicalMemoryUnsafe64From32(ams::svc::Address address, ams::svc::Size size) {
return UnmapPhysicalMemoryUnsafe(address, size); R_RETURN(UnmapPhysicalMemoryUnsafe(address, size));
} }
Result SetUnsafeLimit64From32(ams::svc::Size limit) { Result SetUnsafeLimit64From32(ams::svc::Size limit) {
return SetUnsafeLimit(limit); R_RETURN(SetUnsafeLimit(limit));
} }
} }

View File

@ -65,7 +65,7 @@ namespace ams::kern::svc {
*out_process_id = d->GetProcessUnsafe()->GetProcessId(); *out_process_id = d->GetProcessUnsafe()->GetProcessId();
} }
return ResultSuccess(); R_SUCCEED();
} }
Result GetProcessList(int32_t *out_num_processes, KUserPointer<uint64_t *> out_process_ids, int32_t max_out_count) { Result GetProcessList(int32_t *out_num_processes, KUserPointer<uint64_t *> out_process_ids, int32_t max_out_count) {
@ -78,7 +78,7 @@ namespace ams::kern::svc {
} }
/* Get the process list. */ /* Get the process list. */
return KProcess::GetProcessList(out_num_processes, out_process_ids, max_out_count); R_RETURN(KProcess::GetProcessList(out_num_processes, out_process_ids, max_out_count));
} }
Result CreateProcess(ams::svc::Handle *out, const ams::svc::CreateProcessParameter &params, KUserPointer<const uint32_t *> user_caps, int32_t num_caps) { Result CreateProcess(ams::svc::Handle *out, const ams::svc::CreateProcessParameter &params, KUserPointer<const uint32_t *> user_caps, int32_t num_caps) {
@ -135,7 +135,7 @@ namespace ams::kern::svc {
} }
break; break;
default: default:
return svc::ResultInvalidEnumValue(); R_THROW(svc::ResultInvalidEnumValue());
} }
/* Validate the pool partition. */ /* Validate the pool partition. */
@ -147,7 +147,7 @@ namespace ams::kern::svc {
case ams::svc::CreateProcessFlag_PoolPartitionSystemNonSecure: case ams::svc::CreateProcessFlag_PoolPartitionSystemNonSecure:
break; break;
default: default:
return svc::ResultInvalidEnumValue(); R_THROW(svc::ResultInvalidEnumValue());
} }
} }
@ -243,7 +243,7 @@ namespace ams::kern::svc {
/* Add the process to the handle table. */ /* Add the process to the handle table. */
R_TRY(handle_table.Add(out, process)); R_TRY(handle_table.Add(out, process));
return ResultSuccess(); R_SUCCEED();
} }
template<typename T> template<typename T>
@ -254,7 +254,7 @@ namespace ams::kern::svc {
/* Invoke the implementation. */ /* Invoke the implementation. */
if constexpr (std::same_as<T, ams::svc::CreateProcessParameter>) { if constexpr (std::same_as<T, ams::svc::CreateProcessParameter>) {
return CreateProcess(out, params, user_caps, num_caps); R_RETURN(CreateProcess(out, params, user_caps, num_caps));
} else { } else {
/* Convert the parameters. */ /* Convert the parameters. */
ams::svc::CreateProcessParameter converted_params; ams::svc::CreateProcessParameter converted_params;
@ -270,7 +270,7 @@ namespace ams::kern::svc {
converted_params.system_resource_num_pages = params.system_resource_num_pages; converted_params.system_resource_num_pages = params.system_resource_num_pages;
/* Invoke. */ /* Invoke. */
return CreateProcess(out, converted_params, user_caps, num_caps); R_RETURN(CreateProcess(out, converted_params, user_caps, num_caps));
} }
} }
@ -294,7 +294,7 @@ namespace ams::kern::svc {
process->SetIdealCoreId(core_id); process->SetIdealCoreId(core_id);
/* Run the process. */ /* Run the process. */
return process->Run(priority, static_cast<size_t>(main_thread_stack_size)); R_RETURN(process->Run(priority, static_cast<size_t>(main_thread_stack_size)));
} }
Result TerminateProcess(ams::svc::Handle process_handle) { Result TerminateProcess(ams::svc::Handle process_handle) {
@ -316,7 +316,7 @@ namespace ams::kern::svc {
ExitProcess(); ExitProcess();
} }
return ResultSuccess(); R_SUCCEED();
} }
Result GetProcessInfo(int64_t *out, ams::svc::Handle process_handle, ams::svc::ProcessInfoType info_type) { Result GetProcessInfo(int64_t *out, ams::svc::Handle process_handle, ams::svc::ProcessInfoType info_type) {
@ -352,10 +352,10 @@ namespace ams::kern::svc {
} }
break; break;
default: default:
return svc::ResultInvalidEnumValue(); R_THROW(svc::ResultInvalidEnumValue());
} }
return ResultSuccess(); R_SUCCEED();
} }
} }
@ -367,27 +367,27 @@ namespace ams::kern::svc {
} }
Result GetProcessId64(uint64_t *out_process_id, ams::svc::Handle process_handle) { Result GetProcessId64(uint64_t *out_process_id, ams::svc::Handle process_handle) {
return GetProcessId(out_process_id, process_handle); R_RETURN(GetProcessId(out_process_id, process_handle));
} }
Result GetProcessList64(int32_t *out_num_processes, KUserPointer<uint64_t *> out_process_ids, int32_t max_out_count) { Result GetProcessList64(int32_t *out_num_processes, KUserPointer<uint64_t *> out_process_ids, int32_t max_out_count) {
return GetProcessList(out_num_processes, out_process_ids, max_out_count); R_RETURN(GetProcessList(out_num_processes, out_process_ids, max_out_count));
} }
Result CreateProcess64(ams::svc::Handle *out_handle, KUserPointer<const ams::svc::lp64::CreateProcessParameter *> parameters, KUserPointer<const uint32_t *> caps, int32_t num_caps) { Result CreateProcess64(ams::svc::Handle *out_handle, KUserPointer<const ams::svc::lp64::CreateProcessParameter *> parameters, KUserPointer<const uint32_t *> caps, int32_t num_caps) {
return CreateProcess(out_handle, parameters, caps, num_caps); R_RETURN(CreateProcess(out_handle, parameters, caps, num_caps));
} }
Result StartProcess64(ams::svc::Handle process_handle, int32_t priority, int32_t core_id, uint64_t main_thread_stack_size) { Result StartProcess64(ams::svc::Handle process_handle, int32_t priority, int32_t core_id, uint64_t main_thread_stack_size) {
return StartProcess(process_handle, priority, core_id, main_thread_stack_size); R_RETURN(StartProcess(process_handle, priority, core_id, main_thread_stack_size));
} }
Result TerminateProcess64(ams::svc::Handle process_handle) { Result TerminateProcess64(ams::svc::Handle process_handle) {
return TerminateProcess(process_handle); R_RETURN(TerminateProcess(process_handle));
} }
Result GetProcessInfo64(int64_t *out_info, ams::svc::Handle process_handle, ams::svc::ProcessInfoType info_type) { Result GetProcessInfo64(int64_t *out_info, ams::svc::Handle process_handle, ams::svc::ProcessInfoType info_type) {
return GetProcessInfo(out_info, process_handle, info_type); R_RETURN(GetProcessInfo(out_info, process_handle, info_type));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
@ -397,27 +397,27 @@ namespace ams::kern::svc {
} }
Result GetProcessId64From32(uint64_t *out_process_id, ams::svc::Handle process_handle) { Result GetProcessId64From32(uint64_t *out_process_id, ams::svc::Handle process_handle) {
return GetProcessId(out_process_id, process_handle); R_RETURN(GetProcessId(out_process_id, process_handle));
} }
Result GetProcessList64From32(int32_t *out_num_processes, KUserPointer<uint64_t *> out_process_ids, int32_t max_out_count) { Result GetProcessList64From32(int32_t *out_num_processes, KUserPointer<uint64_t *> out_process_ids, int32_t max_out_count) {
return GetProcessList(out_num_processes, out_process_ids, max_out_count); R_RETURN(GetProcessList(out_num_processes, out_process_ids, max_out_count));
} }
Result CreateProcess64From32(ams::svc::Handle *out_handle, KUserPointer<const ams::svc::ilp32::CreateProcessParameter *> parameters, KUserPointer<const uint32_t *> caps, int32_t num_caps) { Result CreateProcess64From32(ams::svc::Handle *out_handle, KUserPointer<const ams::svc::ilp32::CreateProcessParameter *> parameters, KUserPointer<const uint32_t *> caps, int32_t num_caps) {
return CreateProcess(out_handle, parameters, caps, num_caps); R_RETURN(CreateProcess(out_handle, parameters, caps, num_caps));
} }
Result StartProcess64From32(ams::svc::Handle process_handle, int32_t priority, int32_t core_id, uint64_t main_thread_stack_size) { Result StartProcess64From32(ams::svc::Handle process_handle, int32_t priority, int32_t core_id, uint64_t main_thread_stack_size) {
return StartProcess(process_handle, priority, core_id, main_thread_stack_size); R_RETURN(StartProcess(process_handle, priority, core_id, main_thread_stack_size));
} }
Result TerminateProcess64From32(ams::svc::Handle process_handle) { Result TerminateProcess64From32(ams::svc::Handle process_handle) {
return TerminateProcess(process_handle); R_RETURN(TerminateProcess(process_handle));
} }
Result GetProcessInfo64From32(int64_t *out_info, ams::svc::Handle process_handle, ams::svc::ProcessInfoType info_type) { Result GetProcessInfo64From32(int64_t *out_info, ams::svc::Handle process_handle, ams::svc::ProcessInfoType info_type) {
return GetProcessInfo(out_info, process_handle, info_type); R_RETURN(GetProcessInfo(out_info, process_handle, info_type));
} }
} }

View File

@ -54,7 +54,7 @@ namespace ams::kern::svc {
R_UNLESS(page_table.Contains(address, size), svc::ResultInvalidCurrentMemory()); R_UNLESS(page_table.Contains(address, size), svc::ResultInvalidCurrentMemory());
/* Set the memory permission. */ /* Set the memory permission. */
return page_table.SetProcessMemoryPermission(address, size, perm); R_RETURN(page_table.SetProcessMemoryPermission(address, size, perm));
} }
Result MapProcessMemory(uintptr_t dst_address, ams::svc::Handle process_handle, uint64_t src_address, size_t size) { Result MapProcessMemory(uintptr_t dst_address, ams::svc::Handle process_handle, uint64_t src_address, size_t size) {
@ -96,7 +96,7 @@ namespace ams::kern::svc {
/* Map the group. */ /* Map the group. */
R_TRY(dst_pt.MapPageGroup(dst_address, pg, KMemoryState_SharedCode, KMemoryPermission_UserReadWrite)); R_TRY(dst_pt.MapPageGroup(dst_address, pg, KMemoryState_SharedCode, KMemoryPermission_UserReadWrite));
return ResultSuccess(); R_SUCCEED();
} }
Result UnmapProcessMemory(uintptr_t dst_address, ams::svc::Handle process_handle, uint64_t src_address, size_t size) { Result UnmapProcessMemory(uintptr_t dst_address, ams::svc::Handle process_handle, uint64_t src_address, size_t size) {
@ -125,7 +125,7 @@ namespace ams::kern::svc {
/* Unmap the memory. */ /* Unmap the memory. */
R_TRY(dst_pt.UnmapProcessMemory(dst_address, size, src_pt, src_address)); R_TRY(dst_pt.UnmapProcessMemory(dst_address, size, src_pt, src_address));
return ResultSuccess(); R_SUCCEED();
} }
Result MapProcessCodeMemory(ams::svc::Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size) { Result MapProcessCodeMemory(ams::svc::Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size) {
@ -152,7 +152,7 @@ namespace ams::kern::svc {
/* Map the memory. */ /* Map the memory. */
R_TRY(page_table.MapCodeMemory(dst_address, src_address, size)); R_TRY(page_table.MapCodeMemory(dst_address, src_address, size));
return ResultSuccess(); R_SUCCEED();
} }
Result UnmapProcessCodeMemory(ams::svc::Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size) { Result UnmapProcessCodeMemory(ams::svc::Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size) {
@ -179,7 +179,7 @@ namespace ams::kern::svc {
/* Unmap the memory. */ /* Unmap the memory. */
R_TRY(page_table.UnmapCodeMemory(dst_address, src_address, size)); R_TRY(page_table.UnmapCodeMemory(dst_address, src_address, size));
return ResultSuccess(); R_SUCCEED();
} }
} }
@ -187,45 +187,45 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result SetProcessMemoryPermission64(ams::svc::Handle process_handle, uint64_t address, uint64_t size, ams::svc::MemoryPermission perm) { Result SetProcessMemoryPermission64(ams::svc::Handle process_handle, uint64_t address, uint64_t size, ams::svc::MemoryPermission perm) {
return SetProcessMemoryPermission(process_handle, address, size, perm); R_RETURN(SetProcessMemoryPermission(process_handle, address, size, perm));
} }
Result MapProcessMemory64(ams::svc::Address dst_address, ams::svc::Handle process_handle, uint64_t src_address, ams::svc::Size size) { Result MapProcessMemory64(ams::svc::Address dst_address, ams::svc::Handle process_handle, uint64_t src_address, ams::svc::Size size) {
return MapProcessMemory(dst_address, process_handle, src_address, size); R_RETURN(MapProcessMemory(dst_address, process_handle, src_address, size));
} }
Result UnmapProcessMemory64(ams::svc::Address dst_address, ams::svc::Handle process_handle, uint64_t src_address, ams::svc::Size size) { Result UnmapProcessMemory64(ams::svc::Address dst_address, ams::svc::Handle process_handle, uint64_t src_address, ams::svc::Size size) {
return UnmapProcessMemory(dst_address, process_handle, src_address, size); R_RETURN(UnmapProcessMemory(dst_address, process_handle, src_address, size));
} }
Result MapProcessCodeMemory64(ams::svc::Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size) { Result MapProcessCodeMemory64(ams::svc::Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size) {
return MapProcessCodeMemory(process_handle, dst_address, src_address, size); R_RETURN(MapProcessCodeMemory(process_handle, dst_address, src_address, size));
} }
Result UnmapProcessCodeMemory64(ams::svc::Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size) { Result UnmapProcessCodeMemory64(ams::svc::Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size) {
return UnmapProcessCodeMemory(process_handle, dst_address, src_address, size); R_RETURN(UnmapProcessCodeMemory(process_handle, dst_address, src_address, size));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result SetProcessMemoryPermission64From32(ams::svc::Handle process_handle, uint64_t address, uint64_t size, ams::svc::MemoryPermission perm) { Result SetProcessMemoryPermission64From32(ams::svc::Handle process_handle, uint64_t address, uint64_t size, ams::svc::MemoryPermission perm) {
return SetProcessMemoryPermission(process_handle, address, size, perm); R_RETURN(SetProcessMemoryPermission(process_handle, address, size, perm));
} }
Result MapProcessMemory64From32(ams::svc::Address dst_address, ams::svc::Handle process_handle, uint64_t src_address, ams::svc::Size size) { Result MapProcessMemory64From32(ams::svc::Address dst_address, ams::svc::Handle process_handle, uint64_t src_address, ams::svc::Size size) {
return MapProcessMemory(dst_address, process_handle, src_address, size); R_RETURN(MapProcessMemory(dst_address, process_handle, src_address, size));
} }
Result UnmapProcessMemory64From32(ams::svc::Address dst_address, ams::svc::Handle process_handle, uint64_t src_address, ams::svc::Size size) { Result UnmapProcessMemory64From32(ams::svc::Address dst_address, ams::svc::Handle process_handle, uint64_t src_address, ams::svc::Size size) {
return UnmapProcessMemory(dst_address, process_handle, src_address, size); R_RETURN(UnmapProcessMemory(dst_address, process_handle, src_address, size));
} }
Result MapProcessCodeMemory64From32(ams::svc::Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size) { Result MapProcessCodeMemory64From32(ams::svc::Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size) {
return MapProcessCodeMemory(process_handle, dst_address, src_address, size); R_RETURN(MapProcessCodeMemory(process_handle, dst_address, src_address, size));
} }
Result UnmapProcessCodeMemory64From32(ams::svc::Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size) { Result UnmapProcessCodeMemory64From32(ams::svc::Handle process_handle, uint64_t dst_address, uint64_t src_address, uint64_t size) {
return UnmapProcessCodeMemory(process_handle, dst_address, src_address, size); R_RETURN(UnmapProcessCodeMemory(process_handle, dst_address, src_address, size));
} }
} }

View File

@ -32,7 +32,7 @@ namespace ams::kern::svc {
/* Write output. */ /* Write output. */
*out_memory_info = info.GetSvcMemoryInfo(); *out_memory_info = info.GetSvcMemoryInfo();
return ResultSuccess(); R_SUCCEED();
} }
template<typename T> template<typename T>
@ -62,14 +62,14 @@ namespace ams::kern::svc {
R_TRY(out_memory_info.CopyFrom(std::addressof(converted_info))); R_TRY(out_memory_info.CopyFrom(std::addressof(converted_info)));
} }
return ResultSuccess(); R_SUCCEED();
} }
template<typename T> template<typename T>
Result QueryMemory(KUserPointer<T *> out_memory_info, ams::svc::PageInfo *out_page_info, uintptr_t address) { Result QueryMemory(KUserPointer<T *> out_memory_info, ams::svc::PageInfo *out_page_info, uintptr_t address) {
/* Query memory is just QueryProcessMemory on the current process. */ /* Query memory is just QueryProcessMemory on the current process. */
return QueryProcessMemory(out_memory_info, out_page_info, ams::svc::PseudoHandle::CurrentProcess, address); R_RETURN(QueryProcessMemory(out_memory_info, out_page_info, ams::svc::PseudoHandle::CurrentProcess, address));
} }
} }
@ -77,21 +77,21 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result QueryMemory64(KUserPointer<ams::svc::lp64::MemoryInfo *> out_memory_info, ams::svc::PageInfo *out_page_info, ams::svc::Address address) { Result QueryMemory64(KUserPointer<ams::svc::lp64::MemoryInfo *> out_memory_info, ams::svc::PageInfo *out_page_info, ams::svc::Address address) {
return QueryMemory(out_memory_info, out_page_info, address); R_RETURN(QueryMemory(out_memory_info, out_page_info, address));
} }
Result QueryProcessMemory64(KUserPointer<ams::svc::lp64::MemoryInfo *> out_memory_info, ams::svc::PageInfo *out_page_info, ams::svc::Handle process_handle, uint64_t address) { Result QueryProcessMemory64(KUserPointer<ams::svc::lp64::MemoryInfo *> out_memory_info, ams::svc::PageInfo *out_page_info, ams::svc::Handle process_handle, uint64_t address) {
return QueryProcessMemory(out_memory_info, out_page_info, process_handle, address); R_RETURN(QueryProcessMemory(out_memory_info, out_page_info, process_handle, address));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result QueryMemory64From32(KUserPointer<ams::svc::ilp32::MemoryInfo *> out_memory_info, ams::svc::PageInfo *out_page_info, ams::svc::Address address) { Result QueryMemory64From32(KUserPointer<ams::svc::ilp32::MemoryInfo *> out_memory_info, ams::svc::PageInfo *out_page_info, ams::svc::Address address) {
return QueryMemory(out_memory_info, out_page_info, address); R_RETURN(QueryMemory(out_memory_info, out_page_info, address));
} }
Result QueryProcessMemory64From32(KUserPointer<ams::svc::ilp32::MemoryInfo *> out_memory_info, ams::svc::PageInfo *out_page_info, ams::svc::Handle process_handle, uint64_t address) { Result QueryProcessMemory64From32(KUserPointer<ams::svc::ilp32::MemoryInfo *> out_memory_info, ams::svc::PageInfo *out_page_info, ams::svc::Handle process_handle, uint64_t address) {
return QueryProcessMemory(out_memory_info, out_page_info, process_handle, address); R_RETURN(QueryProcessMemory(out_memory_info, out_page_info, process_handle, address));
} }
} }

View File

@ -26,7 +26,7 @@ namespace ams::kern::svc {
*out = 0; *out = 0;
/* Read/write the register. */ /* Read/write the register. */
return KSystemControl::ReadWriteRegister(out, address, mask, value); R_RETURN(KSystemControl::ReadWriteRegister(out, address, mask, value));
} }
} }
@ -34,13 +34,13 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result ReadWriteRegister64(uint32_t *out_value, ams::svc::PhysicalAddress address, uint32_t mask, uint32_t value) { Result ReadWriteRegister64(uint32_t *out_value, ams::svc::PhysicalAddress address, uint32_t mask, uint32_t value) {
return ReadWriteRegister(out_value, address, mask, value); R_RETURN(ReadWriteRegister(out_value, address, mask, value));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result ReadWriteRegister64From32(uint32_t *out_value, ams::svc::PhysicalAddress address, uint32_t mask, uint32_t value) { Result ReadWriteRegister64From32(uint32_t *out_value, ams::svc::PhysicalAddress address, uint32_t mask, uint32_t value) {
return ReadWriteRegister(out_value, address, mask, value); R_RETURN(ReadWriteRegister(out_value, address, mask, value));
} }
} }

View File

@ -36,7 +36,7 @@ namespace ams::kern::svc {
/* Get the limit value. */ /* Get the limit value. */
*out_limit_value = resource_limit->GetLimitValue(which); *out_limit_value = resource_limit->GetLimitValue(which);
return ResultSuccess(); R_SUCCEED();
} }
Result GetResourceLimitCurrentValue(int64_t *out_current_value, ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which) { Result GetResourceLimitCurrentValue(int64_t *out_current_value, ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which) {
@ -50,7 +50,7 @@ namespace ams::kern::svc {
/* Get the current value. */ /* Get the current value. */
*out_current_value = resource_limit->GetCurrentValue(which); *out_current_value = resource_limit->GetCurrentValue(which);
return ResultSuccess(); R_SUCCEED();
} }
Result GetResourceLimitPeakValue(int64_t *out_peak_value, ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which) { Result GetResourceLimitPeakValue(int64_t *out_peak_value, ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which) {
@ -64,7 +64,7 @@ namespace ams::kern::svc {
/* Get the peak value. */ /* Get the peak value. */
*out_peak_value = resource_limit->GetPeakValue(which); *out_peak_value = resource_limit->GetPeakValue(which);
return ResultSuccess(); R_SUCCEED();
} }
Result CreateResourceLimit(ams::svc::Handle *out_handle) { Result CreateResourceLimit(ams::svc::Handle *out_handle) {
@ -84,7 +84,7 @@ namespace ams::kern::svc {
/* Add the limit to the handle table. */ /* Add the limit to the handle table. */
R_TRY(GetCurrentProcess().GetHandleTable().Add(out_handle, resource_limit)); R_TRY(GetCurrentProcess().GetHandleTable().Add(out_handle, resource_limit));
return ResultSuccess(); R_SUCCEED();
} }
Result SetResourceLimitLimitValue(ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which, int64_t limit_value) { Result SetResourceLimitLimitValue(ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which, int64_t limit_value) {
@ -98,7 +98,7 @@ namespace ams::kern::svc {
/* Set the limit value. */ /* Set the limit value. */
R_TRY(resource_limit->SetLimitValue(which, limit_value)); R_TRY(resource_limit->SetLimitValue(which, limit_value));
return ResultSuccess(); R_SUCCEED();
} }
} }
@ -106,45 +106,45 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result GetResourceLimitLimitValue64(int64_t *out_limit_value, ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which) { Result GetResourceLimitLimitValue64(int64_t *out_limit_value, ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which) {
return GetResourceLimitLimitValue(out_limit_value, resource_limit_handle, which); R_RETURN(GetResourceLimitLimitValue(out_limit_value, resource_limit_handle, which));
} }
Result GetResourceLimitCurrentValue64(int64_t *out_current_value, ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which) { Result GetResourceLimitCurrentValue64(int64_t *out_current_value, ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which) {
return GetResourceLimitCurrentValue(out_current_value, resource_limit_handle, which); R_RETURN(GetResourceLimitCurrentValue(out_current_value, resource_limit_handle, which));
} }
Result GetResourceLimitPeakValue64(int64_t *out_peak_value, ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which) { Result GetResourceLimitPeakValue64(int64_t *out_peak_value, ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which) {
return GetResourceLimitPeakValue(out_peak_value, resource_limit_handle, which); R_RETURN(GetResourceLimitPeakValue(out_peak_value, resource_limit_handle, which));
} }
Result CreateResourceLimit64(ams::svc::Handle *out_handle) { Result CreateResourceLimit64(ams::svc::Handle *out_handle) {
return CreateResourceLimit(out_handle); R_RETURN(CreateResourceLimit(out_handle));
} }
Result SetResourceLimitLimitValue64(ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which, int64_t limit_value) { Result SetResourceLimitLimitValue64(ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which, int64_t limit_value) {
return SetResourceLimitLimitValue(resource_limit_handle, which, limit_value); R_RETURN(SetResourceLimitLimitValue(resource_limit_handle, which, limit_value));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result GetResourceLimitLimitValue64From32(int64_t *out_limit_value, ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which) { Result GetResourceLimitLimitValue64From32(int64_t *out_limit_value, ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which) {
return GetResourceLimitLimitValue(out_limit_value, resource_limit_handle, which); R_RETURN(GetResourceLimitLimitValue(out_limit_value, resource_limit_handle, which));
} }
Result GetResourceLimitCurrentValue64From32(int64_t *out_current_value, ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which) { Result GetResourceLimitCurrentValue64From32(int64_t *out_current_value, ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which) {
return GetResourceLimitCurrentValue(out_current_value, resource_limit_handle, which); R_RETURN(GetResourceLimitCurrentValue(out_current_value, resource_limit_handle, which));
} }
Result GetResourceLimitPeakValue64From32(int64_t *out_peak_value, ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which) { Result GetResourceLimitPeakValue64From32(int64_t *out_peak_value, ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which) {
return GetResourceLimitPeakValue(out_peak_value, resource_limit_handle, which); R_RETURN(GetResourceLimitPeakValue(out_peak_value, resource_limit_handle, which));
} }
Result CreateResourceLimit64From32(ams::svc::Handle *out_handle) { Result CreateResourceLimit64From32(ams::svc::Handle *out_handle) {
return CreateResourceLimit(out_handle); R_RETURN(CreateResourceLimit(out_handle));
} }
Result SetResourceLimitLimitValue64From32(ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which, int64_t limit_value) { Result SetResourceLimitLimitValue64From32(ams::svc::Handle resource_limit_handle, ams::svc::LimitableResource which, int64_t limit_value) {
return SetResourceLimitLimitValue(resource_limit_handle, which, limit_value); R_RETURN(SetResourceLimitLimitValue(resource_limit_handle, which, limit_value));
} }
} }

View File

@ -24,7 +24,7 @@ namespace ams::kern::svc {
Result CloseHandle(ams::svc::Handle handle) { Result CloseHandle(ams::svc::Handle handle) {
/* Remove the handle. */ /* Remove the handle. */
R_UNLESS(GetCurrentProcess().GetHandleTable().Remove(handle), svc::ResultInvalidHandle()); R_UNLESS(GetCurrentProcess().GetHandleTable().Remove(handle), svc::ResultInvalidHandle());
return ResultSuccess(); R_SUCCEED();
} }
Result ResetSignal(ams::svc::Handle handle) { Result ResetSignal(ams::svc::Handle handle) {
@ -36,9 +36,9 @@ namespace ams::kern::svc {
KScopedAutoObject readable_event = handle_table.GetObject<KReadableEvent>(handle); KScopedAutoObject readable_event = handle_table.GetObject<KReadableEvent>(handle);
if (readable_event.IsNotNull()) { if (readable_event.IsNotNull()) {
if (auto * const interrupt_event = readable_event->DynamicCast<KInterruptEvent *>(); interrupt_event != nullptr) { if (auto * const interrupt_event = readable_event->DynamicCast<KInterruptEvent *>(); interrupt_event != nullptr) {
return interrupt_event->Reset(); R_RETURN(interrupt_event->Reset());
} else { } else {
return readable_event->Reset(); R_RETURN(readable_event->Reset());
} }
} }
} }
@ -47,11 +47,11 @@ namespace ams::kern::svc {
{ {
KScopedAutoObject process = handle_table.GetObject<KProcess>(handle); KScopedAutoObject process = handle_table.GetObject<KProcess>(handle);
if (process.IsNotNull()) { if (process.IsNotNull()) {
return process->Reset(); R_RETURN(process->Reset());
} }
} }
return svc::ResultInvalidHandle(); R_THROW(svc::ResultInvalidHandle());
} }
Result WaitSynchronizationImpl(int32_t *out_index, KSynchronizationObject **objs, int32_t num_handles, int64_t timeout_ns) { Result WaitSynchronizationImpl(int32_t *out_index, KSynchronizationObject **objs, int32_t num_handles, int64_t timeout_ns) {
@ -67,7 +67,7 @@ namespace ams::kern::svc {
timeout = timeout_ns; timeout = timeout_ns;
} }
return KSynchronizationObject::Wait(out_index, objs, num_handles, timeout); R_RETURN(KSynchronizationObject::Wait(out_index, objs, num_handles, timeout));
} }
Result WaitSynchronization(int32_t *out_index, KUserPointer<const ams::svc::Handle *> user_handles, int32_t num_handles, int64_t timeout_ns) { Result WaitSynchronization(int32_t *out_index, KUserPointer<const ams::svc::Handle *> user_handles, int32_t num_handles, int64_t timeout_ns) {
@ -103,7 +103,7 @@ namespace ams::kern::svc {
R_CONVERT(svc::ResultSessionClosed, ResultSuccess()) R_CONVERT(svc::ResultSessionClosed, ResultSuccess())
} R_END_TRY_CATCH; } R_END_TRY_CATCH;
return ResultSuccess(); R_SUCCEED();
} }
Result CancelSynchronization(ams::svc::Handle handle) { Result CancelSynchronization(ams::svc::Handle handle) {
@ -113,7 +113,7 @@ namespace ams::kern::svc {
/* Cancel the thread's wait. */ /* Cancel the thread's wait. */
thread->WaitCancel(); thread->WaitCancel();
return ResultSuccess(); R_SUCCEED();
} }
void SynchronizePreemptionState() { void SynchronizePreemptionState() {
@ -136,19 +136,19 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result CloseHandle64(ams::svc::Handle handle) { Result CloseHandle64(ams::svc::Handle handle) {
return CloseHandle(handle); R_RETURN(CloseHandle(handle));
} }
Result ResetSignal64(ams::svc::Handle handle) { Result ResetSignal64(ams::svc::Handle handle) {
return ResetSignal(handle); R_RETURN(ResetSignal(handle));
} }
Result WaitSynchronization64(int32_t *out_index, KUserPointer<const ams::svc::Handle *> handles, int32_t num_handles, int64_t timeout_ns) { Result WaitSynchronization64(int32_t *out_index, KUserPointer<const ams::svc::Handle *> handles, int32_t num_handles, int64_t timeout_ns) {
return WaitSynchronization(out_index, handles, num_handles, timeout_ns); R_RETURN(WaitSynchronization(out_index, handles, num_handles, timeout_ns));
} }
Result CancelSynchronization64(ams::svc::Handle handle) { Result CancelSynchronization64(ams::svc::Handle handle) {
return CancelSynchronization(handle); R_RETURN(CancelSynchronization(handle));
} }
void SynchronizePreemptionState64() { void SynchronizePreemptionState64() {
@ -158,19 +158,19 @@ namespace ams::kern::svc {
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result CloseHandle64From32(ams::svc::Handle handle) { Result CloseHandle64From32(ams::svc::Handle handle) {
return CloseHandle(handle); R_RETURN(CloseHandle(handle));
} }
Result ResetSignal64From32(ams::svc::Handle handle) { Result ResetSignal64From32(ams::svc::Handle handle) {
return ResetSignal(handle); R_RETURN(ResetSignal(handle));
} }
Result WaitSynchronization64From32(int32_t *out_index, KUserPointer<const ams::svc::Handle *> handles, int32_t num_handles, int64_t timeout_ns) { Result WaitSynchronization64From32(int32_t *out_index, KUserPointer<const ams::svc::Handle *> handles, int32_t num_handles, int64_t timeout_ns) {
return WaitSynchronization(out_index, handles, num_handles, timeout_ns); R_RETURN(WaitSynchronization(out_index, handles, num_handles, timeout_ns));
} }
Result CancelSynchronization64From32(ams::svc::Handle handle) { Result CancelSynchronization64From32(ams::svc::Handle handle) {
return CancelSynchronization(handle); R_RETURN(CancelSynchronization(handle));
} }
void SynchronizePreemptionState64From32() { void SynchronizePreemptionState64From32() {

View File

@ -66,7 +66,7 @@ namespace ams::kern::svc {
/* Add the thread to the handle table. */ /* Add the thread to the handle table. */
R_TRY(process.GetHandleTable().Add(out, thread)); R_TRY(process.GetHandleTable().Add(out, thread));
return ResultSuccess(); R_SUCCEED();
} }
Result StartThread(ams::svc::Handle thread_handle) { Result StartThread(ams::svc::Handle thread_handle) {
@ -75,7 +75,7 @@ namespace ams::kern::svc {
R_UNLESS(thread.IsNotNull(), svc::ResultInvalidHandle()); R_UNLESS(thread.IsNotNull(), svc::ResultInvalidHandle());
/* Try to start the thread. */ /* Try to start the thread. */
return thread->Run(); R_RETURN(thread->Run());
} }
void ExitThread() { void ExitThread() {
@ -121,7 +121,7 @@ namespace ams::kern::svc {
/* Get the thread's priority. */ /* Get the thread's priority. */
*out_priority = thread->GetPriority(); *out_priority = thread->GetPriority();
return ResultSuccess(); R_SUCCEED();
} }
Result SetThreadPriority(ams::svc::Handle thread_handle, int32_t priority) { Result SetThreadPriority(ams::svc::Handle thread_handle, int32_t priority) {
@ -141,7 +141,7 @@ namespace ams::kern::svc {
/* Set the thread priority. */ /* Set the thread priority. */
thread->SetBasePriority(priority); thread->SetBasePriority(priority);
return ResultSuccess(); R_SUCCEED();
} }
Result GetThreadCoreMask(int32_t *out_core_id, uint64_t *out_affinity_mask, ams::svc::Handle thread_handle) { Result GetThreadCoreMask(int32_t *out_core_id, uint64_t *out_affinity_mask, ams::svc::Handle thread_handle) {
@ -152,7 +152,7 @@ namespace ams::kern::svc {
/* Get the core mask. */ /* Get the core mask. */
R_TRY(thread->GetCoreMask(out_core_id, out_affinity_mask)); R_TRY(thread->GetCoreMask(out_core_id, out_affinity_mask));
return ResultSuccess(); R_SUCCEED();
} }
Result SetThreadCoreMask(ams::svc::Handle thread_handle, int32_t core_id, uint64_t affinity_mask) { Result SetThreadCoreMask(ams::svc::Handle thread_handle, int32_t core_id, uint64_t affinity_mask) {
@ -184,7 +184,7 @@ namespace ams::kern::svc {
/* Set the core mask. */ /* Set the core mask. */
R_TRY(thread->SetCoreMask(core_id, affinity_mask)); R_TRY(thread->SetCoreMask(core_id, affinity_mask));
return ResultSuccess(); R_SUCCEED();
} }
Result GetThreadId(uint64_t *out_thread_id, ams::svc::Handle thread_handle) { Result GetThreadId(uint64_t *out_thread_id, ams::svc::Handle thread_handle) {
@ -194,7 +194,7 @@ namespace ams::kern::svc {
/* Get the thread's id. */ /* Get the thread's id. */
*out_thread_id = thread->GetId(); *out_thread_id = thread->GetId();
return ResultSuccess(); R_SUCCEED();
} }
Result GetThreadContext3(KUserPointer<ams::svc::ThreadContext *> out_context, ams::svc::Handle thread_handle) { Result GetThreadContext3(KUserPointer<ams::svc::ThreadContext *> out_context, ams::svc::Handle thread_handle) {
@ -213,7 +213,7 @@ namespace ams::kern::svc {
/* Copy the thread context to user space. */ /* Copy the thread context to user space. */
R_TRY(out_context.CopyFrom(std::addressof(context))); R_TRY(out_context.CopyFrom(std::addressof(context)));
return ResultSuccess(); R_SUCCEED();
} }
Result GetThreadList(int32_t *out_num_threads, KUserPointer<uint64_t *> out_thread_ids, int32_t max_out_count, ams::svc::Handle debug_handle) { Result GetThreadList(int32_t *out_num_threads, KUserPointer<uint64_t *> out_thread_ids, int32_t max_out_count, ams::svc::Handle debug_handle) {
@ -252,7 +252,7 @@ namespace ams::kern::svc {
} }
} }
return ResultSuccess(); R_SUCCEED();
} }
} }
@ -260,11 +260,11 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result CreateThread64(ams::svc::Handle *out_handle, ams::svc::ThreadFunc func, ams::svc::Address arg, ams::svc::Address stack_bottom, int32_t priority, int32_t core_id) { Result CreateThread64(ams::svc::Handle *out_handle, ams::svc::ThreadFunc func, ams::svc::Address arg, ams::svc::Address stack_bottom, int32_t priority, int32_t core_id) {
return CreateThread(out_handle, func, arg, stack_bottom, priority, core_id); R_RETURN(CreateThread(out_handle, func, arg, stack_bottom, priority, core_id));
} }
Result StartThread64(ams::svc::Handle thread_handle) { Result StartThread64(ams::svc::Handle thread_handle) {
return StartThread(thread_handle); R_RETURN(StartThread(thread_handle));
} }
void ExitThread64() { void ExitThread64() {
@ -276,41 +276,41 @@ namespace ams::kern::svc {
} }
Result GetThreadPriority64(int32_t *out_priority, ams::svc::Handle thread_handle) { Result GetThreadPriority64(int32_t *out_priority, ams::svc::Handle thread_handle) {
return GetThreadPriority(out_priority, thread_handle); R_RETURN(GetThreadPriority(out_priority, thread_handle));
} }
Result SetThreadPriority64(ams::svc::Handle thread_handle, int32_t priority) { Result SetThreadPriority64(ams::svc::Handle thread_handle, int32_t priority) {
return SetThreadPriority(thread_handle, priority); R_RETURN(SetThreadPriority(thread_handle, priority));
} }
Result GetThreadCoreMask64(int32_t *out_core_id, uint64_t *out_affinity_mask, ams::svc::Handle thread_handle) { Result GetThreadCoreMask64(int32_t *out_core_id, uint64_t *out_affinity_mask, ams::svc::Handle thread_handle) {
return GetThreadCoreMask(out_core_id, out_affinity_mask, thread_handle); R_RETURN(GetThreadCoreMask(out_core_id, out_affinity_mask, thread_handle));
} }
Result SetThreadCoreMask64(ams::svc::Handle thread_handle, int32_t core_id, uint64_t affinity_mask) { Result SetThreadCoreMask64(ams::svc::Handle thread_handle, int32_t core_id, uint64_t affinity_mask) {
return SetThreadCoreMask(thread_handle, core_id, affinity_mask); R_RETURN(SetThreadCoreMask(thread_handle, core_id, affinity_mask));
} }
Result GetThreadId64(uint64_t *out_thread_id, ams::svc::Handle thread_handle) { Result GetThreadId64(uint64_t *out_thread_id, ams::svc::Handle thread_handle) {
return GetThreadId(out_thread_id, thread_handle); R_RETURN(GetThreadId(out_thread_id, thread_handle));
} }
Result GetThreadContext364(KUserPointer<ams::svc::ThreadContext *> out_context, ams::svc::Handle thread_handle) { Result GetThreadContext364(KUserPointer<ams::svc::ThreadContext *> out_context, ams::svc::Handle thread_handle) {
return GetThreadContext3(out_context, thread_handle); R_RETURN(GetThreadContext3(out_context, thread_handle));
} }
Result GetThreadList64(int32_t *out_num_threads, KUserPointer<uint64_t *> out_thread_ids, int32_t max_out_count, ams::svc::Handle debug_handle) { Result GetThreadList64(int32_t *out_num_threads, KUserPointer<uint64_t *> out_thread_ids, int32_t max_out_count, ams::svc::Handle debug_handle) {
return GetThreadList(out_num_threads, out_thread_ids, max_out_count, debug_handle); R_RETURN(GetThreadList(out_num_threads, out_thread_ids, max_out_count, debug_handle));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result CreateThread64From32(ams::svc::Handle *out_handle, ams::svc::ThreadFunc func, ams::svc::Address arg, ams::svc::Address stack_bottom, int32_t priority, int32_t core_id) { Result CreateThread64From32(ams::svc::Handle *out_handle, ams::svc::ThreadFunc func, ams::svc::Address arg, ams::svc::Address stack_bottom, int32_t priority, int32_t core_id) {
return CreateThread(out_handle, func, arg, stack_bottom, priority, core_id); R_RETURN(CreateThread(out_handle, func, arg, stack_bottom, priority, core_id));
} }
Result StartThread64From32(ams::svc::Handle thread_handle) { Result StartThread64From32(ams::svc::Handle thread_handle) {
return StartThread(thread_handle); R_RETURN(StartThread(thread_handle));
} }
void ExitThread64From32() { void ExitThread64From32() {
@ -322,31 +322,31 @@ namespace ams::kern::svc {
} }
Result GetThreadPriority64From32(int32_t *out_priority, ams::svc::Handle thread_handle) { Result GetThreadPriority64From32(int32_t *out_priority, ams::svc::Handle thread_handle) {
return GetThreadPriority(out_priority, thread_handle); R_RETURN(GetThreadPriority(out_priority, thread_handle));
} }
Result SetThreadPriority64From32(ams::svc::Handle thread_handle, int32_t priority) { Result SetThreadPriority64From32(ams::svc::Handle thread_handle, int32_t priority) {
return SetThreadPriority(thread_handle, priority); R_RETURN(SetThreadPriority(thread_handle, priority));
} }
Result GetThreadCoreMask64From32(int32_t *out_core_id, uint64_t *out_affinity_mask, ams::svc::Handle thread_handle) { Result GetThreadCoreMask64From32(int32_t *out_core_id, uint64_t *out_affinity_mask, ams::svc::Handle thread_handle) {
return GetThreadCoreMask(out_core_id, out_affinity_mask, thread_handle); R_RETURN(GetThreadCoreMask(out_core_id, out_affinity_mask, thread_handle));
} }
Result SetThreadCoreMask64From32(ams::svc::Handle thread_handle, int32_t core_id, uint64_t affinity_mask) { Result SetThreadCoreMask64From32(ams::svc::Handle thread_handle, int32_t core_id, uint64_t affinity_mask) {
return SetThreadCoreMask(thread_handle, core_id, affinity_mask); R_RETURN(SetThreadCoreMask(thread_handle, core_id, affinity_mask));
} }
Result GetThreadId64From32(uint64_t *out_thread_id, ams::svc::Handle thread_handle) { Result GetThreadId64From32(uint64_t *out_thread_id, ams::svc::Handle thread_handle) {
return GetThreadId(out_thread_id, thread_handle); R_RETURN(GetThreadId(out_thread_id, thread_handle));
} }
Result GetThreadContext364From32(KUserPointer<ams::svc::ThreadContext *> out_context, ams::svc::Handle thread_handle) { Result GetThreadContext364From32(KUserPointer<ams::svc::ThreadContext *> out_context, ams::svc::Handle thread_handle) {
return GetThreadContext3(out_context, thread_handle); R_RETURN(GetThreadContext3(out_context, thread_handle));
} }
Result GetThreadList64From32(int32_t *out_num_threads, KUserPointer<uint64_t *> out_thread_ids, int32_t max_out_count, ams::svc::Handle debug_handle) { Result GetThreadList64From32(int32_t *out_num_threads, KUserPointer<uint64_t *> out_thread_ids, int32_t max_out_count, ams::svc::Handle debug_handle) {
return GetThreadList(out_num_threads, out_thread_ids, max_out_count, debug_handle); R_RETURN(GetThreadList(out_num_threads, out_thread_ids, max_out_count, debug_handle));
} }
} }

View File

@ -46,7 +46,7 @@ namespace ams::kern::svc {
*out_flags |= ams::svc::LastThreadInfoFlag_ThreadInSystemCall; *out_flags |= ams::svc::LastThreadInfoFlag_ThreadInSystemCall;
} }
return ResultSuccess(); R_SUCCEED();
} }
Result SynchronizeCurrentProcessToFutureTime(int64_t ns) { Result SynchronizeCurrentProcessToFutureTime(int64_t ns) {
@ -68,7 +68,7 @@ namespace ams::kern::svc {
/* Synchronize to the desired time. */ /* Synchronize to the desired time. */
R_TRY(wait_object->Synchronize(timeout)); R_TRY(wait_object->Synchronize(timeout));
return ResultSuccess(); R_SUCCEED();
} }
Result GetDebugFutureThreadInfo(ams::svc::LastThreadContext *out_context, uint64_t *out_thread_id, ams::svc::Handle debug_handle, int64_t ns) { Result GetDebugFutureThreadInfo(ams::svc::LastThreadContext *out_context, uint64_t *out_thread_id, ams::svc::Handle debug_handle, int64_t ns) {
@ -85,7 +85,7 @@ namespace ams::kern::svc {
/* Get the running thread info. */ /* Get the running thread info. */
R_TRY(debug->GetRunningThreadInfo(out_context, out_thread_id)); R_TRY(debug->GetRunningThreadInfo(out_context, out_thread_id));
return ResultSuccess(); R_SUCCEED();
} }
Result LegacyGetFutureThreadInfo(ams::svc::LastThreadContext *out_context, uintptr_t *out_tls_address, uint32_t *out_flags, int64_t ns) { Result LegacyGetFutureThreadInfo(ams::svc::LastThreadContext *out_context, uintptr_t *out_tls_address, uint32_t *out_flags, int64_t ns) {
@ -98,7 +98,7 @@ namespace ams::kern::svc {
/* Get the thread info. */ /* Get the thread info. */
R_TRY(GetLastThreadInfoImpl(out_context, out_tls_address, out_flags)); R_TRY(GetLastThreadInfoImpl(out_context, out_tls_address, out_flags));
return ResultSuccess(); R_SUCCEED();
} }
Result GetLastThreadInfo(ams::svc::LastThreadContext *out_context, uintptr_t *out_tls_address, uint32_t *out_flags) { Result GetLastThreadInfo(ams::svc::LastThreadContext *out_context, uintptr_t *out_tls_address, uint32_t *out_flags) {
@ -108,7 +108,7 @@ namespace ams::kern::svc {
/* Get the thread info. */ /* Get the thread info. */
R_TRY(GetLastThreadInfoImpl(out_context, out_tls_address, out_flags)); R_TRY(GetLastThreadInfoImpl(out_context, out_tls_address, out_flags));
return ResultSuccess(); R_SUCCEED();
} }
} }
@ -116,16 +116,16 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result GetDebugFutureThreadInfo64(ams::svc::lp64::LastThreadContext *out_context, uint64_t *out_thread_id, ams::svc::Handle debug_handle, int64_t ns) { Result GetDebugFutureThreadInfo64(ams::svc::lp64::LastThreadContext *out_context, uint64_t *out_thread_id, ams::svc::Handle debug_handle, int64_t ns) {
return GetDebugFutureThreadInfo(out_context, out_thread_id, debug_handle, ns); R_RETURN(GetDebugFutureThreadInfo(out_context, out_thread_id, debug_handle, ns));
} }
Result LegacyGetFutureThreadInfo64(ams::svc::lp64::LastThreadContext *out_context, ams::svc::Address *out_tls_address, uint32_t *out_flags, int64_t ns) { Result LegacyGetFutureThreadInfo64(ams::svc::lp64::LastThreadContext *out_context, ams::svc::Address *out_tls_address, uint32_t *out_flags, int64_t ns) {
return LegacyGetFutureThreadInfo(out_context, reinterpret_cast<uintptr_t *>(out_tls_address), out_flags, ns); R_RETURN(LegacyGetFutureThreadInfo(out_context, reinterpret_cast<uintptr_t *>(out_tls_address), out_flags, ns));
} }
Result GetLastThreadInfo64(ams::svc::lp64::LastThreadContext *out_context, ams::svc::Address *out_tls_address, uint32_t *out_flags) { Result GetLastThreadInfo64(ams::svc::lp64::LastThreadContext *out_context, ams::svc::Address *out_tls_address, uint32_t *out_flags) {
static_assert(sizeof(*out_tls_address) == sizeof(uintptr_t)); static_assert(sizeof(*out_tls_address) == sizeof(uintptr_t));
return GetLastThreadInfo(out_context, reinterpret_cast<uintptr_t *>(out_tls_address), out_flags); R_RETURN(GetLastThreadInfo(out_context, reinterpret_cast<uintptr_t *>(out_tls_address), out_flags));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
@ -140,7 +140,7 @@ namespace ams::kern::svc {
.lr = static_cast<u32>(context.lr), .lr = static_cast<u32>(context.lr),
.pc = static_cast<u32>(context.pc), .pc = static_cast<u32>(context.pc),
}; };
return ResultSuccess(); R_SUCCEED();
} }
Result LegacyGetFutureThreadInfo64From32(ams::svc::ilp32::LastThreadContext *out_context, ams::svc::Address *out_tls_address, uint32_t *out_flags, int64_t ns) { Result LegacyGetFutureThreadInfo64From32(ams::svc::ilp32::LastThreadContext *out_context, ams::svc::Address *out_tls_address, uint32_t *out_flags, int64_t ns) {
@ -155,7 +155,7 @@ namespace ams::kern::svc {
.lr = static_cast<u32>(context.lr), .lr = static_cast<u32>(context.lr),
.pc = static_cast<u32>(context.pc), .pc = static_cast<u32>(context.pc),
}; };
return ResultSuccess(); R_SUCCEED();
} }
Result GetLastThreadInfo64From32(ams::svc::ilp32::LastThreadContext *out_context, ams::svc::Address *out_tls_address, uint32_t *out_flags) { Result GetLastThreadInfo64From32(ams::svc::ilp32::LastThreadContext *out_context, ams::svc::Address *out_tls_address, uint32_t *out_flags) {
@ -170,7 +170,7 @@ namespace ams::kern::svc {
.lr = static_cast<u32>(context.lr), .lr = static_cast<u32>(context.lr),
.pc = static_cast<u32>(context.pc), .pc = static_cast<u32>(context.pc),
}; };
return ResultSuccess(); R_SUCCEED();
} }
} }

View File

@ -53,7 +53,7 @@ namespace ams::kern::svc {
R_TRY(trmem->Map(address, size, map_perm)); R_TRY(trmem->Map(address, size, map_perm));
/* We succeeded. */ /* We succeeded. */
return ResultSuccess(); R_SUCCEED();
} }
Result UnmapTransferMemory(ams::svc::Handle trmem_handle, uintptr_t address, size_t size) { Result UnmapTransferMemory(ams::svc::Handle trmem_handle, uintptr_t address, size_t size) {
@ -73,7 +73,7 @@ namespace ams::kern::svc {
/* Unmap the transfer memory. */ /* Unmap the transfer memory. */
R_TRY(trmem->Unmap(address, size)); R_TRY(trmem->Unmap(address, size));
return ResultSuccess(); R_SUCCEED();
} }
Result CreateTransferMemory(ams::svc::Handle *out, uintptr_t address, size_t size, ams::svc::MemoryPermission map_perm) { Result CreateTransferMemory(ams::svc::Handle *out, uintptr_t address, size_t size, ams::svc::MemoryPermission map_perm) {
@ -116,7 +116,7 @@ namespace ams::kern::svc {
/* Add the transfer memory to the handle table. */ /* Add the transfer memory to the handle table. */
R_TRY(handle_table.Add(out, trmem)); R_TRY(handle_table.Add(out, trmem));
return ResultSuccess(); R_SUCCEED();
} }
} }
@ -124,29 +124,29 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */ /* ============================= 64 ABI ============================= */
Result MapTransferMemory64(ams::svc::Handle trmem_handle, ams::svc::Address address, ams::svc::Size size, ams::svc::MemoryPermission owner_perm) { Result MapTransferMemory64(ams::svc::Handle trmem_handle, ams::svc::Address address, ams::svc::Size size, ams::svc::MemoryPermission owner_perm) {
return MapTransferMemory(trmem_handle, address, size, owner_perm); R_RETURN(MapTransferMemory(trmem_handle, address, size, owner_perm));
} }
Result UnmapTransferMemory64(ams::svc::Handle trmem_handle, ams::svc::Address address, ams::svc::Size size) { Result UnmapTransferMemory64(ams::svc::Handle trmem_handle, ams::svc::Address address, ams::svc::Size size) {
return UnmapTransferMemory(trmem_handle, address, size); R_RETURN(UnmapTransferMemory(trmem_handle, address, size));
} }
Result CreateTransferMemory64(ams::svc::Handle *out_handle, ams::svc::Address address, ams::svc::Size size, ams::svc::MemoryPermission map_perm) { Result CreateTransferMemory64(ams::svc::Handle *out_handle, ams::svc::Address address, ams::svc::Size size, ams::svc::MemoryPermission map_perm) {
return CreateTransferMemory(out_handle, address, size, map_perm); R_RETURN(CreateTransferMemory(out_handle, address, size, map_perm));
} }
/* ============================= 64From32 ABI ============================= */ /* ============================= 64From32 ABI ============================= */
Result MapTransferMemory64From32(ams::svc::Handle trmem_handle, ams::svc::Address address, ams::svc::Size size, ams::svc::MemoryPermission owner_perm) { Result MapTransferMemory64From32(ams::svc::Handle trmem_handle, ams::svc::Address address, ams::svc::Size size, ams::svc::MemoryPermission owner_perm) {
return MapTransferMemory(trmem_handle, address, size, owner_perm); R_RETURN(MapTransferMemory(trmem_handle, address, size, owner_perm));
} }
Result UnmapTransferMemory64From32(ams::svc::Handle trmem_handle, ams::svc::Address address, ams::svc::Size size) { Result UnmapTransferMemory64From32(ams::svc::Handle trmem_handle, ams::svc::Address address, ams::svc::Size size) {
return UnmapTransferMemory(trmem_handle, address, size); R_RETURN(UnmapTransferMemory(trmem_handle, address, size));
} }
Result CreateTransferMemory64From32(ams::svc::Handle *out_handle, ams::svc::Address address, ams::svc::Size size, ams::svc::MemoryPermission map_perm) { Result CreateTransferMemory64From32(ams::svc::Handle *out_handle, ams::svc::Address address, ams::svc::Size size, ams::svc::MemoryPermission map_perm) {
return CreateTransferMemory(out_handle, address, size, map_perm); R_RETURN(CreateTransferMemory(out_handle, address, size, map_perm));
} }
} }