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
109 changed files with 1355 additions and 1380 deletions

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));
}
}