os: implement waitable management.
This implements waitable management for Events (and implements Events). It also refactors PM to use new Event/Waitable semantics, and also adds STS_ASSERT as a macro for asserting a boolean expression. The rest of stratosphere has been refactored to use STS_ASSERT whenever possible.
This commit is contained in:
@@ -218,9 +218,7 @@ namespace sts::pm::resource {
|
||||
g_resource_limits[ResourceLimitGroup_Applet][LimitableResource_Threads];
|
||||
|
||||
/* Ensure we don't over-commit threads. */
|
||||
if (total_threads_available < total_threads_allocated) {
|
||||
std::abort();
|
||||
}
|
||||
STS_ASSERT(total_threads_allocated <= total_threads_available);
|
||||
|
||||
/* Set number of extra threads. */
|
||||
g_extra_application_threads_available = total_threads_available - total_threads_allocated;
|
||||
@@ -244,9 +242,7 @@ namespace sts::pm::resource {
|
||||
const u64 reserved_non_system_size = (application_size + applet_size + ReservedMemorySize600);
|
||||
|
||||
/* Ensure there's enough memory for the system region. */
|
||||
if (reserved_non_system_size >= total_memory) {
|
||||
std::abort();
|
||||
}
|
||||
STS_ASSERT(reserved_non_system_size < total_memory);
|
||||
|
||||
g_memory_resource_limits[spl::MemoryArrangement_Dynamic][ResourceLimitGroup_System] = total_memory - reserved_non_system_size;
|
||||
} else {
|
||||
@@ -344,9 +340,8 @@ namespace sts::pm::resource {
|
||||
|
||||
Result GetResourceLimitValues(u64 *out_cur, u64 *out_lim, ResourceLimitGroup group, LimitableResource resource) {
|
||||
/* Do not allow out of bounds access. */
|
||||
if (group >= ResourceLimitGroup_Count || resource >= LimitableResource_Count) {
|
||||
std::abort();
|
||||
}
|
||||
STS_ASSERT(group < ResourceLimitGroup_Count);
|
||||
STS_ASSERT(resource < LimitableResource_Count);
|
||||
|
||||
const Handle reslimit_hnd = GetResourceLimitHandle(group);
|
||||
R_TRY(svcGetResourceLimitCurrentValue(out_cur, reslimit_hnd, resource));
|
||||
|
||||
Reference in New Issue
Block a user