mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
HLE auto log flag: Will let us entirely omit logging code from most syscalls, while still getting good logging.
Unfortunately, we do lose the file/line information if we do this. On the other hand, in every message like this, the HLE function name will be there, so maybe not a big deal.
This commit is contained in:
1 parent
30237b3be9
commit
6424cfa88d
4 files changed
+13
-7
No files matched your search
@@ -735,6 +735,10 @@ static void PerformCallSyscall(const HLEFunction *info) {
|
||||
RETURN(hleLogDebug(Log::HLE, SCE_KERNEL_ERROR_ILLEGAL_CONTEXT, "in interrupt"));
|
||||
} else {
|
||||
info->func();
|
||||
if (flags & HLE_AUTO_LOG) {
|
||||
int retval = currentMIPS->r[MIPS_REG_V0];
|
||||
retval = hleLogDebugOrError(info->logCat, retval);
|
||||
}
|
||||
}
|
||||
|
||||
// Now, g_stackSize should be back to 0. Enable this for "pedantic mode", will find a lot of problems.
|
||||
@@ -769,6 +773,7 @@ const HLEFunction *GetSyscallFuncPointer(MIPSOpcode op) {
|
||||
return &moduleDB[modulenum].funcTable[funcnum];
|
||||
}
|
||||
|
||||
// This almost never returns a direct function, we nearly always return PerformCallSyscall.
|
||||
void *GetQuickSyscallFunc(MIPSOpcode op) {
|
||||
if (coreCollectDebugStats)
|
||||
return nullptr;
|
||||
@@ -789,6 +794,7 @@ void hleSetFlipTime(double t) {
|
||||
hleFlipTime = t;
|
||||
}
|
||||
|
||||
// This is only called when debug stats is on. In that case, code is recompiled to call this instead of using GetQuickSyscallFunc to bypass it.
|
||||
void CallSyscall(MIPSOpcode op) {
|
||||
PROFILE_THIS_SCOPE("syscall");
|
||||
double start = 0.0; // need to initialize to fix the race condition where coreCollectDebugStats is enabled in the middle of this func.
|
||||
|
||||
@@ -47,6 +47,8 @@ enum {
|
||||
HLE_CLEAR_STACK_BYTES = 1 << 10,
|
||||
// Indicates that this call operates in kernel mode.
|
||||
HLE_KERNEL_SYSCALL = 1 << 11,
|
||||
// Indicates that the framework performs the logging, depending on the return value.
|
||||
HLE_AUTO_LOG = 1 << 12,
|
||||
};
|
||||
|
||||
struct HLEFunction {
|
||||
@@ -74,6 +76,7 @@ struct HLEFunction {
|
||||
u32 flags;
|
||||
// See HLE_CLEAR_STACK_BYTES.
|
||||
u32 stackBytesToClear;
|
||||
Log logCat;
|
||||
};
|
||||
|
||||
struct HLEModule {
|
||||
|
||||
@@ -951,7 +951,7 @@ static void __DisplayWaitForVblanksCB(const char *reason, int vblanks) {
|
||||
|
||||
static int sceDisplayWaitVblankStart() {
|
||||
__DisplayWaitForVblanks("vblank start waited", 1);
|
||||
return hleLogDebug(Log::sceDisplay, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int sceDisplayWaitVblank() {
|
||||
@@ -1107,7 +1107,7 @@ const HLEFunction sceDisplay[] = {
|
||||
{0X289D82FE, &WrapI_UIII<sceDisplaySetFramebuf>, "sceDisplaySetFrameBuf", 'i', "xiii"},
|
||||
{0XEEDA2E54, &WrapU_UUUI<sceDisplayGetFramebuf>, "sceDisplayGetFrameBuf", 'x', "pppi"},
|
||||
{0X36CDFADE, &WrapI_V<sceDisplayWaitVblank>, "sceDisplayWaitVblank", 'i', "", HLE_NOT_DISPATCH_SUSPENDED },
|
||||
{0X984C27E7, &WrapI_V<sceDisplayWaitVblankStart>, "sceDisplayWaitVblankStart", 'i', "", HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED },
|
||||
{0X984C27E7, &WrapI_V<sceDisplayWaitVblankStart>, "sceDisplayWaitVblankStart", 'i', "", HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED | HLE_AUTO_LOG, 0, Log::sceDisplay },
|
||||
{0X40F1469C, &WrapI_I<sceDisplayWaitVblankStartMulti>, "sceDisplayWaitVblankStartMulti", 'i', "i" },
|
||||
{0X8EB9EC49, &WrapI_V<sceDisplayWaitVblankCB>, "sceDisplayWaitVblankCB", 'i', "", HLE_NOT_DISPATCH_SUSPENDED },
|
||||
{0X46F186C3, &WrapI_V<sceDisplayWaitVblankStartCB>, "sceDisplayWaitVblankStartCB", 'i', "", HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED },
|
||||
|
||||
@@ -690,14 +690,11 @@ void ArmJit::Comp_Syscall(MIPSOpcode op)
|
||||
#else
|
||||
// Skip the CallSyscall where possible.
|
||||
void *quickFunc = GetQuickSyscallFunc(op);
|
||||
if (quickFunc)
|
||||
{
|
||||
if (quickFunc) {
|
||||
gpr.SetRegImm(R0, (u32)(intptr_t)GetSyscallFuncPointer(op));
|
||||
// Already flushed, so R1 is safe.
|
||||
QuickCallFunction(R1, quickFunc);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
gpr.SetRegImm(R0, op.encoding);
|
||||
QuickCallFunction(R1, (void *)&CallSyscall);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user