mirror of
https://github.com/PabloMK7/citra.git
synced 2024-12-29 11:06:12 +00:00
SVC: Replace GetPointer usage with Read32 in WaitSynchronizationN.
This commit is contained in:
parent
7772fc0731
commit
b863d6c860
|
@ -58,12 +58,12 @@ void Wrap() {
|
||||||
FuncReturn(retval);
|
FuncReturn(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <ResultCode func(s32*, u32*, s32, bool, s64)>
|
template <ResultCode func(s32*, VAddr, s32, bool, s64)>
|
||||||
void Wrap() {
|
void Wrap() {
|
||||||
s32 param_1 = 0;
|
s32 param_1 = 0;
|
||||||
s32 retval = func(¶m_1, (Kernel::Handle*)Memory::GetPointer(PARAM(1)), (s32)PARAM(2),
|
s32 retval =
|
||||||
(PARAM(3) != 0), (((s64)PARAM(4) << 32) | PARAM(0)))
|
func(¶m_1, PARAM(1), (s32)PARAM(2), (PARAM(3) != 0), (((s64)PARAM(4) << 32) | PARAM(0)))
|
||||||
.raw;
|
.raw;
|
||||||
|
|
||||||
Core::CPU().SetReg(1, (u32)param_1);
|
Core::CPU().SetReg(1, (u32)param_1);
|
||||||
FuncReturn(retval);
|
FuncReturn(retval);
|
||||||
|
|
|
@ -303,12 +303,11 @@ static ResultCode WaitSynchronization1(Kernel::Handle handle, s64 nano_seconds)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Wait for the given handles to synchronize, timeout after the specified nanoseconds
|
/// Wait for the given handles to synchronize, timeout after the specified nanoseconds
|
||||||
static ResultCode WaitSynchronizationN(s32* out, Kernel::Handle* handles, s32 handle_count,
|
static ResultCode WaitSynchronizationN(s32* out, VAddr handles_address, s32 handle_count,
|
||||||
bool wait_all, s64 nano_seconds) {
|
bool wait_all, s64 nano_seconds) {
|
||||||
Kernel::Thread* thread = Kernel::GetCurrentThread();
|
Kernel::Thread* thread = Kernel::GetCurrentThread();
|
||||||
|
|
||||||
// Check if 'handles' is invalid
|
if (!Memory::IsValidVirtualAddress(handles_address))
|
||||||
if (handles == nullptr)
|
|
||||||
return Kernel::ERR_INVALID_POINTER;
|
return Kernel::ERR_INVALID_POINTER;
|
||||||
|
|
||||||
// NOTE: on real hardware, there is no nullptr check for 'out' (tested with firmware 4.4). If
|
// NOTE: on real hardware, there is no nullptr check for 'out' (tested with firmware 4.4). If
|
||||||
|
@ -323,7 +322,8 @@ static ResultCode WaitSynchronizationN(s32* out, Kernel::Handle* handles, s32 ha
|
||||||
std::vector<ObjectPtr> objects(handle_count);
|
std::vector<ObjectPtr> objects(handle_count);
|
||||||
|
|
||||||
for (int i = 0; i < handle_count; ++i) {
|
for (int i = 0; i < handle_count; ++i) {
|
||||||
auto object = Kernel::g_handle_table.Get<Kernel::WaitObject>(handles[i]);
|
Kernel::Handle handle = Memory::Read32(handles_address + i * sizeof(Kernel::Handle));
|
||||||
|
auto object = Kernel::g_handle_table.Get<Kernel::WaitObject>(handle);
|
||||||
if (object == nullptr)
|
if (object == nullptr)
|
||||||
return ERR_INVALID_HANDLE;
|
return ERR_INVALID_HANDLE;
|
||||||
objects[i] = object;
|
objects[i] = object;
|
||||||
|
|
Loading…
Reference in a new issue