ams: revamp assertion system

This commit is contained in:
Michael Scire
2020-02-22 23:05:14 -08:00
parent 9572fb2ce3
commit 40400aee1f
168 changed files with 1014 additions and 696 deletions

View File

@@ -349,7 +349,7 @@ namespace ams::spl::smc {
}
Result AtmosphereWriteAddress(void *dst, const void *src, size_t size) {
AMS_ASSERT(size <= sizeof(u64));
AMS_ABORT_UNLESS(size <= sizeof(u64));
SecmonArgs args;
args.X[0] = static_cast<u64>(FunctionId::AtmosphereWriteAddress);
@@ -363,7 +363,7 @@ namespace ams::spl::smc {
Result AtmosphereGetEmummcConfig(void *out_config, void *out_paths, u32 storage_id) {
const u64 paths = reinterpret_cast<u64>(out_paths);
AMS_ASSERT(util::IsAligned(paths, os::MemoryPageSize));
AMS_ABORT_UNLESS(util::IsAligned(paths, os::MemoryPageSize));
SecmonArgs args = {};
args.X[0] = static_cast<u64>(FunctionId::AtmosphereGetEmummcConfig);

View File

@@ -19,13 +19,13 @@ namespace ams::spl {
HardwareType GetHardwareType() {
u64 out_val = 0;
R_ASSERT(splGetConfig(SplConfigItem_HardwareType, &out_val));
R_ABORT_UNLESS(splGetConfig(SplConfigItem_HardwareType, &out_val));
return static_cast<HardwareType>(out_val);
}
MemoryArrangement GetMemoryArrangement() {
u64 arrange = 0;
R_ASSERT(splGetConfig(SplConfigItem_MemoryArrange, &arrange));
R_ABORT_UNLESS(splGetConfig(SplConfigItem_MemoryArrange, &arrange));
arrange &= 0x3F;
switch (arrange) {
case 2:
@@ -43,19 +43,19 @@ namespace ams::spl {
bool IsDevelopmentHardware() {
bool is_dev_hardware;
R_ASSERT(splIsDevelopment(&is_dev_hardware));
R_ABORT_UNLESS(splIsDevelopment(&is_dev_hardware));
return is_dev_hardware;
}
bool IsDevelopmentFunctionEnabled() {
u64 val = 0;
R_ASSERT(splGetConfig(SplConfigItem_IsDebugMode, &val));
R_ABORT_UNLESS(splGetConfig(SplConfigItem_IsDebugMode, &val));
return val != 0;
}
bool IsRecoveryBoot() {
u64 val = 0;
R_ASSERT(splGetConfig(SplConfigItem_IsRecoveryBoot, &val));
R_ABORT_UNLESS(splGetConfig(SplConfigItem_IsRecoveryBoot, &val));
return val != 0;
}