Integrate new result macros. (#1780)

* result: try out some experimental shenanigans

* result: sketch out some more shenanigans

* result: see what it looks like to convert kernel to use result conds instead of guards

* make rest of kernel use experimental new macro-ing
This commit is contained in:
SciresM 2022-02-14 14:45:32 -08:00 committed by GitHub
parent 375ba615be
commit 96f95b9f95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
109 changed files with 1355 additions and 1380 deletions

View file

@ -56,7 +56,7 @@ namespace ams::kern::svc {
/* Set the activity. */
R_TRY(thread->SetActivity(thread_activity));
return ResultSuccess();
R_SUCCEED();
}
Result SetProcessActivity(ams::svc::Handle process_handle, ams::svc::ProcessActivity process_activity) {
@ -73,7 +73,7 @@ namespace ams::kern::svc {
/* Set the activity. */
R_TRY(process->SetActivity(process_activity));
return ResultSuccess();
R_SUCCEED();
}
}
@ -81,21 +81,21 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
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) {
return SetProcessActivity(process_handle, process_activity);
R_RETURN(SetProcessActivity(process_handle, process_activity));
}
/* ============================= 64From32 ABI ============================= */
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) {
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;
}
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) {
@ -78,7 +78,7 @@ namespace ams::kern::svc {
R_UNLESS(util::IsAligned(address, sizeof(int32_t)), svc::ResultInvalidAddress());
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 ============================= */
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) {
return SignalToAddress(address, signal_type, value, count);
R_RETURN(SignalToAddress(address, signal_type, value, count));
}
/* ============================= 64From32 ABI ============================= */
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) {
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. */
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) {
@ -61,7 +61,7 @@ namespace ams::kern::svc {
/* Use the size as the found size. */
found_size = size;
return ResultSuccess();
R_SUCCEED();
};
if (aligned) {
@ -109,7 +109,7 @@ namespace ams::kern::svc {
if (out_size != nullptr) {
*out_size = found_size;
}
return ResultSuccess();
R_SUCCEED();
}
}
@ -117,18 +117,18 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
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) {
static_assert(sizeof(*out_address) == sizeof(uintptr_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) {
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 ============================= */
@ -142,18 +142,18 @@ namespace ams::kern::svc {
.virtual_address = static_cast<u32>(info.virtual_address),
.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) {
static_assert(sizeof(*out_address) == sizeof(uintptr_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) {
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);
return ResultSuccess();
R_SUCCEED();
}
void FlushEntireDataCache() {
@ -88,7 +88,7 @@ namespace ams::kern::svc {
/* Flush the cache. */
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) {
@ -104,7 +104,7 @@ namespace ams::kern::svc {
/* Invalidate the cache. */
R_TRY(process->GetPageTable().InvalidateProcessDataCache(address, size));
return ResultSuccess();
R_SUCCEED();
}
Result StoreProcessDataCache(ams::svc::Handle process_handle, uint64_t address, uint64_t size) {
@ -123,14 +123,14 @@ namespace ams::kern::svc {
/* Perform the operation. */
if (process.GetPointerUnsafe() == GetCurrentProcessPointer()) {
return cpu::StoreDataCache(reinterpret_cast<void *>(address), size);
R_RETURN(cpu::StoreDataCache(reinterpret_cast<void *>(address), size));
} else {
class StoreCacheOperation : public CacheOperation {
public:
virtual void Operate(void *address, size_t size) const override { cpu::StoreDataCache(address, size); }
} 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. */
if (process.GetPointerUnsafe() == GetCurrentProcessPointer()) {
return cpu::FlushDataCache(reinterpret_cast<void *>(address), size);
R_RETURN(cpu::FlushDataCache(reinterpret_cast<void *>(address), size));
} else {
class FlushCacheOperation : public CacheOperation {
public:
virtual void Operate(void *address, size_t size) const override { cpu::FlushDataCache(address, size); }
} 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) {
return FlushDataCache(address, size);
R_RETURN(FlushDataCache(address, 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) {
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) {
return FlushProcessDataCache(process_handle, address, size);
R_RETURN(FlushProcessDataCache(process_handle, address, size));
}
/* ============================= 64From32 ABI ============================= */
@ -192,19 +192,19 @@ namespace ams::kern::svc {
}
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) {
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) {
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) {
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. */
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) {
@ -132,10 +132,10 @@ namespace ams::kern::svc {
}
break;
default:
return svc::ResultInvalidEnumValue();
R_THROW(svc::ResultInvalidEnumValue());
}
return ResultSuccess();
R_SUCCEED();
}
}
@ -143,21 +143,21 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
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) {
return ControlCodeMemory(code_memory_handle, operation, address, size, perm);
R_RETURN(ControlCodeMemory(code_memory_handle, operation, address, size, perm));
}
/* ============================= 64From32 ABI ============================= */
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) {
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. */
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) {
@ -60,7 +60,7 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
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) {
@ -70,7 +70,7 @@ namespace ams::kern::svc {
/* ============================= 64From32 ABI ============================= */
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) {

View file

@ -59,7 +59,7 @@ namespace ams::kern::svc {
/* Add the new debug object to the handle table. */
R_TRY(handle_table.Add(out_handle, debug));
return ResultSuccess();
R_SUCCEED();
}
Result BreakDebugProcess(ams::svc::Handle debug_handle) {
@ -73,7 +73,7 @@ namespace ams::kern::svc {
/* Break the process. */
R_TRY(debug->BreakProcess());
return ResultSuccess();
R_SUCCEED();
}
Result TerminateDebugProcess(ams::svc::Handle debug_handle) {
@ -87,7 +87,7 @@ namespace ams::kern::svc {
/* Terminate the process. */
R_TRY(debug->TerminateProcess());
return ResultSuccess();
R_SUCCEED();
}
template<typename EventInfoType>
@ -106,7 +106,7 @@ namespace ams::kern::svc {
/* Copy the info out to the user. */
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) {
@ -117,7 +117,7 @@ namespace ams::kern::svc {
/* Continue the event. */
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) {
@ -143,7 +143,7 @@ namespace ams::kern::svc {
/* Continue the event. */
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) {
@ -160,7 +160,7 @@ namespace ams::kern::svc {
/* Continue the event. */
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) {
@ -178,7 +178,7 @@ namespace ams::kern::svc {
/* Copy the context to userspace. */
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) {
@ -216,7 +216,7 @@ namespace ams::kern::svc {
/* Set the thread context. */
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) {
@ -227,7 +227,7 @@ namespace ams::kern::svc {
/* Query the mapping's info. */
R_TRY(debug->QueryMemoryInfo(out_memory_info, out_page_info, address));
return ResultSuccess();
R_SUCCEED();
}
template<typename T>
@ -257,7 +257,7 @@ namespace ams::kern::svc {
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) {
@ -273,7 +273,7 @@ namespace ams::kern::svc {
/* Read the memory. */
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) {
@ -292,7 +292,7 @@ namespace ams::kern::svc {
/* Write the memory. */
R_TRY(debug->WriteMemory(buffer, address, size));
return ResultSuccess();
R_SUCCEED();
}
Result SetHardwareBreakPoint(ams::svc::HardwareBreakPointRegisterName name, uint64_t flags, uint64_t value) {
@ -302,7 +302,7 @@ namespace ams::kern::svc {
/* Set the breakpoint. */
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) {
@ -382,7 +382,7 @@ namespace ams::kern::svc {
}
break;
default:
return svc::ResultInvalidState();
R_THROW(svc::ResultInvalidState());
}
}
break;
@ -413,10 +413,10 @@ namespace ams::kern::svc {
}
break;
default:
return ams::svc::ResultInvalidEnumValue();
R_THROW(ams::svc::ResultInvalidEnumValue());
}
return ResultSuccess();
R_SUCCEED();
}
}
@ -424,109 +424,109 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
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) {
return BreakDebugProcess(debug_handle);
R_RETURN(BreakDebugProcess(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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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 ============================= */
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) {
return BreakDebugProcess(debug_handle);
R_RETURN(BreakDebugProcess(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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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());
/* 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 ============================= */
Result OutputDebugString64(KUserPointer<const char *> debug_str, ams::svc::Size len) {
return OutputDebugString(debug_str, len);
R_RETURN(OutputDebugString(debug_str, len));
}
/* ============================= 64From32 ABI ============================= */
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. */
R_TRY(GetCurrentProcess().GetHandleTable().Add(out, das));
return ResultSuccess();
R_SUCCEED();
}
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());
/* Attach. */
return das->Attach(device_name);
R_RETURN(das->Attach(device_name));
}
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());
/* Detach. */
return das->Detach(device_name);
R_RETURN(das->Detach(device_name));
}
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());
/* 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) {
@ -132,7 +132,7 @@ namespace ams::kern::svc {
R_UNLESS(page_table.Contains(process_address, size), svc::ResultInvalidCurrentMemory());
/* 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) {
@ -157,7 +157,7 @@ namespace ams::kern::svc {
auto &page_table = process->GetPageTable();
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 ============================= */
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) {
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) {
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) {
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) {
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) {
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 ============================= */
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) {
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) {
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) {
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) {
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) {
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

@ -29,7 +29,7 @@ namespace ams::kern::svc {
KScopedAutoObject event = handle_table.GetObject<KEvent>(event_handle);
R_UNLESS(event.IsNotNull(), svc::ResultInvalidHandle());
return event->Signal();
R_RETURN(event->Signal());
}
Result ClearEvent(ams::svc::Handle event_handle) {
@ -40,7 +40,7 @@ namespace ams::kern::svc {
{
KScopedAutoObject event = handle_table.GetObject<KEvent>(event_handle);
if (event.IsNotNull()) {
return event->Clear();
R_RETURN(event->Clear());
}
}
@ -49,14 +49,14 @@ namespace ams::kern::svc {
KScopedAutoObject readable_event = handle_table.GetObject<KReadableEvent>(event_handle);
if (readable_event.IsNotNull()) {
if (auto * const interrupt_event = readable_event->DynamicCast<KInterruptEvent *>(); interrupt_event != nullptr) {
return interrupt_event->Clear();
R_RETURN(interrupt_event->Clear());
} else {
return readable_event->Clear();
R_RETURN(readable_event->Clear());
}
}
}
return svc::ResultInvalidHandle();
R_THROW(svc::ResultInvalidHandle());
}
Result CreateEvent(ams::svc::Handle *out_write, ams::svc::Handle *out_read) {
@ -107,14 +107,10 @@ namespace ams::kern::svc {
R_TRY(handle_table.Add(out_write, event));
/* Ensure that we maintaing a clean handle state on exit. */
auto handle_guard = SCOPE_GUARD { handle_table.Remove(*out_write); };
ON_RESULT_FAILURE { handle_table.Remove(*out_write); };
/* Add the readable event to the handle table. */
R_TRY(handle_table.Add(out_read, std::addressof(event->GetReadableEvent())));
/* We succeeded! */
handle_guard.Cancel();
return ResultSuccess();
R_RETURN(handle_table.Add(out_read, std::addressof(event->GetReadableEvent())));
}
}
@ -122,29 +118,29 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
Result SignalEvent64(ams::svc::Handle event_handle) {
return SignalEvent(event_handle);
R_RETURN(SignalEvent(event_handle));
}
Result ClearEvent64(ams::svc::Handle event_handle) {
return ClearEvent(event_handle);
R_RETURN(ClearEvent(event_handle));
}
Result CreateEvent64(ams::svc::Handle *out_write_handle, ams::svc::Handle *out_read_handle) {
return CreateEvent(out_write_handle, out_read_handle);
R_RETURN(CreateEvent(out_write_handle, out_read_handle));
}
/* ============================= 64From32 ABI ============================= */
Result SignalEvent64From32(ams::svc::Handle event_handle) {
return SignalEvent(event_handle);
R_RETURN(SignalEvent(event_handle));
}
Result ClearEvent64From32(ams::svc::Handle event_handle) {
return ClearEvent(event_handle);
R_RETURN(ClearEvent(event_handle));
}
Result CreateEvent64From32(ams::svc::Handle *out_write_handle, ams::svc::Handle *out_read_handle) {
return CreateEvent(out_write_handle, out_read_handle);
R_RETURN(CreateEvent(out_write_handle, out_read_handle));
}
}

View file

@ -32,10 +32,10 @@ namespace ams::kern::svc {
*out = GetInitialProcessIdMax();
break;
default:
return svc::ResultInvalidCombination();
R_THROW(svc::ResultInvalidCombination());
}
return ResultSuccess();
R_SUCCEED();
}
Result GetInfoImpl(u64 *out, ams::svc::InfoType info_type, KProcess *process) {
@ -109,7 +109,7 @@ namespace ams::kern::svc {
MESOSPHERE_UNREACHABLE_DEFAULT_CASE();
}
return ResultSuccess();
R_SUCCEED();
}
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 we the process is valid, use it. */
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. */
@ -160,13 +160,13 @@ namespace ams::kern::svc {
ON_SCOPE_EXIT { debug->CloseProcess(); };
/* Return the info. */
return GetInfoImpl(out, info_type, debug->GetProcessUnsafe());
R_RETURN(GetInfoImpl(out, info_type, debug->GetProcessUnsafe()));
#else
/* Verify that the process is valid. */
R_UNLESS(process.IsNotNull(), svc::ResultInvalidHandle());
/* Return the relevant info. */
return GetInfoImpl(out, info_type, process.GetPointerUnsafe());
R_RETURN(GetInfoImpl(out, info_type, process.GetPointerUnsafe()));
#endif
}
break;
@ -315,7 +315,7 @@ namespace ams::kern::svc {
}
break;
default:
return svc::ResultInvalidCombination();
R_THROW(svc::ResultInvalidCombination());
}
}
break;
@ -343,10 +343,10 @@ namespace ams::kern::svc {
/* 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);
}
return svc::ResultInvalidEnumValue();
R_THROW(svc::ResultInvalidEnumValue());
}
return ResultSuccess();
R_SUCCEED();
}
constexpr bool IsValidMemoryPool(u64 pool) {
@ -398,10 +398,10 @@ namespace ams::kern::svc {
}
break;
default:
return svc::ResultInvalidEnumValue();
R_THROW(svc::ResultInvalidEnumValue());
}
return ResultSuccess();
R_SUCCEED();
}
}
@ -409,21 +409,21 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
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) {
return GetSystemInfo(out, info_type, handle, info_subtype);
R_RETURN(GetSystemInfo(out, info_type, handle, info_subtype));
}
/* ============================= 64From32 ABI ============================= */
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) {
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. */
R_TRY(handle_table.Add(out, event));
return ResultSuccess();
R_SUCCEED();
}
}
@ -64,13 +64,13 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
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 ============================= */
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. */
R_TRY(GetCurrentProcess().GetHandleTable().Add(out, io_pool));
return ResultSuccess();
R_SUCCEED();
} else {
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. */
R_TRY(handle_table.Add(out, io_region));
return ResultSuccess();
R_SUCCEED();
} else {
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));
/* We succeeded. */
return ResultSuccess();
R_SUCCEED();
} else {
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));
/* We succeeded. */
return ResultSuccess();
R_SUCCEED();
} else {
MESOSPHERE_UNUSED(io_region_handle, address, size);
return svc::ResultNotImplemented();
R_THROW(svc::ResultNotImplemented());
}
}
@ -178,37 +178,37 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
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) {
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) {
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) {
return UnmapIoRegion(io_region, address, size);
R_RETURN(UnmapIoRegion(io_region, address, size));
}
/* ============================= 64From32 ABI ============================= */
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) {
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) {
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) {
return UnmapIoRegion(io_region, address, size);
R_RETURN(UnmapIoRegion(io_region, address, size));
}
}

