mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Fix behavior so we can turn off "IgnoreBadMemAccess" in headless
This commit is contained in:
1 parent
cc57945280
commit
c99a303646
5 files changed
+31
-15
No files matched your search
+7
-4
@@ -1155,9 +1155,12 @@ void hleDoLogInternal(Log t, LogLevel level, u64 res, const char *file, int line
|
||||
const char *errStr = nullptr;
|
||||
switch (retmask) {
|
||||
case 'x':
|
||||
// Truncate the high bits of the result (from any sign extension.)
|
||||
res = (u32)res;
|
||||
if ((int)res < 0 && (errStr = KernelErrorToString((u32)res))) {
|
||||
case 'X':
|
||||
if (retmask == 'x') {
|
||||
// Truncate the high bits of the result (from any sign extension.)
|
||||
res = (u32)res;
|
||||
}
|
||||
if (retmask == 'x' && (int)res < 0 && (errStr = KernelErrorToString((u32)res))) {
|
||||
// It's a known syscall error code, let's display it as string.
|
||||
fmt = "%sSCE_KERNEL_ERROR_%s=%s(%s)%s";
|
||||
} else {
|
||||
@@ -1167,7 +1170,7 @@ void hleDoLogInternal(Log t, LogLevel level, u64 res, const char *file, int line
|
||||
break;
|
||||
case 'i':
|
||||
case 'I':
|
||||
if ((int)res < 0 && (errStr = KernelErrorToString((u32)res))) {
|
||||
if (retmask == 'i' && (int)res < 0 && (errStr = KernelErrorToString((u32)res))) {
|
||||
// It's a known syscall error code, let's display it as string.
|
||||
fmt = "%s%s=%s(%s)%s";
|
||||
} else {
|
||||
|
||||
@@ -122,8 +122,7 @@ struct Mbx : public KernelObject
|
||||
Memory::Write_U32(ptr, beforePtr);
|
||||
}
|
||||
|
||||
int ReceiveMessage(u32 receivePtr)
|
||||
{
|
||||
int ReceiveMessage(u32 receivePtr) {
|
||||
u32 ptr = nmb.packetListHead;
|
||||
|
||||
// Check over the linked list and reset the head.
|
||||
@@ -133,17 +132,17 @@ struct Mbx : public KernelObject
|
||||
u32 next = Memory::Read_U32(nmb.packetListHead);
|
||||
if (!Memory::IsValidAddress(next))
|
||||
return SCE_KERNEL_ERROR_ILLEGAL_ADDR;
|
||||
if (next == ptr)
|
||||
{
|
||||
if (nmb.packetListHead != ptr)
|
||||
{
|
||||
if (next == nmb.packetListHead) {
|
||||
// This will cause us to spin if we don't check for it. Not sure what the correct behavior here is.
|
||||
return SCE_KERNEL_ERROR_ILLEGAL_ADDR;
|
||||
}
|
||||
if (next == ptr) {
|
||||
if (nmb.packetListHead != ptr) {
|
||||
next = Memory::Read_U32(next);
|
||||
Memory::Write_U32(next, nmb.packetListHead);
|
||||
nmb.packetListHead = next;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (c < nmb.numMessages - 1)
|
||||
return PSP_MBX_ERROR_DUPLICATE_MSG;
|
||||
|
||||
|
||||
@@ -409,8 +409,14 @@ u32 sceKernelSetVTimerHandler(SceUID uid, u32 scheduleAddr, u32 handlerFuncAddr,
|
||||
}
|
||||
|
||||
hleEatCycles(2000);
|
||||
u64 schedule;
|
||||
if (!Memory::IsValidAddress(scheduleAddr)) {
|
||||
ERROR_LOG(Log::sceKernel, "sceKernelSetVTimerHandler: invalid schedule address %08x", scheduleAddr);
|
||||
schedule = 0;
|
||||
} else {
|
||||
schedule = Memory::ReadUnchecked_U64(scheduleAddr);
|
||||
}
|
||||
|
||||
u64 schedule = Memory::Read_U64(scheduleAddr);
|
||||
vt->nvt.handlerAddr = handlerFuncAddr;
|
||||
if (handlerFuncAddr) {
|
||||
vt->nvt.commonAddr = commonAddr;
|
||||
|
||||
@@ -158,6 +158,14 @@ inline const u8* GetPointerUnchecked(const u32 address) {
|
||||
#endif
|
||||
}
|
||||
|
||||
inline u64 ReadUnchecked_U64(const u32 address) {
|
||||
#ifdef MASKED_PSP_MEMORY
|
||||
return *(u64_le *)(base + (address & MEMVIEW32_MASK));
|
||||
#else
|
||||
return *(u64_le *)(base + address);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline u32 ReadUnchecked_U32(const u32 address) {
|
||||
#ifdef MASKED_PSP_MEMORY
|
||||
return *(u32_le *)(base + (address & MEMVIEW32_MASK));
|
||||
|
||||
@@ -552,7 +552,7 @@ int main(int argc, const char* argv[]) {
|
||||
g_Config.iDumpFileTypes = 0;
|
||||
g_Config.bEnableSound = false;
|
||||
g_Config.bFirstRun = false;
|
||||
g_Config.bIgnoreBadMemAccess = true; // NOTE: A few tests rely on this, which is BAD: threads/mbx/refer/refer , threads/mbx/send/send, threads/vtimers/interrupt
|
||||
g_Config.bIgnoreBadMemAccess = false;
|
||||
// Never report from tests.
|
||||
g_Config.sReportHost.clear();
|
||||
g_Config.bAutoSaveSymbolMap = false;
|
||||
|
||||
Reference in new issue
Block a user