SVC: Removed GetPointer usage in the GetResourceLimit functions.

master
Subv 2017-10-04 12:23:08 +07:00
parent 46fc7595b4
commit 97f262c1f5
1 changed files with 16 additions and 10 deletions

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