View file

@ -34,7 +34,7 @@ namespace ams::kern::svc {
MESOSPHERE_ASSERT(parent.IsNotNull());
/* Send the request. */
return session->SendSyncRequest(message, buffer_size);
R_RETURN(session->SendSyncRequest(message, buffer_size));
}
ALWAYS_INLINE Result ReplyAndReceiveImpl(int32_t *out_index, uintptr_t message, size_t buffer_size, KPhysicalAddress message_paddr, KSynchronizationObject **objs, int32_t num_objects, ams::svc::Handle reply_target, int64_t timeout_ns) {
@ -44,13 +44,10 @@ namespace ams::kern::svc {
R_UNLESS(session.IsNotNull(), svc::ResultInvalidHandle());
/* If we fail to reply, we want to set the output index to -1. */
auto reply_idx_guard = SCOPE_GUARD { *out_index = -1; };
ON_RESULT_FAILURE { *out_index = -1; };
/* Send the reply. */
R_TRY(session->SendReply(message, buffer_size, message_paddr));
/* Cancel our guard. */
reply_idx_guard.Cancel();
}
/* Receive a message. */
@ -81,7 +78,7 @@ namespace ams::kern::svc {
s32 index;
Result result = KSynchronizationObject::Wait(std::addressof(index), objs, num_objects, timeout);
if (svc::ResultTimedOut::Includes(result)) {
return result;
R_THROW(result);
}
/* Receive the request. */
@ -96,7 +93,7 @@ namespace ams::kern::svc {
}
*out_index = index;
return result;
R_RETURN(result);
}
}
}
@ -129,11 +126,11 @@ namespace ams::kern::svc {
}
};
return ReplyAndReceiveImpl(out_index, message, buffer_size, message_paddr, objs, num_handles, reply_target, timeout_ns);
R_RETURN(ReplyAndReceiveImpl(out_index, message, buffer_size, message_paddr, objs, num_handles, reply_target, timeout_ns));
}
ALWAYS_INLINE Result SendSyncRequest(ams::svc::Handle session_handle) {
return SendSyncRequestImpl(0, 0, session_handle);
R_RETURN(SendSyncRequestImpl(0, 0, session_handle));
}
ALWAYS_INLINE Result SendSyncRequestWithUserBuffer(uintptr_t message, size_t buffer_size, ams::svc::Handle session_handle) {
@ -149,16 +146,17 @@ namespace ams::kern::svc {
/* Lock the mesage buffer. */
R_TRY(page_table.LockForIpcUserBuffer(nullptr, message, buffer_size));
/* Ensure that even if we fail, we unlock the message buffer when done. */
auto unlock_guard = SCOPE_GUARD { page_table.UnlockForIpcUserBuffer(message, buffer_size); };
{
/* If we fail to send the message, unlock the message buffer. */
ON_RESULT_FAILURE { page_table.UnlockForIpcUserBuffer(message, buffer_size); };
/* Send the request. */
MESOSPHERE_ASSERT(message != 0);
R_TRY(SendSyncRequestImpl(message, buffer_size, session_handle));
/* Send the request. */
MESOSPHERE_ASSERT(message != 0);
R_TRY(SendSyncRequestImpl(message, buffer_size, session_handle));
}
/* We sent the request successfully, so cancel our guard and check the unlock result. */
unlock_guard.Cancel();
return page_table.UnlockForIpcUserBuffer(message, buffer_size);
/* We successfully processed, so try to unlock the message buffer. */
R_RETURN(page_table.UnlockForIpcUserBuffer(message, buffer_size));
}
ALWAYS_INLINE Result SendAsyncRequestWithUserBufferImpl(ams::svc::Handle *out_event_handle, uintptr_t message, size_t buffer_size, ams::svc::Handle session_handle) {
@ -201,14 +199,10 @@ namespace ams::kern::svc {
R_TRY(handle_table.Add(out_event_handle, std::addressof(event->GetReadableEvent())));
/* Ensure that if we fail to send the request, we close the readable handle. */
auto read_guard = SCOPE_GUARD { handle_table.Remove(*out_event_handle); };
ON_RESULT_FAILURE { handle_table.Remove(*out_event_handle); };
/* Send the async request. */
R_TRY(session->SendAsyncRequest(event, message, buffer_size));
/* We succeeded. */
read_guard.Cancel();
return ResultSuccess();
R_RETURN(session->SendAsyncRequest(event, message, buffer_size));
}
ALWAYS_INLINE Result SendAsyncRequestWithUserBuffer(ams::svc::Handle *out_event_handle, uintptr_t message, size_t buffer_size, ams::svc::Handle session_handle) {
@ -224,23 +218,18 @@ namespace ams::kern::svc {
/* Lock the mesage buffer. */
R_TRY(page_table.LockForIpcUserBuffer(nullptr, message, buffer_size));
/* Ensure that if we fail, we unlock the message buffer. */
auto unlock_guard = SCOPE_GUARD { page_table.UnlockForIpcUserBuffer(message, buffer_size); };
/* Ensure that if we fail and aren't terminating that we unlock the user buffer. */
ON_RESULT_FAILURE_BESIDES(svc::ResultTerminationRequested) {
page_table.UnlockForIpcUserBuffer(message, buffer_size);
};
/* Send the request. */
MESOSPHERE_ASSERT(message != 0);
const Result result = SendAsyncRequestWithUserBufferImpl(out_event_handle, message, buffer_size, session_handle);
/* If the request succeeds (or the thread is terminating), don't unlock the user buffer. */
if (R_SUCCEEDED(result) || svc::ResultTerminationRequested::Includes(result)) {
unlock_guard.Cancel();
}
return result;
R_RETURN(SendAsyncRequestWithUserBufferImpl(out_event_handle, message, buffer_size, session_handle));
}
ALWAYS_INLINE Result ReplyAndReceive(int32_t *out_index, KUserPointer<const ams::svc::Handle *> handles, int32_t num_handles, ams::svc::Handle reply_target, int64_t timeout_ns) {
return ReplyAndReceiveImpl(out_index, 0, 0, Null<KPhysicalAddress>, handles, num_handles, reply_target, timeout_ns);
R_RETURN(ReplyAndReceiveImpl(out_index, 0, 0, Null<KPhysicalAddress>, handles, num_handles, reply_target, timeout_ns));
}
ALWAYS_INLINE Result ReplyAndReceiveWithUserBuffer(int32_t *out_index, uintptr_t message, size_t buffer_size, KUserPointer<const ams::svc::Handle *> handles, int32_t num_handles, ams::svc::Handle reply_target, int64_t timeout_ns) {
@ -257,16 +246,17 @@ namespace ams::kern::svc {
KPhysicalAddress message_paddr;
R_TRY(page_table.LockForIpcUserBuffer(std::addressof(message_paddr), message, buffer_size));
/* Ensure that even if we fail, we unlock the message buffer when done. */
auto unlock_guard = SCOPE_GUARD { page_table.UnlockForIpcUserBuffer(message, buffer_size); };
{
/* If we fail to send the message, unlock the message buffer. */
ON_RESULT_FAILURE { page_table.UnlockForIpcUserBuffer(message, buffer_size); };
/* Send the request. */
MESOSPHERE_ASSERT(message != 0);
R_TRY(ReplyAndReceiveImpl(out_index, message, buffer_size, message_paddr, handles, num_handles, reply_target, timeout_ns));
/* Reply/Receive the request. */
MESOSPHERE_ASSERT(message != 0);
R_TRY(ReplyAndReceiveImpl(out_index, message, buffer_size, message_paddr, handles, num_handles, reply_target, timeout_ns));
}
/* We sent the request successfully, so cancel our guard and check the unlock result. */
unlock_guard.Cancel();
return page_table.UnlockForIpcUserBuffer(message, buffer_size);
/* We successfully processed, so try to unlock the message buffer. */
R_RETURN(page_table.UnlockForIpcUserBuffer(message, buffer_size));
}
}
@ -274,45 +264,45 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
Result SendSyncRequest64(ams::svc::Handle session_handle) {
return SendSyncRequest(session_handle);
R_RETURN(SendSyncRequest(session_handle));
}
Result SendSyncRequestWithUserBuffer64(ams::svc::Address message_buffer, ams::svc::Size message_buffer_size, ams::svc::Handle session_handle) {
return SendSyncRequestWithUserBuffer(message_buffer, message_buffer_size, session_handle);
R_RETURN(SendSyncRequestWithUserBuffer(message_buffer, message_buffer_size, session_handle));
}
Result SendAsyncRequestWithUserBuffer64(ams::svc::Handle *out_event_handle, ams::svc::Address message_buffer, ams::svc::Size message_buffer_size, ams::svc::Handle session_handle) {
return SendAsyncRequestWithUserBuffer(out_event_handle, message_buffer, message_buffer_size, session_handle);
R_RETURN(SendAsyncRequestWithUserBuffer(out_event_handle, message_buffer, message_buffer_size, session_handle));
}
Result ReplyAndReceive64(int32_t *out_index, KUserPointer<const ams::svc::Handle *> handles, int32_t num_handles, ams::svc::Handle reply_target, int64_t timeout_ns) {
return ReplyAndReceive(out_index, handles, num_handles, reply_target, timeout_ns);
R_RETURN(ReplyAndReceive(out_index, handles, num_handles, reply_target, timeout_ns));
}
Result ReplyAndReceiveWithUserBuffer64(int32_t *out_index, ams::svc::Address message_buffer, ams::svc::Size message_buffer_size, KUserPointer<const ams::svc::Handle *> handles, int32_t num_handles, ams::svc::Handle reply_target, int64_t timeout_ns) {
return ReplyAndReceiveWithUserBuffer(out_index, message_buffer, message_buffer_size, handles, num_handles, reply_target, timeout_ns);
R_RETURN(ReplyAndReceiveWithUserBuffer(out_index, message_buffer, message_buffer_size, handles, num_handles, reply_target, timeout_ns));
}
/* ============================= 64From32 ABI ============================= */
Result SendSyncRequest64From32(ams::svc::Handle session_handle) {
return SendSyncRequest(session_handle);
R_RETURN(SendSyncRequest(session_handle));
}
Result SendSyncRequestWithUserBuffer64From32(ams::svc::Address message_buffer, ams::svc::Size message_buffer_size, ams::svc::Handle session_handle) {
return SendSyncRequestWithUserBuffer(message_buffer, message_buffer_size, session_handle);
R_RETURN(SendSyncRequestWithUserBuffer(message_buffer, message_buffer_size, session_handle));
}
Result SendAsyncRequestWithUserBuffer64From32(ams::svc::Handle *out_event_handle, ams::svc::Address message_buffer, ams::svc::Size message_buffer_size, ams::svc::Handle session_handle) {
return SendAsyncRequestWithUserBuffer(out_event_handle, message_buffer, message_buffer_size, session_handle);
R_RETURN(SendAsyncRequestWithUserBuffer(out_event_handle, message_buffer, message_buffer_size, session_handle));
}
Result ReplyAndReceive64From32(int32_t *out_index, KUserPointer<const ams::svc::Handle *> handles, int32_t num_handles, ams::svc::Handle reply_target, int64_t timeout_ns) {
return ReplyAndReceive(out_index, handles, num_handles, reply_target, timeout_ns);
R_RETURN(ReplyAndReceive(out_index, handles, num_handles, reply_target, timeout_ns));
}
Result ReplyAndReceiveWithUserBuffer64From32(int32_t *out_index, ams::svc::Address message_buffer, ams::svc::Size message_buffer_size, KUserPointer<const ams::svc::Handle *> handles, int32_t num_handles, ams::svc::Handle reply_target, int64_t timeout_ns) {
return ReplyAndReceiveWithUserBuffer(out_index, message_buffer, message_buffer_size, handles, num_handles, reply_target, timeout_ns);
R_RETURN(ReplyAndReceiveWithUserBuffer(out_index, message_buffer, message_buffer_size, handles, num_handles, reply_target, timeout_ns));
}
}

View file

@ -29,7 +29,7 @@ namespace ams::kern::svc {
/* Send the request. */
R_TRY(session->SendSyncRequest(args));
return ResultSuccess();
R_SUCCEED();
}
ALWAYS_INLINE Result ReplyAndReceiveLight(ams::svc::Handle session_handle, u32 *args) {
@ -40,7 +40,7 @@ namespace ams::kern::svc {
/* Handle the request. */
R_TRY(session->ReplyAndReceive(args));
return ResultSuccess();
R_SUCCEED();
}
}
@ -48,21 +48,21 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
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) {
return ReplyAndReceiveLight(session_handle, args);
R_RETURN(ReplyAndReceiveLight(session_handle, args));
}
/* ============================= 64From32 ABI ============================= */
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) {
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(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) {
@ -38,7 +38,7 @@ namespace ams::kern::svc {
R_UNLESS(!IsKernelAddress(address), svc::ResultInvalidCurrentMemory());
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 ============================= */
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) {
return ArbitrateUnlock(address);
R_RETURN(ArbitrateUnlock(address));
}
/* ============================= 64From32 ABI ============================= */
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) {
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());
/* 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) {
@ -67,7 +67,7 @@ namespace ams::kern::svc {
R_UNLESS(page_table.Contains(address, size), svc::ResultInvalidCurrentMemory());
/* 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) {
@ -91,7 +91,7 @@ namespace ams::kern::svc {
R_UNLESS(page_table.CanContain(dst_address, size, KMemoryState_Stack), svc::ResultInvalidMemoryRegion());
/* 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) {
@ -115,7 +115,7 @@ namespace ams::kern::svc {
R_UNLESS(page_table.CanContain(dst_address, size, KMemoryState_Stack), svc::ResultInvalidMemoryRegion());
/* 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 ============================= */
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) {
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) {
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) {
return UnmapMemory(dst_address, src_address, size);
R_RETURN(UnmapMemory(dst_address, src_address, size));
}
/* ============================= 64From32 ABI ============================= */
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) {
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) {
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) {
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. */
*out_address = GetInteger(address);
return ResultSuccess();
R_SUCCEED();
}
Result SetUnsafeLimit(size_t limit) {
@ -43,7 +43,7 @@ namespace ams::kern::svc {
R_UNLESS(limit <= Kernel::GetMemoryManager().GetSize(KMemoryManager::Pool_Unsafe), svc::ResultOutOfRange());
/* Set the size. */
return Kernel::GetUnsafeMemory().SetLimitSize(limit);
R_RETURN(Kernel::GetUnsafeMemory().SetLimitSize(limit));
}
Result MapPhysicalMemory(uintptr_t address, size_t size) {
@ -64,7 +64,7 @@ namespace ams::kern::svc {
/* Map the memory. */
R_TRY(page_table.MapPhysicalMemory(address, size));
return ResultSuccess();
R_SUCCEED();
}
Result UnmapPhysicalMemory(uintptr_t address, size_t size) {
@ -85,7 +85,7 @@ namespace ams::kern::svc {
/* Unmap the memory. */
R_TRY(page_table.UnmapPhysicalMemory(address, size));
return ResultSuccess();
R_SUCCEED();
}
Result MapPhysicalMemoryUnsafe(uintptr_t address, size_t size) {
@ -106,7 +106,7 @@ namespace ams::kern::svc {
/* Map the memory. */
R_TRY(page_table.MapPhysicalMemoryUnsafe(address, size));
return ResultSuccess();
R_SUCCEED();
}
Result UnmapPhysicalMemoryUnsafe(uintptr_t address, size_t size) {
@ -124,7 +124,7 @@ namespace ams::kern::svc {
/* Unmap the memory. */
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) {
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) {
return MapPhysicalMemory(address, size);
R_RETURN(MapPhysicalMemory(address, 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) {
return MapPhysicalMemoryUnsafe(address, size);
R_RETURN(MapPhysicalMemoryUnsafe(address, 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) {
return SetUnsafeLimit(limit);
R_RETURN(SetUnsafeLimit(limit));
}
/* ============================= 64From32 ABI ============================= */
Result SetHeapSize64From32(ams::svc::Address *out_address, ams::svc::Size size) {
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) {
return MapPhysicalMemory(address, size);
R_RETURN(MapPhysicalMemory(address, 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) {
return MapPhysicalMemoryUnsafe(address, size);
R_RETURN(MapPhysicalMemoryUnsafe(address, 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) {
return SetUnsafeLimit(limit);
R_RETURN(SetUnsafeLimit(limit));
}
}

View file

@ -52,13 +52,10 @@ namespace ams::kern::svc {
/* Register the handle in the table. */
R_TRY(handle_table.Add(out_server_handle, std::addressof(port->GetServerPort())));
auto handle_guard = SCOPE_GUARD { handle_table.Remove(*out_server_handle); };
ON_RESULT_FAILURE { handle_table.Remove(*out_server_handle); };
/* Create a new object name. */
R_TRY(KObjectName::NewFromName(std::addressof(port->GetClientPort()), name));
/* We succeeded, so don't leak the handle. */
handle_guard.Cancel();
} else /* if (max_sessions == 0) */ {
/* Ensure that this else case is correct. */
MESOSPHERE_AUDIT(max_sessions == 0);
@ -70,7 +67,7 @@ namespace ams::kern::svc {
R_TRY(KObjectName::Delete<KClientPort>(name));
}
return ResultSuccess();
R_SUCCEED();
}
Result CreatePort(ams::svc::Handle *out_server, ams::svc::Handle *out_client, int32_t max_sessions, bool is_light, uintptr_t name) {
@ -100,14 +97,10 @@ namespace ams::kern::svc {
R_TRY(handle_table.Add(out_client, std::addressof(port->GetClientPort())));
/* Ensure that we maintaing a clean handle state on exit. */
auto handle_guard = SCOPE_GUARD { handle_table.Remove(*out_client); };
ON_RESULT_FAILURE { handle_table.Remove(*out_client); };
/* Add the server to the handle table. */
R_TRY(handle_table.Add(out_server, std::addressof(port->GetServerPort())));
/* We succeeded! */
handle_guard.Cancel();
return ResultSuccess();
R_RETURN(handle_table.Add(out_server, std::addressof(port->GetServerPort())));
}
Result ConnectToNamedPort(ams::svc::Handle *out, KUserPointer<const char *> user_name) {
@ -128,7 +121,7 @@ namespace ams::kern::svc {
/* Reserve a handle for the port. */
/* NOTE: Nintendo really does write directly to the output handle here. */
R_TRY(handle_table.Reserve(out));
auto handle_guard = SCOPE_GUARD { handle_table.Unreserve(*out); };
ON_RESULT_FAILURE { handle_table.Unreserve(*out); };
/* Create a session. */
KClientSession *session;
@ -139,8 +132,7 @@ namespace ams::kern::svc {
session->Close();
/* We succeeded. */
handle_guard.Cancel();
return ResultSuccess();
R_SUCCEED();
}
Result ConnectToPort(ams::svc::Handle *out, ams::svc::Handle port) {
@ -154,7 +146,7 @@ namespace ams::kern::svc {
/* Reserve a handle for the port. */
/* NOTE: Nintendo really does write directly to the output handle here. */
R_TRY(handle_table.Reserve(out));
auto handle_guard = SCOPE_GUARD { handle_table.Unreserve(*out); };
ON_RESULT_FAILURE { handle_table.Unreserve(*out); };
/* Create the session. */
KAutoObject *session;
@ -169,8 +161,7 @@ namespace ams::kern::svc {
session->Close();
/* We succeeded. */
handle_guard.Cancel();
return ResultSuccess();
R_SUCCEED();
}
}
@ -178,37 +169,37 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
Result ConnectToNamedPort64(ams::svc::Handle *out_handle, KUserPointer<const char *> name) {
return ConnectToNamedPort(out_handle, name);
R_RETURN(ConnectToNamedPort(out_handle, name));
}
Result CreatePort64(ams::svc::Handle *out_server_handle, ams::svc::Handle *out_client_handle, int32_t max_sessions, bool is_light, ams::svc::Address name) {
return CreatePort(out_server_handle, out_client_handle, max_sessions, is_light, name);
R_RETURN(CreatePort(out_server_handle, out_client_handle, max_sessions, is_light, name));
}
Result ManageNamedPort64(ams::svc::Handle *out_server_handle, KUserPointer<const char *> name, int32_t max_sessions) {
return ManageNamedPort(out_server_handle, name, max_sessions);
R_RETURN(ManageNamedPort(out_server_handle, name, max_sessions));
}
Result ConnectToPort64(ams::svc::Handle *out_handle, ams::svc::Handle port) {
return ConnectToPort(out_handle, port);
R_RETURN(ConnectToPort(out_handle, port));
}
/* ============================= 64From32 ABI ============================= */
Result ConnectToNamedPort64From32(ams::svc::Handle *out_handle, KUserPointer<const char *> name) {
return ConnectToNamedPort(out_handle, name);
R_RETURN(ConnectToNamedPort(out_handle, name));
}
Result CreatePort64From32(ams::svc::Handle *out_server_handle, ams::svc::Handle *out_client_handle, int32_t max_sessions, bool is_light, ams::svc::Address name) {
return CreatePort(out_server_handle, out_client_handle, max_sessions, is_light, name);
R_RETURN(CreatePort(out_server_handle, out_client_handle, max_sessions, is_light, name));
}
Result ManageNamedPort64From32(ams::svc::Handle *out_server_handle, KUserPointer<const char *> name, int32_t max_sessions) {
return ManageNamedPort(out_server_handle, name, max_sessions);
R_RETURN(ManageNamedPort(out_server_handle, name, max_sessions));
}
Result ConnectToPort64From32(ams::svc::Handle *out_handle, ams::svc::Handle port) {
return ConnectToPort(out_handle, port);
R_RETURN(ConnectToPort(out_handle, port));
}
}

View file

@ -65,7 +65,7 @@ namespace ams::kern::svc {
*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) {
@ -78,7 +78,7 @@ namespace ams::kern::svc {
}
/* 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) {
@ -135,7 +135,7 @@ namespace ams::kern::svc {
}
break;
default:
return svc::ResultInvalidEnumValue();
R_THROW(svc::ResultInvalidEnumValue());
}
/* Validate the pool partition. */
@ -147,7 +147,7 @@ namespace ams::kern::svc {
case ams::svc::CreateProcessFlag_PoolPartitionSystemNonSecure:
break;
default:
return svc::ResultInvalidEnumValue();
R_THROW(svc::ResultInvalidEnumValue());
}
}
@ -243,7 +243,7 @@ namespace ams::kern::svc {
/* Add the process to the handle table. */
R_TRY(handle_table.Add(out, process));
return ResultSuccess();
R_SUCCEED();
}
template<typename T>
@ -254,7 +254,7 @@ namespace ams::kern::svc {
/* Invoke the implementation. */
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 {
/* Convert the parameters. */
ams::svc::CreateProcessParameter converted_params;
@ -270,7 +270,7 @@ namespace ams::kern::svc {
converted_params.system_resource_num_pages = params.system_resource_num_pages;
/* 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);
/* 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) {
@ -316,7 +316,7 @@ namespace ams::kern::svc {
ExitProcess();
}
return ResultSuccess();
R_SUCCEED();
}
Result GetProcessInfo(int64_t *out, ams::svc::Handle process_handle, ams::svc::ProcessInfoType info_type) {
@ -352,10 +352,10 @@ namespace ams::kern::svc {
}
break;
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) {
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) {
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) {
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) {
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) {
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) {
return GetProcessInfo(out_info, process_handle, info_type);
R_RETURN(GetProcessInfo(out_info, process_handle, info_type));
}
/* ============================= 64From32 ABI ============================= */
@ -397,27 +397,27 @@ namespace ams::kern::svc {
}
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) {
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) {
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) {
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) {
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) {
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());
/* 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) {
@ -96,7 +96,7 @@ namespace ams::kern::svc {
/* Map the group. */
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) {
@ -125,7 +125,7 @@ namespace ams::kern::svc {
/* Unmap the memory. */
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) {
@ -152,7 +152,7 @@ namespace ams::kern::svc {
/* Map the memory. */
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) {
@ -179,7 +179,7 @@ namespace ams::kern::svc {
/* Unmap the memory. */
R_TRY(page_table.UnmapCodeMemory(dst_address, src_address, size));
return ResultSuccess();
R_SUCCEED();
}
}
@ -187,45 +187,45 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
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) {
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) {
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) {
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) {
return UnmapProcessCodeMemory(process_handle, dst_address, src_address, size);
R_RETURN(UnmapProcessCodeMemory(process_handle, dst_address, src_address, size));
}
/* ============================= 64From32 ABI ============================= */
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) {
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) {
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) {
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) {
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. */
*out_memory_info = info.GetSvcMemoryInfo();
return ResultSuccess();
R_SUCCEED();
}
template<typename T>
@ -62,14 +62,14 @@ namespace ams::kern::svc {
R_TRY(out_memory_info.CopyFrom(std::addressof(converted_info)));
}
return ResultSuccess();
R_SUCCEED();
}
template<typename T>
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. */
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 ============================= */
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) {
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 ============================= */
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) {
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;
/* 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 ============================= */
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 ============================= */
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. */
*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) {
@ -50,7 +50,7 @@ namespace ams::kern::svc {
/* Get the current value. */
*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) {
@ -64,7 +64,7 @@ namespace ams::kern::svc {
/* Get the peak value. */
*out_peak_value = resource_limit->GetPeakValue(which);
return ResultSuccess();
R_SUCCEED();
}
Result CreateResourceLimit(ams::svc::Handle *out_handle) {
@ -84,7 +84,7 @@ namespace ams::kern::svc {
/* Add the limit to the handle table. */
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) {
@ -98,7 +98,7 @@ namespace ams::kern::svc {
/* Set the limit value. */
R_TRY(resource_limit->SetLimitValue(which, limit_value));
return ResultSuccess();
R_SUCCEED();
}
}
@ -106,45 +106,45 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
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) {
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) {
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) {
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) {
return SetResourceLimitLimitValue(resource_limit_handle, which, limit_value);
R_RETURN(SetResourceLimitLimitValue(resource_limit_handle, which, limit_value));
}
/* ============================= 64From32 ABI ============================= */
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) {
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) {
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) {
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) {
return SetResourceLimitLimitValue(resource_limit_handle, which, limit_value);
R_RETURN(SetResourceLimitLimitValue(resource_limit_handle, which, limit_value));
}
}

View file

@ -43,21 +43,17 @@ namespace ams::kern::svc {
/* Try to allocate a session from unused slab memory. */
session = T::CreateFromUnusedSlabMemory();
R_UNLESS(session != nullptr, svc::ResultLimitReached());
ON_RESULT_FAILURE { session->Close(); };
/* If we're creating a KSession, we want to add two KSessionRequests to the heap, to prevent request exhaustion. */
/* NOTE: Nintendo checks if session->DynamicCast<KSession *>() != nullptr, but there's no reason to not do this statically. */
if constexpr (std::same_as<T, KSession>) {
/* Ensure that if we fail to allocate our session requests, we close the session we created. */
auto session_guard = SCOPE_GUARD { session->Close(); };
{
for (size_t i = 0; i < 2; ++i) {
KSessionRequest *request = KSessionRequest::CreateFromUnusedSlabMemory();
R_UNLESS(request != nullptr, svc::ResultLimitReached());
for (size_t i = 0; i < 2; ++i) {
KSessionRequest *request = KSessionRequest::CreateFromUnusedSlabMemory();
R_UNLESS(request != nullptr, svc::ResultLimitReached());
request->Close();
}
request->Close();
}
session_guard.Cancel();
}
/* We successfully allocated a session, so add the object we allocated to the resource limit. */
@ -86,21 +82,17 @@ namespace ams::kern::svc {
R_TRY(handle_table.Add(out_server, std::addressof(session->GetServerSession())));
/* Ensure that we maintaing a clean handle state on exit. */
auto handle_guard = SCOPE_GUARD { handle_table.Remove(*out_server); };
ON_RESULT_FAILURE { handle_table.Remove(*out_server); };
/* Add the client session to the handle table. */
R_TRY(handle_table.Add(out_client, std::addressof(session->GetClientSession())));
/* We succeeded! */
handle_guard.Cancel();
return ResultSuccess();
R_RETURN(handle_table.Add(out_client, std::addressof(session->GetClientSession())));
}
Result CreateSession(ams::svc::Handle *out_server, ams::svc::Handle *out_client, bool is_light, uintptr_t name) {
if (is_light) {
return CreateSession<KLightSession>(out_server, out_client, name);
R_RETURN(CreateSession<KLightSession>(out_server, out_client, name));
} else {
return CreateSession<KSession>(out_server, out_client, name);
R_RETURN(CreateSession<KSession>(out_server, out_client, name));
}
}
@ -114,7 +106,7 @@ namespace ams::kern::svc {
/* Reserve an entry for the new session. */
R_TRY(handle_table.Reserve(out));
auto handle_guard = SCOPE_GUARD { handle_table.Unreserve(*out); };
ON_RESULT_FAILURE { handle_table.Unreserve(*out); };
/* Accept the session. */
KAutoObject *session;
@ -129,10 +121,9 @@ namespace ams::kern::svc {
/* Register the session. */
handle_table.Register(*out, session);
handle_guard.Cancel();
session->Close();
return ResultSuccess();
R_SUCCEED();
}
}
@ -140,21 +131,21 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
Result CreateSession64(ams::svc::Handle *out_server_session_handle, ams::svc::Handle *out_client_session_handle, bool is_light, ams::svc::Address name) {
return CreateSession(out_server_session_handle, out_client_session_handle, is_light, name);
R_RETURN(CreateSession(out_server_session_handle, out_client_session_handle, is_light, name));
}
Result AcceptSession64(ams::svc::Handle *out_handle, ams::svc::Handle port) {
return AcceptSession(out_handle, port);
R_RETURN(AcceptSession(out_handle, port));
}
/* ============================= 64From32 ABI ============================= */
Result CreateSession64From32(ams::svc::Handle *out_server_session_handle, ams::svc::Handle *out_client_session_handle, bool is_light, ams::svc::Address name) {
return CreateSession(out_server_session_handle, out_client_session_handle, is_light, name);
R_RETURN(CreateSession(out_server_session_handle, out_client_session_handle, is_light, name));
}
Result AcceptSession64From32(ams::svc::Handle *out_handle, ams::svc::Handle port) {
return AcceptSession(out_handle, port);
R_RETURN(AcceptSession(out_handle, port));
}
}

View file

@ -60,14 +60,10 @@ namespace ams::kern::svc {
R_TRY(process.AddSharedMemory(shmem.GetPointerUnsafe(), address, size));
/* Ensure that we clean up the shared memory if we fail to map it. */
auto guard = SCOPE_GUARD { process.RemoveSharedMemory(shmem.GetPointerUnsafe(), address, size); };
ON_RESULT_FAILURE { process.RemoveSharedMemory(shmem.GetPointerUnsafe(), address, size); };
/* Map the shared memory. */
R_TRY(shmem->Map(std::addressof(page_table), address, size, std::addressof(process), map_perm));
/* We succeeded. */
guard.Cancel();
return ResultSuccess();
R_RETURN(shmem->Map(std::addressof(page_table), address, size, std::addressof(process), map_perm));
}
Result UnmapSharedMemory(ams::svc::Handle shmem_handle, uintptr_t address, size_t size) {
@ -94,7 +90,7 @@ namespace ams::kern::svc {
/* Remove the shared memory from the process. */
process.RemoveSharedMemory(shmem.GetPointerUnsafe(), address, size);
return ResultSuccess();
R_SUCCEED();
}
Result CreateSharedMemory(ams::svc::Handle *out, size_t size, ams::svc::MemoryPermission owner_perm, ams::svc::MemoryPermission remote_perm) {
@ -122,7 +118,7 @@ namespace ams::kern::svc {
/* Add the shared memory to the handle table. */
R_TRY(GetCurrentProcess().GetHandleTable().Add(out, shmem));
return ResultSuccess();
R_SUCCEED();
}
}
@ -130,29 +126,29 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
Result MapSharedMemory64(ams::svc::Handle shmem_handle, ams::svc::Address address, ams::svc::Size size, ams::svc::MemoryPermission map_perm) {
return MapSharedMemory(shmem_handle, address, size, map_perm);
R_RETURN(MapSharedMemory(shmem_handle, address, size, map_perm));
}
Result UnmapSharedMemory64(ams::svc::Handle shmem_handle, ams::svc::Address address, ams::svc::Size size) {
return UnmapSharedMemory(shmem_handle, address, size);
R_RETURN(UnmapSharedMemory(shmem_handle, address, size));
}
Result CreateSharedMemory64(ams::svc::Handle *out_handle, ams::svc::Size size, ams::svc::MemoryPermission owner_perm, ams::svc::MemoryPermission remote_perm) {
return CreateSharedMemory(out_handle, size, owner_perm, remote_perm);
R_RETURN(CreateSharedMemory(out_handle, size, owner_perm, remote_perm));
}
/* ============================= 64From32 ABI ============================= */
Result MapSharedMemory64From32(ams::svc::Handle shmem_handle, ams::svc::Address address, ams::svc::Size size, ams::svc::MemoryPermission map_perm) {
return MapSharedMemory(shmem_handle, address, size, map_perm);
R_RETURN(MapSharedMemory(shmem_handle, address, size, map_perm));
}
Result UnmapSharedMemory64From32(ams::svc::Handle shmem_handle, ams::svc::Address address, ams::svc::Size size) {
return UnmapSharedMemory(shmem_handle, address, size);
R_RETURN(UnmapSharedMemory(shmem_handle, address, size));
}
Result CreateSharedMemory64From32(ams::svc::Handle *out_handle, ams::svc::Size size, ams::svc::MemoryPermission owner_perm, ams::svc::MemoryPermission remote_perm) {
return CreateSharedMemory(out_handle, size, owner_perm, remote_perm);
R_RETURN(CreateSharedMemory(out_handle, size, owner_perm, remote_perm));
}
}

View file

@ -24,7 +24,7 @@ namespace ams::kern::svc {
Result CloseHandle(ams::svc::Handle handle) {
/* Remove the handle. */
R_UNLESS(GetCurrentProcess().GetHandleTable().Remove(handle), svc::ResultInvalidHandle());
return ResultSuccess();
R_SUCCEED();
}
Result ResetSignal(ams::svc::Handle handle) {
@ -36,9 +36,9 @@ namespace ams::kern::svc {
KScopedAutoObject readable_event = handle_table.GetObject<KReadableEvent>(handle);
if (readable_event.IsNotNull()) {
if (auto * const interrupt_event = readable_event->DynamicCast<KInterruptEvent *>(); interrupt_event != nullptr) {
return interrupt_event->Reset();
R_RETURN(interrupt_event->Reset());
} 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);
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) {
@ -67,7 +67,7 @@ namespace ams::kern::svc {
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) {
@ -103,7 +103,7 @@ namespace ams::kern::svc {
R_CONVERT(svc::ResultSessionClosed, ResultSuccess())
} R_END_TRY_CATCH;
return ResultSuccess();
R_SUCCEED();
}
Result CancelSynchronization(ams::svc::Handle handle) {
@ -113,7 +113,7 @@ namespace ams::kern::svc {
/* Cancel the thread's wait. */
thread->WaitCancel();
return ResultSuccess();
R_SUCCEED();
}
void SynchronizePreemptionState() {
@ -136,19 +136,19 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
Result CloseHandle64(ams::svc::Handle handle) {
return CloseHandle(handle);
R_RETURN(CloseHandle(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) {
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) {
return CancelSynchronization(handle);
R_RETURN(CancelSynchronization(handle));
}
void SynchronizePreemptionState64() {
@ -158,19 +158,19 @@ namespace ams::kern::svc {
/* ============================= 64From32 ABI ============================= */
Result CloseHandle64From32(ams::svc::Handle handle) {
return CloseHandle(handle);
R_RETURN(CloseHandle(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) {
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) {
return CancelSynchronization(handle);
R_RETURN(CancelSynchronization(handle));
}
void SynchronizePreemptionState64From32() {

View file

@ -66,7 +66,7 @@ namespace ams::kern::svc {
/* Add the thread to the handle table. */
R_TRY(process.GetHandleTable().Add(out, thread));
return ResultSuccess();
R_SUCCEED();
}
Result StartThread(ams::svc::Handle thread_handle) {
@ -75,7 +75,7 @@ namespace ams::kern::svc {
R_UNLESS(thread.IsNotNull(), svc::ResultInvalidHandle());
/* Try to start the thread. */
return thread->Run();
R_RETURN(thread->Run());
}
void ExitThread() {
@ -121,7 +121,7 @@ namespace ams::kern::svc {
/* Get the thread's priority. */
*out_priority = thread->GetPriority();
return ResultSuccess();
R_SUCCEED();
}
Result SetThreadPriority(ams::svc::Handle thread_handle, int32_t priority) {
@ -141,7 +141,7 @@ namespace ams::kern::svc {
/* Set the thread 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) {
@ -152,7 +152,7 @@ namespace ams::kern::svc {
/* Get the core 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) {
@ -184,7 +184,7 @@ namespace ams::kern::svc {
/* Set the core 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) {
@ -194,7 +194,7 @@ namespace ams::kern::svc {
/* Get the thread's id. */
*out_thread_id = thread->GetId();
return ResultSuccess();
R_SUCCEED();
}
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. */
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) {
@ -252,7 +252,7 @@ namespace ams::kern::svc {
}
}
return ResultSuccess();
R_SUCCEED();
}
}
@ -260,11 +260,11 @@ namespace ams::kern::svc {
/* ============================= 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) {
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) {
return StartThread(thread_handle);
R_RETURN(StartThread(thread_handle));
}
void ExitThread64() {
@ -276,41 +276,41 @@ namespace ams::kern::svc {
}
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) {
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) {
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) {
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) {
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) {
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) {
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 ============================= */
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) {
return StartThread(thread_handle);
R_RETURN(StartThread(thread_handle));
}
void ExitThread64From32() {
@ -322,31 +322,31 @@ namespace ams::kern::svc {
}
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) {
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) {
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) {
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) {
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) {
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) {
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;
}
return ResultSuccess();
R_SUCCEED();
}
Result SynchronizeCurrentProcessToFutureTime(int64_t ns) {
@ -68,7 +68,7 @@ namespace ams::kern::svc {
/* Synchronize to the desired time. */
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) {
@ -85,7 +85,7 @@ namespace ams::kern::svc {
/* Get the running thread info. */
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) {
@ -98,7 +98,7 @@ namespace ams::kern::svc {
/* Get the thread info. */
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) {
@ -108,7 +108,7 @@ namespace ams::kern::svc {
/* Get the thread info. */
R_TRY(GetLastThreadInfoImpl(out_context, out_tls_address, out_flags));
return ResultSuccess();
R_SUCCEED();
}
}
@ -116,16 +116,16 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
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) {
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) {
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 ============================= */
@ -140,7 +140,7 @@ namespace ams::kern::svc {
.lr = static_cast<u32>(context.lr),
.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) {
@ -155,7 +155,7 @@ namespace ams::kern::svc {
.lr = static_cast<u32>(context.lr),
.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) {
@ -170,7 +170,7 @@ namespace ams::kern::svc {
.lr = static_cast<u32>(context.lr),
.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));
/* We succeeded. */
return ResultSuccess();
R_SUCCEED();
}
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. */
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) {
@ -116,7 +116,7 @@ namespace ams::kern::svc {
/* Add the transfer memory to the handle table. */
R_TRY(handle_table.Add(out, trmem));
return ResultSuccess();
R_SUCCEED();
}
}
@ -124,29 +124,29 @@ namespace ams::kern::svc {
/* ============================= 64 ABI ============================= */
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) {
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) {
return CreateTransferMemory(out_handle, address, size, map_perm);
R_RETURN(CreateTransferMemory(out_handle, address, size, map_perm));
}
/* ============================= 64From32 ABI ============================= */
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) {
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) {
return CreateTransferMemory(out_handle, address, size, map_perm);
R_RETURN(CreateTransferMemory(out_handle, address, size, map_perm));
}
}