From 1d6399c222e6c0478193160648cddf43b8d8eff9 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 26 Nov 2018 18:48:07 -0500 Subject: svc: Implement svcGetResourceLimitLimitValue() This kernel service function retrieves the maximum allowable value for a provided resource category for a given resource limit instance. Given we already have the functionality added to the resource limit instance itself, it's sufficient to just hook it up. The error scenarios for this are: 1. If an invalid resource category type is provided, then ERR_INVALID_ENUM is returned. 2. If an invalid handle is provided, then ERR_INVALID_HANDLE is returned (bad thing goes in, bad thing goes out, as one would expect). If neither of the above error cases occur, then the out parameter is provided with the maximum limit value for the given category and success is returned. --- src/core/hle/kernel/resource_limit.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/core/hle/kernel/resource_limit.h') diff --git a/src/core/hle/kernel/resource_limit.h b/src/core/hle/kernel/resource_limit.h index bec065543..59dc11c22 100644 --- a/src/core/hle/kernel/resource_limit.h +++ b/src/core/hle/kernel/resource_limit.h @@ -14,7 +14,7 @@ namespace Kernel { class KernelCore; -enum class ResourceType { +enum class ResourceType : u32 { PhysicalMemory, Threads, Events, @@ -25,6 +25,10 @@ enum class ResourceType { ResourceTypeCount }; +constexpr bool IsValidResourceType(ResourceType type) { + return type < ResourceType::ResourceTypeCount; +} + class ResourceLimit final : public Object { public: /** -- cgit v1.2.3