Return yet more errors while inside interrupts.
This commit is contained in:
parent
686d893d5c
commit
15a0f39fa1
9 changed files with 96 additions and 45 deletions
|
@ -16,15 +16,16 @@
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include "HLE.h"
|
#include "Core/HLE/HLE.h"
|
||||||
#include "../MIPS/MIPS.h"
|
#include "Core/MIPS/MIPS.h"
|
||||||
#include "../CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "ChunkFile.h"
|
#include "Common/ChunkFile.h"
|
||||||
#include "StdMutex.h"
|
#include "Common/StdMutex.h"
|
||||||
#include "sceCtrl.h"
|
#include "Core/HLE/sceCtrl.h"
|
||||||
#include "sceDisplay.h"
|
#include "Core/HLE/sceDisplay.h"
|
||||||
#include "sceKernel.h"
|
#include "Core/HLE/sceKernel.h"
|
||||||
#include "sceKernelThread.h"
|
#include "Core/HLE/sceKernelThread.h"
|
||||||
|
#include "Core/HLE/sceKernelInterrupt.h"
|
||||||
|
|
||||||
/* Index for the two analog directions */
|
/* Index for the two analog directions */
|
||||||
#define CTRL_ANALOG_X 0
|
#define CTRL_ANALOG_X 0
|
||||||
|
@ -218,6 +219,8 @@ int __CtrlReadBuffer(u32 ctrlDataPtr, u32 nBufs, bool negative, bool peek)
|
||||||
|
|
||||||
if (!peek && !__KernelIsDispatchEnabled())
|
if (!peek && !__KernelIsDispatchEnabled())
|
||||||
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
||||||
|
if (!peek && __IsInInterrupt())
|
||||||
|
return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT;
|
||||||
|
|
||||||
u32 resetRead = ctrlBufRead;
|
u32 resetRead = ctrlBufRead;
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ extern "C" {
|
||||||
#include "Core/HLE/sceKernel.h"
|
#include "Core/HLE/sceKernel.h"
|
||||||
#include "Core/HLE/sceKernelMemory.h"
|
#include "Core/HLE/sceKernelMemory.h"
|
||||||
#include "Core/HLE/sceKernelThread.h"
|
#include "Core/HLE/sceKernelThread.h"
|
||||||
|
#include "Core/HLE/sceKernelInterrupt.h"
|
||||||
|
|
||||||
// For headless screenshots.
|
// For headless screenshots.
|
||||||
#include "Core/HLE/sceDisplay.h"
|
#include "Core/HLE/sceDisplay.h"
|
||||||
|
@ -646,9 +647,15 @@ bool __IoRead(int &result, int id, u32 data_addr, int size) {
|
||||||
u32 sceIoRead(int id, u32 data_addr, int size) {
|
u32 sceIoRead(int id, u32 data_addr, int size) {
|
||||||
u32 error;
|
u32 error;
|
||||||
FileNode *f = __IoGetFd(id, error);
|
FileNode *f = __IoGetFd(id, error);
|
||||||
if (!__KernelIsDispatchEnabled() && id > 2 && f != NULL) {
|
if (id > 2 && f != NULL) {
|
||||||
DEBUG_LOG(HLE, "sceIoRead(%d, %08x, %x): dispatch disabled", id, data_addr, size);
|
if (!__KernelIsDispatchEnabled()) {
|
||||||
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
DEBUG_LOG(HLE, "sceIoRead(%d, %08x, %x): dispatch disabled", id, data_addr, size);
|
||||||
|
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
||||||
|
}
|
||||||
|
if (__IsInInterrupt()) {
|
||||||
|
DEBUG_LOG(HLE, "sceIoRead(%d, %08x, %x): inside interrupt", id, data_addr, size);
|
||||||
|
return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Timing is probably not very accurate, low estimate.
|
// TODO: Timing is probably not very accurate, low estimate.
|
||||||
|
@ -736,9 +743,15 @@ bool __IoWrite(int &result, int id, void *data_ptr, int size) {
|
||||||
u32 sceIoWrite(int id, u32 data_addr, int size) {
|
u32 sceIoWrite(int id, u32 data_addr, int size) {
|
||||||
u32 error;
|
u32 error;
|
||||||
FileNode *f = __IoGetFd(id, error);
|
FileNode *f = __IoGetFd(id, error);
|
||||||
if (!__KernelIsDispatchEnabled() && id > 2 && f != NULL) {
|
if (id > 2 && f != NULL) {
|
||||||
DEBUG_LOG(HLE, "sceIoWrite(%d, %08x, %x): dispatch disabled", id, data_addr, size);
|
if (!__KernelIsDispatchEnabled()) {
|
||||||
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
DEBUG_LOG(HLE, "sceIoWrite(%d, %08x, %x): dispatch disabled", id, data_addr, size);
|
||||||
|
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
||||||
|
}
|
||||||
|
if (__IsInInterrupt()) {
|
||||||
|
DEBUG_LOG(HLE, "sceIoWrite(%d, %08x, %x): inside interrupt", id, data_addr, size);
|
||||||
|
return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Timing is probably not very accurate, low estimate.
|
// TODO: Timing is probably not very accurate, low estimate.
|
||||||
|
@ -1486,12 +1499,14 @@ u32 sceIoOpenAsync(const char *filename, int flags, int mode)
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 sceIoGetAsyncStat(int id, u32 poll, u32 address)
|
u32 sceIoGetAsyncStat(int id, u32 poll, u32 address) {
|
||||||
{
|
|
||||||
u32 error;
|
u32 error;
|
||||||
FileNode *f = __IoGetFd(id, error);
|
FileNode *f = __IoGetFd(id, error);
|
||||||
if (f)
|
if (f) {
|
||||||
{
|
if (__IsInInterrupt()) {
|
||||||
|
DEBUG_LOG(HLE, "%lli = sceIoGetAsyncStat(%i, %i, %08x): illegal context", f->asyncResult, id, poll, address);
|
||||||
|
return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT;
|
||||||
|
}
|
||||||
if (f->pendingAsyncResult) {
|
if (f->pendingAsyncResult) {
|
||||||
if (poll) {
|
if (poll) {
|
||||||
DEBUG_LOG(HLE, "%lli = sceIoGetAsyncStat(%i, %i, %08x): not ready", f->asyncResult, id, poll, address);
|
DEBUG_LOG(HLE, "%lli = sceIoGetAsyncStat(%i, %i, %08x): not ready", f->asyncResult, id, poll, address);
|
||||||
|
@ -1535,6 +1550,10 @@ int sceIoWaitAsync(int id, u32 address) {
|
||||||
u32 error;
|
u32 error;
|
||||||
FileNode *f = __IoGetFd(id, error);
|
FileNode *f = __IoGetFd(id, error);
|
||||||
if (f) {
|
if (f) {
|
||||||
|
if (__IsInInterrupt()) {
|
||||||
|
DEBUG_LOG(HLE, "%lli = sceIoWaitAsync(%i, %08x): illegal context", f->asyncResult, id, address);
|
||||||
|
return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT;
|
||||||
|
}
|
||||||
if (f->pendingAsyncResult) {
|
if (f->pendingAsyncResult) {
|
||||||
if (!__KernelIsDispatchEnabled()) {
|
if (!__KernelIsDispatchEnabled()) {
|
||||||
DEBUG_LOG(HLE, "%lli = sceIoWaitAsync(%i, %08x): dispatch disabled", f->asyncResult, id, address);
|
DEBUG_LOG(HLE, "%lli = sceIoWaitAsync(%i, %08x): dispatch disabled", f->asyncResult, id, address);
|
||||||
|
@ -1570,6 +1589,11 @@ int sceIoWaitAsyncCB(int id, u32 address) {
|
||||||
u32 error;
|
u32 error;
|
||||||
FileNode *f = __IoGetFd(id, error);
|
FileNode *f = __IoGetFd(id, error);
|
||||||
if (f) {
|
if (f) {
|
||||||
|
if (__IsInInterrupt()) {
|
||||||
|
DEBUG_LOG(HLE, "%lli = sceIoWaitAsyncCB(%i, %08x): illegal context", f->asyncResult, id, address);
|
||||||
|
return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT;
|
||||||
|
}
|
||||||
|
|
||||||
hleCheckCurrentCallbacks();
|
hleCheckCurrentCallbacks();
|
||||||
if (f->pendingAsyncResult) {
|
if (f->pendingAsyncResult) {
|
||||||
DEBUG_LOG(HLE, "%lli = sceIoWaitAsyncCB(%i, %08x): waiting", f->asyncResult, id, address);
|
DEBUG_LOG(HLE, "%lli = sceIoWaitAsyncCB(%i, %08x): waiting", f->asyncResult, id, address);
|
||||||
|
|
|
@ -686,8 +686,8 @@ const HLEFunction ThreadManForUser[] =
|
||||||
//{0xBEED3A47,0, "_sceKernelUnlockLwMutex"},
|
//{0xBEED3A47,0, "_sceKernelUnlockLwMutex"},
|
||||||
|
|
||||||
{0xf8170fbe,WrapI_I<sceKernelDeleteMutex>, "sceKernelDeleteMutex"},
|
{0xf8170fbe,WrapI_I<sceKernelDeleteMutex>, "sceKernelDeleteMutex"},
|
||||||
{0xB011B11F,WrapI_IIU<sceKernelLockMutex>, "sceKernelLockMutex", HLE_NOT_DISPATCH_SUSPENDED},
|
{0xB011B11F,WrapI_IIU<sceKernelLockMutex>, "sceKernelLockMutex", HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED},
|
||||||
{0x5bf4dd27,WrapI_IIU<sceKernelLockMutexCB>, "sceKernelLockMutexCB", HLE_NOT_DISPATCH_SUSPENDED},
|
{0x5bf4dd27,WrapI_IIU<sceKernelLockMutexCB>, "sceKernelLockMutexCB", HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED},
|
||||||
{0x6b30100f,WrapI_II<sceKernelUnlockMutex>, "sceKernelUnlockMutex"},
|
{0x6b30100f,WrapI_II<sceKernelUnlockMutex>, "sceKernelUnlockMutex"},
|
||||||
{0xb7d098c6,WrapI_CUIU<sceKernelCreateMutex>, "sceKernelCreateMutex"},
|
{0xb7d098c6,WrapI_CUIU<sceKernelCreateMutex>, "sceKernelCreateMutex"},
|
||||||
{0x0DDCD2C9,WrapI_II<sceKernelTryLockMutex>, "sceKernelTryLockMutex"},
|
{0x0DDCD2C9,WrapI_II<sceKernelTryLockMutex>, "sceKernelTryLockMutex"},
|
||||||
|
|
|
@ -575,8 +575,8 @@ const HLEFunction Kernel_Library[] =
|
||||||
{0xa089eca4,WrapU_UUU<sceKernelMemset>, "sceKernelMemset"},
|
{0xa089eca4,WrapU_UUU<sceKernelMemset>, "sceKernelMemset"},
|
||||||
{0xDC692EE3,WrapI_UI<sceKernelTryLockLwMutex>, "sceKernelTryLockLwMutex"},
|
{0xDC692EE3,WrapI_UI<sceKernelTryLockLwMutex>, "sceKernelTryLockLwMutex"},
|
||||||
{0x37431849,WrapI_UI<sceKernelTryLockLwMutex_600>, "sceKernelTryLockLwMutex_600"},
|
{0x37431849,WrapI_UI<sceKernelTryLockLwMutex_600>, "sceKernelTryLockLwMutex_600"},
|
||||||
{0xbea46419,WrapI_UIU<sceKernelLockLwMutex>, "sceKernelLockLwMutex", HLE_NOT_DISPATCH_SUSPENDED},
|
{0xbea46419,WrapI_UIU<sceKernelLockLwMutex>, "sceKernelLockLwMutex", HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED},
|
||||||
{0x1FC64E09,WrapI_UIU<sceKernelLockLwMutexCB>, "sceKernelLockLwMutexCB", HLE_NOT_DISPATCH_SUSPENDED},
|
{0x1FC64E09,WrapI_UIU<sceKernelLockLwMutexCB>, "sceKernelLockLwMutexCB", HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED},
|
||||||
{0x15b6446b,WrapI_UI<sceKernelUnlockLwMutex>, "sceKernelUnlockLwMutex"},
|
{0x15b6446b,WrapI_UI<sceKernelUnlockLwMutex>, "sceKernelUnlockLwMutex"},
|
||||||
{0xc1734599,WrapI_UU<sceKernelReferLwMutexStatus>, "sceKernelReferLwMutexStatus"},
|
{0xc1734599,WrapI_UU<sceKernelReferLwMutexStatus>, "sceKernelReferLwMutexStatus"},
|
||||||
{0x293b45b8,WrapI_V<sceKernelGetThreadId>, "sceKernelGetThreadId"},
|
{0x293b45b8,WrapI_V<sceKernelGetThreadId>, "sceKernelGetThreadId"},
|
||||||
|
|
|
@ -1512,9 +1512,9 @@ const HLEFunction ModuleMgrForUser[] =
|
||||||
{
|
{
|
||||||
{0x977DE386,&WrapU_CUU<sceKernelLoadModule>,"sceKernelLoadModule"},
|
{0x977DE386,&WrapU_CUU<sceKernelLoadModule>,"sceKernelLoadModule"},
|
||||||
{0xb7f46618,&WrapU_UUU<sceKernelLoadModuleByID>,"sceKernelLoadModuleByID"},
|
{0xb7f46618,&WrapU_UUU<sceKernelLoadModuleByID>,"sceKernelLoadModuleByID"},
|
||||||
{0x50F0C1EC,&WrapV_UUUUU<sceKernelStartModule>,"sceKernelStartModule", HLE_NOT_DISPATCH_SUSPENDED},
|
{0x50F0C1EC,&WrapV_UUUUU<sceKernelStartModule>,"sceKernelStartModule", HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED},
|
||||||
{0xD675EBB8,&sceKernelExitGame,"sceKernelSelfStopUnloadModule"}, //HACK
|
{0xD675EBB8,&sceKernelExitGame,"sceKernelSelfStopUnloadModule"}, //HACK
|
||||||
{0xd1ff982a,&WrapU_UUUUU<sceKernelStopModule>,"sceKernelStopModule", HLE_NOT_DISPATCH_SUSPENDED},
|
{0xd1ff982a,&WrapU_UUUUU<sceKernelStopModule>,"sceKernelStopModule", HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED},
|
||||||
{0x2e0911aa,WrapU_U<sceKernelUnloadModule>,"sceKernelUnloadModule"},
|
{0x2e0911aa,WrapU_U<sceKernelUnloadModule>,"sceKernelUnloadModule"},
|
||||||
{0x710F61B5,0,"sceKernelLoadModuleMs"},
|
{0x710F61B5,0,"sceKernelLoadModuleMs"},
|
||||||
{0xF9275D98,0,"sceKernelLoadModuleBufferUsbWlan"}, ///???
|
{0xF9275D98,0,"sceKernelLoadModuleBufferUsbWlan"}, ///???
|
||||||
|
|
|
@ -2549,6 +2549,8 @@ int sceKernelWaitThreadEnd(SceUID threadID, u32 timeoutPtr)
|
||||||
|
|
||||||
if (!__KernelIsDispatchEnabled())
|
if (!__KernelIsDispatchEnabled())
|
||||||
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
||||||
|
if (__IsInInterrupt())
|
||||||
|
return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT;
|
||||||
|
|
||||||
u32 error;
|
u32 error;
|
||||||
Thread *t = kernelObjects.Get<Thread>(threadID, error);
|
Thread *t = kernelObjects.Get<Thread>(threadID, error);
|
||||||
|
@ -2578,6 +2580,8 @@ int sceKernelWaitThreadEndCB(SceUID threadID, u32 timeoutPtr)
|
||||||
|
|
||||||
if (!__KernelIsDispatchEnabled())
|
if (!__KernelIsDispatchEnabled())
|
||||||
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
||||||
|
if (__IsInInterrupt())
|
||||||
|
return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT;
|
||||||
|
|
||||||
u32 error;
|
u32 error;
|
||||||
Thread *t = kernelObjects.Get<Thread>(threadID, error);
|
Thread *t = kernelObjects.Get<Thread>(threadID, error);
|
||||||
|
|
|
@ -446,7 +446,7 @@ static const HLEFunction scePower[] = {
|
||||||
{0xa9d22232,0,"scePowerSetCallbackMode"},
|
{0xa9d22232,0,"scePowerSetCallbackMode"},
|
||||||
|
|
||||||
// These seem to be aliases.
|
// These seem to be aliases.
|
||||||
{0x23c31ffe,&WrapI_IUU<sceKernelVolatileMemLock>,"scePowerVolatileMemLock", HLE_NOT_DISPATCH_SUSPENDED},
|
{0x23c31ffe,&WrapI_IUU<sceKernelVolatileMemLock>,"scePowerVolatileMemLock", HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED},
|
||||||
{0xfa97a599,&WrapI_IUU<sceKernelVolatileMemTryLock>,"scePowerVolatileMemTryLock"},
|
{0xfa97a599,&WrapI_IUU<sceKernelVolatileMemTryLock>,"scePowerVolatileMemTryLock"},
|
||||||
{0xb3edd801,&WrapI_I<sceKernelVolatileMemUnlock>,"scePowerVolatileMemUnlock"},
|
{0xb3edd801,&WrapI_I<sceKernelVolatileMemUnlock>,"scePowerVolatileMemUnlock"},
|
||||||
};
|
};
|
||||||
|
@ -461,7 +461,7 @@ const HLEFunction sceSuspendForUser[] = {
|
||||||
// let you grab it.
|
// let you grab it.
|
||||||
{0xa14f40b2,&WrapI_IUU<sceKernelVolatileMemTryLock>,"sceKernelVolatileMemTryLock"},
|
{0xa14f40b2,&WrapI_IUU<sceKernelVolatileMemTryLock>,"sceKernelVolatileMemTryLock"},
|
||||||
{0xa569e425,&WrapI_I<sceKernelVolatileMemUnlock>,"sceKernelVolatileMemUnlock"},
|
{0xa569e425,&WrapI_I<sceKernelVolatileMemUnlock>,"sceKernelVolatileMemUnlock"},
|
||||||
{0x3e0271d3,&WrapI_IUU<sceKernelVolatileMemLock>,"sceKernelVolatileMemLock", HLE_NOT_DISPATCH_SUSPENDED}, //when "acquiring mem pool" (fired up)
|
{0x3e0271d3,&WrapI_IUU<sceKernelVolatileMemLock>,"sceKernelVolatileMemLock", HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED}, //when "acquiring mem pool" (fired up)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,13 @@
|
||||||
// Official git repository and contact information can be found at
|
// Official git repository and contact information can be found at
|
||||||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||||
|
|
||||||
#include "HLE.h"
|
#include "Common/ChunkFile.h"
|
||||||
#include "../MIPS/MIPS.h"
|
#include "Core/HLE/HLE.h"
|
||||||
|
#include "Core/MIPS/MIPS.h"
|
||||||
#include "Core/CoreTiming.h"
|
#include "Core/CoreTiming.h"
|
||||||
#include "ChunkFile.h"
|
#include "Core/HLE/sceUmd.h"
|
||||||
#include "sceUmd.h"
|
#include "Core/HLE/sceKernelThread.h"
|
||||||
#include "sceKernelThread.h"
|
#include "Core/HLE/sceKernelInterrupt.h"
|
||||||
|
|
||||||
const u64 MICRO_DELAY_ACTIVATE = 4000;
|
const u64 MICRO_DELAY_ACTIVATE = 4000;
|
||||||
|
|
||||||
|
@ -271,40 +272,48 @@ void __UmdWaitStat(u32 timeout)
|
||||||
int sceUmdWaitDriveStat(u32 stat)
|
int sceUmdWaitDriveStat(u32 stat)
|
||||||
{
|
{
|
||||||
if (stat == 0) {
|
if (stat == 0) {
|
||||||
DEBUG_LOG(HLE,"0=sceUmdWaitDriveStat(stat = %08x): bad status", stat);
|
DEBUG_LOG(HLE, "sceUmdWaitDriveStat(stat = %08x): bad status", stat);
|
||||||
return SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT;
|
return SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!__KernelIsDispatchEnabled()) {
|
if (!__KernelIsDispatchEnabled()) {
|
||||||
DEBUG_LOG(HLE,"0=sceUmdWaitDriveStat(stat = %08x): dispatch disabled", stat);
|
DEBUG_LOG(HLE, "sceUmdWaitDriveStat(stat = %08x): dispatch disabled", stat);
|
||||||
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
||||||
}
|
}
|
||||||
|
if (__IsInInterrupt()) {
|
||||||
|
DEBUG_LOG(HLE, "sceUmdWaitDriveStat(stat = %08x): inside interrupt", stat);
|
||||||
|
return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT;
|
||||||
|
}
|
||||||
|
|
||||||
if ((stat & __KernelUmdGetState()) == 0) {
|
if ((stat & __KernelUmdGetState()) == 0) {
|
||||||
DEBUG_LOG(HLE,"sceUmdWaitDriveStat(stat = %08x): waiting", stat);
|
DEBUG_LOG(HLE, "sceUmdWaitDriveStat(stat = %08x): waiting", stat);
|
||||||
umdWaitingThreads.push_back(UmdWaitingThread::Make(__KernelGetCurThread(), stat));
|
umdWaitingThreads.push_back(UmdWaitingThread::Make(__KernelGetCurThread(), stat));
|
||||||
__KernelWaitCurThread(WAITTYPE_UMD, 1, stat, 0, 0, "umd stat waited");
|
__KernelWaitCurThread(WAITTYPE_UMD, 1, stat, 0, 0, "umd stat waited");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG(HLE,"0=sceUmdWaitDriveStat(stat = %08x)", stat);
|
DEBUG_LOG(HLE, "0=sceUmdWaitDriveStat(stat = %08x)", stat);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sceUmdWaitDriveStatWithTimer(u32 stat, u32 timeout)
|
int sceUmdWaitDriveStatWithTimer(u32 stat, u32 timeout)
|
||||||
{
|
{
|
||||||
if (stat == 0) {
|
if (stat == 0) {
|
||||||
DEBUG_LOG(HLE,"0=sceUmdWaitDriveStatWithTimer(stat = %08x, timeout = %d): bad status", stat, timeout);
|
DEBUG_LOG(HLE, "sceUmdWaitDriveStatWithTimer(stat = %08x, timeout = %d): bad status", stat, timeout);
|
||||||
return SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT;
|
return SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!__KernelIsDispatchEnabled()) {
|
if (!__KernelIsDispatchEnabled()) {
|
||||||
DEBUG_LOG(HLE,"0=sceUmdWaitDriveStatWithTimer(stat = %08x, timeout = %d): dispatch disabled", stat, timeout);
|
DEBUG_LOG(HLE, "sceUmdWaitDriveStatWithTimer(stat = %08x, timeout = %d): dispatch disabled", stat, timeout);
|
||||||
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
||||||
}
|
}
|
||||||
|
if (__IsInInterrupt()) {
|
||||||
|
DEBUG_LOG(HLE, "sceUmdWaitDriveStatWithTimer(stat = %08x, timeout = %d): inside interrupt", stat, timeout);
|
||||||
|
return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT;
|
||||||
|
}
|
||||||
|
|
||||||
if ((stat & __KernelUmdGetState()) == 0) {
|
if ((stat & __KernelUmdGetState()) == 0) {
|
||||||
DEBUG_LOG(HLE,"0=sceUmdWaitDriveStatWithTimer(stat = %08x, timeout = %d): waiting", stat, timeout);
|
DEBUG_LOG(HLE, "sceUmdWaitDriveStatWithTimer(stat = %08x, timeout = %d): waiting", stat, timeout);
|
||||||
__UmdWaitStat(timeout);
|
__UmdWaitStat(timeout);
|
||||||
umdWaitingThreads.push_back(UmdWaitingThread::Make(__KernelGetCurThread(), stat));
|
umdWaitingThreads.push_back(UmdWaitingThread::Make(__KernelGetCurThread(), stat));
|
||||||
__KernelWaitCurThread(WAITTYPE_UMD, 1, stat, 0, 0, "umd stat waited with timer");
|
__KernelWaitCurThread(WAITTYPE_UMD, 1, stat, 0, 0, "umd stat waited with timer");
|
||||||
|
@ -313,25 +322,29 @@ int sceUmdWaitDriveStatWithTimer(u32 stat, u32 timeout)
|
||||||
hleReSchedule("umd stat checked");
|
hleReSchedule("umd stat checked");
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG(HLE,"0=sceUmdWaitDriveStatWithTimer(stat = %08x, timeout = %d)", stat, timeout);
|
DEBUG_LOG(HLE, "0=sceUmdWaitDriveStatWithTimer(stat = %08x, timeout = %d)", stat, timeout);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sceUmdWaitDriveStatCB(u32 stat, u32 timeout)
|
int sceUmdWaitDriveStatCB(u32 stat, u32 timeout)
|
||||||
{
|
{
|
||||||
if (stat == 0) {
|
if (stat == 0) {
|
||||||
DEBUG_LOG(HLE,"0=sceUmdWaitDriveStatWithTimer(stat = %08x, timeout = %d): bad status", stat, timeout);
|
DEBUG_LOG(HLE, "sceUmdWaitDriveStatCB(stat = %08x, timeout = %d): bad status", stat, timeout);
|
||||||
return SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT;
|
return SCE_KERNEL_ERROR_ERRNO_INVALID_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!__KernelIsDispatchEnabled()) {
|
if (!__KernelIsDispatchEnabled()) {
|
||||||
DEBUG_LOG(HLE,"0=sceUmdWaitDriveStatWithTimer(stat = %08x, timeout = %d): dispatch disabled", stat, timeout);
|
DEBUG_LOG(HLE, "sceUmdWaitDriveStatCB(stat = %08x, timeout = %d): dispatch disabled", stat, timeout);
|
||||||
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
||||||
}
|
}
|
||||||
|
if (__IsInInterrupt()) {
|
||||||
|
DEBUG_LOG(HLE, "sceUmdWaitDriveStatCB(stat = %08x, timeout = %d): inside interrupt", stat, timeout);
|
||||||
|
return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT;
|
||||||
|
}
|
||||||
|
|
||||||
hleCheckCurrentCallbacks();
|
hleCheckCurrentCallbacks();
|
||||||
if ((stat & __KernelUmdGetState()) == 0) {
|
if ((stat & __KernelUmdGetState()) == 0) {
|
||||||
DEBUG_LOG(HLE,"0=sceUmdWaitDriveStatCB(stat = %08x, timeout = %d): waiting", stat, timeout);
|
DEBUG_LOG(HLE, "0=sceUmdWaitDriveStatCB(stat = %08x, timeout = %d): waiting", stat, timeout);
|
||||||
if (timeout == 0) {
|
if (timeout == 0) {
|
||||||
timeout = 8000;
|
timeout = 8000;
|
||||||
}
|
}
|
||||||
|
@ -343,13 +356,13 @@ int sceUmdWaitDriveStatCB(u32 stat, u32 timeout)
|
||||||
hleReSchedule("umd stat waited");
|
hleReSchedule("umd stat waited");
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG(HLE,"0=sceUmdWaitDriveStatCB(stat = %08x, timeout = %d)", stat, timeout);
|
DEBUG_LOG(HLE, "0=sceUmdWaitDriveStatCB(stat = %08x, timeout = %d)", stat, timeout);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 sceUmdCancelWaitDriveStat()
|
u32 sceUmdCancelWaitDriveStat()
|
||||||
{
|
{
|
||||||
DEBUG_LOG(HLE,"0=sceUmdCancelWaitDriveStat()");
|
DEBUG_LOG(HLE, "0=sceUmdCancelWaitDriveStat()");
|
||||||
|
|
||||||
__KernelTriggerWait(WAITTYPE_UMD, 1, SCE_KERNEL_ERROR_WAIT_CANCEL, "umd stat ready", true);
|
__KernelTriggerWait(WAITTYPE_UMD, 1, SCE_KERNEL_ERROR_WAIT_CANCEL, "umd stat ready", true);
|
||||||
// TODO: We should call UnscheduleEvent() event here?
|
// TODO: We should call UnscheduleEvent() event here?
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "Core/Host.h"
|
#include "Core/Host.h"
|
||||||
#include "Core/Reporting.h"
|
#include "Core/Reporting.h"
|
||||||
#include "Core/HLE/sceKernelMemory.h"
|
#include "Core/HLE/sceKernelMemory.h"
|
||||||
|
#include "Core/HLE/sceKernelInterrupt.h"
|
||||||
#include "Core/HLE/sceGe.h"
|
#include "Core/HLE/sceGe.h"
|
||||||
|
|
||||||
GPUCommon::GPUCommon() :
|
GPUCommon::GPUCommon() :
|
||||||
|
@ -63,6 +64,9 @@ u32 GPUCommon::DrawSync(int mode) {
|
||||||
if (!__KernelIsDispatchEnabled()) {
|
if (!__KernelIsDispatchEnabled()) {
|
||||||
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
||||||
}
|
}
|
||||||
|
if (__IsInInterrupt()) {
|
||||||
|
return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT;
|
||||||
|
}
|
||||||
|
|
||||||
if (drawCompleteTicks > CoreTiming::GetTicks()) {
|
if (drawCompleteTicks > CoreTiming::GetTicks()) {
|
||||||
__GeWaitCurrentThread(WAITTYPE_GEDRAWSYNC, 1, "GeDrawSync");
|
__GeWaitCurrentThread(WAITTYPE_GEDRAWSYNC, 1, "GeDrawSync");
|
||||||
|
@ -143,6 +147,9 @@ int GPUCommon::ListSync(int listid, int mode) {
|
||||||
if (!__KernelIsDispatchEnabled()) {
|
if (!__KernelIsDispatchEnabled()) {
|
||||||
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
return SCE_KERNEL_ERROR_CAN_NOT_WAIT;
|
||||||
}
|
}
|
||||||
|
if (__IsInInterrupt()) {
|
||||||
|
return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT;
|
||||||
|
}
|
||||||
|
|
||||||
if (dl.waitTicks > CoreTiming::GetTicks()) {
|
if (dl.waitTicks > CoreTiming::GetTicks()) {
|
||||||
__GeWaitCurrentThread(WAITTYPE_GELISTSYNC, listid, "GeListSync");
|
__GeWaitCurrentThread(WAITTYPE_GELISTSYNC, listid, "GeListSync");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue