SVC: Removed GetPointer usage in the GetResourceLimit functions.

This commit is contained in:
Subv 2017-10-04 12:23:08 -05:00
parent 46fc7595b4
commit 97f262c1f5

View File

@ -644,9 +644,9 @@ static ResultCode GetResourceLimit(Kernel::Handle* resource_limit, Kernel::Handl
} }
/// Get resource limit current values /// Get resource limit current values
static ResultCode GetResourceLimitCurrentValues(s64* values, Kernel::Handle resource_limit_handle, static ResultCode GetResourceLimitCurrentValues(VAddr values, Kernel::Handle resource_limit_handle,
u32* names, u32 name_count) { VAddr names, u32 name_count) {
LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d", LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%08X, name_count=%d",
resource_limit_handle, names, name_count); resource_limit_handle, names, name_count);
SharedPtr<Kernel::ResourceLimit> resource_limit = SharedPtr<Kernel::ResourceLimit> resource_limit =
@ -654,16 +654,19 @@ static ResultCode GetResourceLimitCurrentValues(s64* values, Kernel::Handle reso
if (resource_limit == nullptr) if (resource_limit == nullptr)
return ERR_INVALID_HANDLE; return ERR_INVALID_HANDLE;
for (unsigned int i = 0; i < name_count; ++i) for (unsigned int i = 0; i < name_count; ++i) {
values[i] = resource_limit->GetCurrentResourceValue(names[i]); u32 name = Memory::Read32(names + i * sizeof(u32));
s64 value = resource_limit->GetCurrentResourceValue(name);
Memory::Write64(values + i * sizeof(u64), value);
}
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
/// Get resource limit max values /// Get resource limit max values
static ResultCode GetResourceLimitLimitValues(s64* values, Kernel::Handle resource_limit_handle, static ResultCode GetResourceLimitLimitValues(VAddr values, Kernel::Handle resource_limit_handle,
u32* names, u32 name_count) { VAddr names, u32 name_count) {
LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%p, name_count=%d", LOG_TRACE(Kernel_SVC, "called resource_limit=%08X, names=%08X, name_count=%d",
resource_limit_handle, names, name_count); resource_limit_handle, names, name_count);
SharedPtr<Kernel::ResourceLimit> resource_limit = SharedPtr<Kernel::ResourceLimit> resource_limit =
@ -671,8 +674,11 @@ static ResultCode GetResourceLimitLimitValues(s64* values, Kernel::Handle resour
if (resource_limit == nullptr) if (resource_limit == nullptr)
return ERR_INVALID_HANDLE; return ERR_INVALID_HANDLE;
for (unsigned int i = 0; i < name_count; ++i) for (unsigned int i = 0; i < name_count; ++i) {
values[i] = resource_limit->GetMaxResourceValue(names[i]); u32 name = Memory::Read32(names + i * sizeof(u32));
s64 value = resource_limit->GetMaxResourceValue(names);
Memory::Write64(values + i * sizeof(u64), value);
}
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }