Some stubs, "NOP" out registerexitcallback, implement cancelwakeup

This commit is contained in:
Henrik Rydgard 2012-11-12 00:04:57 +01:00
parent ce5afbc166
commit 4c1883e73f
7 changed files with 56 additions and 18 deletions

View File

@ -136,7 +136,7 @@ void sceKernelExitGameWithStatus()
void sceKernelRegisterExitCallback() void sceKernelRegisterExitCallback()
{ {
u32 cbId = PARAM(0); u32 cbId = PARAM(0);
ERROR_LOG(HLE,"UNIMPL sceKernelRegisterExitCallback(%i)", cbId); DEBUG_LOG(HLE,"NOP sceKernelRegisterExitCallback(%i)", cbId);
RETURN(0); RETURN(0);
} }
@ -290,8 +290,6 @@ void sceKernelIcacheClearAll()
RETURN(0); RETURN(0);
} }
struct SystemStatus { struct SystemStatus {
SceSize size; SceSize size;
SceUInt status; SceUInt status;
@ -302,7 +300,6 @@ struct SystemStatus {
SceUInt perfcounter3; SceUInt perfcounter3;
}; };
u32 sceKernelReferSystemStatus(u32 statusPtr) u32 sceKernelReferSystemStatus(u32 statusPtr)
{ {
DEBUG_LOG(HLE, "sceKernelReferSystemStatus(%08x)", statusPtr); DEBUG_LOG(HLE, "sceKernelReferSystemStatus(%08x)", statusPtr);
@ -315,6 +312,11 @@ u32 sceKernelReferSystemStatus(u32 statusPtr)
return 0; return 0;
} }
u32 sceKernelReferGlobalProfiler(u32 statusPtr) {
DEBUG_LOG(HLE, "sceKernelReferGlobalProfiler(%08x)", statusPtr);
// Ignore for now
return 0;
}
const HLEFunction ThreadManForUser[] = const HLEFunction ThreadManForUser[] =
{ {
@ -348,7 +350,7 @@ const HLEFunction ThreadManForUser[] =
// NOTE: LockLwMutex and UnlockLwMutex are in Kernel_Library, see sceKernelInterrupt.cpp. // NOTE: LockLwMutex and UnlockLwMutex are in Kernel_Library, see sceKernelInterrupt.cpp.
{0xFCCFAD26,0,"sceKernelCancelWakeupThread"}, {0xFCCFAD26,sceKernelCancelWakeupThread,"sceKernelCancelWakeupThread"},
{0xea748e31,sceKernelChangeCurrentThreadAttr,"sceKernelChangeCurrentThreadAttr"}, {0xea748e31,sceKernelChangeCurrentThreadAttr,"sceKernelChangeCurrentThreadAttr"},
{0x71bc9871,sceKernelChangeThreadPriority,"sceKernelChangeThreadPriority"}, {0x71bc9871,sceKernelChangeThreadPriority,"sceKernelChangeThreadPriority"},
{0x446D8DE6,sceKernelCreateThread,"sceKernelCreateThread"}, {0x446D8DE6,sceKernelCreateThread,"sceKernelCreateThread"},
@ -401,7 +403,7 @@ const HLEFunction ThreadManForUser[] =
{0xdb738f35,sceKernelGetSystemTime,"sceKernelGetSystemTime"}, {0xdb738f35,sceKernelGetSystemTime,"sceKernelGetSystemTime"},
{0x369ed59d,sceKernelGetSystemTimeLow,"sceKernelGetSystemTimeLow"}, {0x369ed59d,sceKernelGetSystemTimeLow,"sceKernelGetSystemTimeLow"},
{0x8218B4DD,0,"sceKernelReferGlobalProfiler"}, {0x8218B4DD,&WrapU_U<sceKernelReferGlobalProfiler>,"sceKernelReferGlobalProfiler"},
{0x627E6F3A,&WrapU_U<sceKernelReferSystemStatus>,"sceKernelReferSystemStatus"}, {0x627E6F3A,&WrapU_U<sceKernelReferSystemStatus>,"sceKernelReferSystemStatus"},
{0x64D4540E,0,"sceKernelReferThreadProfiler"}, {0x64D4540E,0,"sceKernelReferThreadProfiler"},

View File

@ -1152,6 +1152,26 @@ void sceKernelWakeupThread()
} }
} }
else { else {
ERROR_LOG(HLE,"sceKernelWakeupThread(%i) - bad thread id");
RETURN(error);
}
}
void sceKernelCancelWakeupThread()
{
SceUID uid = PARAM(0);
u32 error;
if (uid == 0) uid == __KernelGetCurThread();
Thread *t = kernelObjects.Get<Thread>(uid, error);
if (t)
{
int wCount = t->nt.wakeupCount;
t->nt.wakeupCount = 0;
DEBUG_LOG(HLE,"sceKernelCancelWakeupThread(%i) - wakeupCount reset from %i", uid, wCount);
RETURN(wCount);
}
else {
ERROR_LOG(HLE,"sceKernelCancelWakeupThread(%i) - bad thread id");
RETURN(error); RETURN(error);
} }
} }

View File

@ -46,6 +46,7 @@ void sceKernelCheckThreadStack();
void sceKernelSuspendThread(); void sceKernelSuspendThread();
void sceKernelResumeThread(); void sceKernelResumeThread();
void sceKernelWakeupThread(); void sceKernelWakeupThread();
void sceKernelCancelWakeupThread();
void sceKernelTerminateDeleteThread(); void sceKernelTerminateDeleteThread();
void sceKernelWaitThreadEndCB(); void sceKernelWaitThreadEndCB();
void sceKernelGetThreadExitStatus(); void sceKernelGetThreadExitStatus();

View File

@ -197,8 +197,21 @@ void scePowerSetClockFrequency(u32 cpufreq, u32 busfreq, u32 gpufreq)
} }
void scePowerGetCpuClockFrequencyInt() { void scePowerGetCpuClockFrequencyInt() {
INFO_LOG(HLE,"scePowerGetCpuClockFrequencyInt()"); int freq = CoreTiming::GetClockFrequencyMHz();
RETURN(CoreTiming::GetClockFrequencyMHz()); INFO_LOG(HLE,"%i=scePowerGetCpuClockFrequencyInt()", freq);
RETURN(freq);
}
void scePowerGetPllClockFrequencyInt() {
int freq = CoreTiming::GetClockFrequencyMHz() / 2;
INFO_LOG(HLE,"%i=scePowerGetPllClockFrequencyInt()", freq);
RETURN(freq);
}
void scePowerGetBusClockFrequencyInt() {
int freq = CoreTiming::GetClockFrequencyMHz() / 2;
INFO_LOG(HLE,"%i=scePowerGetBusClockFrequencyInt()", freq);
RETURN(freq);
} }
static const HLEFunction scePower[] = static const HLEFunction scePower[] =
@ -244,11 +257,11 @@ static const HLEFunction scePower[] =
{0xFEE03A2F,0,"scePowerGetCpuClockFrequency"}, {0xFEE03A2F,0,"scePowerGetCpuClockFrequency"},
{0x478FE6F5,0,"scePowerGetBusClockFrequency"}, {0x478FE6F5,0,"scePowerGetBusClockFrequency"},
{0xFDB5BFE9,scePowerGetCpuClockFrequencyInt,"scePowerGetCpuClockFrequencyInt"}, {0xFDB5BFE9,scePowerGetCpuClockFrequencyInt,"scePowerGetCpuClockFrequencyInt"},
{0xBD681969,0,"scePowerGetBusClockFrequencyInt"}, {0xBD681969,scePowerGetBusClockFrequencyInt,"scePowerGetBusClockFrequencyInt"},
{0xB1A52C83,0,"scePowerGetCpuClockFrequencyFloat"}, {0xB1A52C83,0,"scePowerGetCpuClockFrequencyFloat"},
{0x9BADB3EB,0,"scePowerGetBusClockFrequencyFloat"}, {0x9BADB3EB,0,"scePowerGetBusClockFrequencyFloat"},
{0x737486F2,&WrapV_UUU<scePowerSetClockFrequency>,"scePowerSetClockFrequency"}, {0x737486F2,&WrapV_UUU<scePowerSetClockFrequency>,"scePowerSetClockFrequency"},
{0x34f9c463,0,"scePowerGetPllClockFrequencyInt"}, {0x34f9c463,scePowerGetPllClockFrequencyInt,"scePowerGetPllClockFrequencyInt"},
{0xea382a27,0,"scePowerGetPllClockFrequencyFloat"}, {0xea382a27,0,"scePowerGetPllClockFrequencyFloat"},
{0xebd177d6,0,"scePower_driver_EBD177D6"}, {0xebd177d6,0,"scePower_driver_EBD177D6"},
{0x469989ad,0,"scePower_469989ad"}, {0x469989ad,0,"scePower_469989ad"},

View File

@ -648,19 +648,20 @@ namespace MIPSInt
switch ((op >> 16) & 3) { switch ((op >> 16) & 3) {
case 0: // vuc2i case 0: // vuc2i
// Quad is the only option // Quad is the only option.
// This operation is weird. This particular way of working matches hw but does not
// seem quite sane.
{ {
_dbg_assert_msg_(CPU,0,"Trying to interpret instruction that can't be interpreted");
// this op appears to be bugged and most likely useless, and this stuff is wrong. I've disabled this op in the vfpu_convert test
u32 value = s[0]; u32 value = s[0];
u32 value2 = value / 2; u32 value2 = value / 2;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
d[i] = ((value & 0xFF) << 24) | replicate3(value2); d[i] = (u32)((value & 0xFF) * 0x01010101) >> 1;
value >>= 8; value >>= 8;
value2 >>= 8;
} }
oz = V_Quad;
} }
break; break;
case 1: // vc2i case 1: // vc2i
// Quad is the only option // Quad is the only option
{ {
@ -669,6 +670,7 @@ namespace MIPSInt
d[1] = (value & 0xFF00) << 16; d[1] = (value & 0xFF00) << 16;
d[2] = (value & 0xFF0000) << 8; d[2] = (value & 0xFF0000) << 8;
d[3] = (value & 0xFF000000); d[3] = (value & 0xFF000000);
oz = V_Quad;
} }
break; break;

@ -1 +1 @@
Subproject commit 9a13f86079323e848216c95f534ce0abeef8da03 Subproject commit adb26d32dff06a25d5f10f80e3c9e1e7ccd763d0

View File

@ -91,8 +91,8 @@ def init():
print "Please run git submodule init; git submodule update;" print "Please run git submodule init; git submodule update;"
sys.exit(1) sys.exit(1)
if not os.path.exists(TEST_ROOT + "cpu/cpu/cpu.elf"): if not os.path.exists(TEST_ROOT + "cpu/cpu/cpu.prx"):
print "Please install the pspsdk and run build.sh or build.bat in pspautotests/tests" print "Please install the pspsdk and run make in common/ and in all the tests"
sys.exit(1) sys.exit(1)
for p in PPSSPP_EXECUTABLES: for p in PPSSPP_EXECUTABLES: