2012-11-01 15:19:01 +00:00
// Copyright (c) 2012- PPSSPP Project.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
2012-11-04 22:01:49 +00:00
// the Free Software Foundation, version 2.0 or later versions.
2012-11-01 15:19:01 +00:00
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License 2.0 for more details.
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
2020-08-10 07:12:51 +00:00
# include "Common/Serialize/SerializeFuncs.h"
2020-08-10 04:20:42 +00:00
# include "Common/LogManager.h"
2013-12-29 23:11:29 +00:00
# include "Core/Core.h"
2013-04-13 08:13:28 +00:00
# include "Core/Config.h"
2013-05-31 05:42:27 +00:00
# include "Core/CwCheat.h"
2015-04-06 01:09:35 +00:00
# include "Core/MemMapHelpers.h"
2013-04-13 08:13:28 +00:00
# include "Core/HLE/HLE.h"
2014-03-15 18:22:19 +00:00
# include "Core/HLE/FunctionWrappers.h"
2013-04-13 08:13:28 +00:00
# include "Core/MIPS/MIPS.h"
# include "Core/MIPS/MIPSCodeUtils.h"
# include "Core/MIPS/MIPSInt.h"
2014-03-15 18:44:02 +00:00
# include "Core/MIPS/JitCommon/JitCommon.h"
2012-11-01 15:19:01 +00:00
2013-09-07 20:31:14 +00:00
# include "Core/FileSystems/FileSystem.h"
# include "Core/FileSystems/MetaFileSystem.h"
# include "Core/PSPLoaders.h"
# include "Core/CoreTiming.h"
# include "Core/Reporting.h"
# include "Core/SaveState.h"
# include "Core/System.h"
# include "GPU/GPUInterface.h"
# include "GPU/GPUState.h"
2012-11-01 15:19:01 +00:00
# include "__sceAudio.h"
2013-02-01 16:31:51 +00:00
# include "sceAtrac.h"
2012-11-01 15:19:01 +00:00
# include "sceAudio.h"
2014-03-27 21:53:57 +00:00
# include "sceAudiocodec.h"
2013-07-21 04:49:49 +00:00
# include "sceCcc.h"
2012-12-02 23:44:23 +00:00
# include "sceCtrl.h"
2012-11-01 15:19:01 +00:00
# include "sceDisplay.h"
2012-12-28 07:00:04 +00:00
# include "sceFont.h"
2012-11-01 15:19:01 +00:00
# include "sceGe.h"
# include "sceIo.h"
2013-07-05 08:55:57 +00:00
# include "sceJpeg.h"
2012-11-01 15:19:01 +00:00
# include "sceKernel.h"
# include "sceKernelAlarm.h"
2019-08-08 15:23:41 +00:00
# include "sceKernelHeap.h"
2012-11-01 15:19:01 +00:00
# include "sceKernelInterrupt.h"
# include "sceKernelThread.h"
# include "sceKernelMemory.h"
2014-03-15 18:44:02 +00:00
# include "sceKernelModule.h"
2012-11-01 15:19:01 +00:00
# include "sceKernelMutex.h"
# include "sceKernelMbx.h"
# include "sceKernelMsgPipe.h"
# include "sceKernelSemaphore.h"
# include "sceKernelEventFlag.h"
# include "sceKernelVTimer.h"
# include "sceKernelTime.h"
2013-10-25 03:07:07 +00:00
# include "sceMp3.h"
2012-11-13 17:05:26 +00:00
# include "sceMpeg.h"
2013-03-24 23:07:30 +00:00
# include "sceNet.h"
2013-09-06 22:55:42 +00:00
# include "sceNetAdhoc.h"
2012-11-10 09:15:11 +00:00
# include "scePower.h"
2012-11-01 15:19:01 +00:00
# include "sceUtility.h"
# include "sceUmd.h"
2013-05-05 17:12:29 +00:00
# include "sceRtc.h"
2012-12-06 15:24:25 +00:00
# include "sceSsl.h"
2012-12-17 20:45:32 +00:00
# include "sceSas.h"
2012-12-24 18:44:40 +00:00
# include "scePsmf.h"
2012-12-24 06:47:52 +00:00
# include "sceImpose.h"
# include "sceUsb.h"
2017-08-20 18:03:06 +00:00
# include "sceUsbGps.h"
2020-07-31 02:24:17 +00:00
# include "sceUsbCam.h"
# include "sceUsbMic.h"
2013-02-24 17:27:37 +00:00
# include "scePspNpDrm_user.h"
2013-05-19 22:45:34 +00:00
# include "sceVaudio.h"
2013-09-04 03:05:14 +00:00
# include "sceHeap.h"
2014-03-04 15:55:08 +00:00
# include "sceDmac.h"
2014-04-11 07:03:13 +00:00
# include "sceMp4.h"
2020-08-07 13:09:14 +00:00
# include "sceOpenPSID.h"
2012-11-01 15:19:01 +00:00
2012-11-18 12:04:49 +00:00
# include "../Util/PPGeDraw.h"
2012-11-01 15:19:01 +00:00
/*
17 : [ MIPS32 R4K 00000000 ] : Loader : Type : 1 Vaddr : 00000000 Filesz : 2856816 Memsz : 2856816
18 : [ MIPS32 R4K 00000000 ] : Loader : Loadable Segment Copied to 0898 dab0 , size 002 b9770
19 : [ MIPS32 R4K 00000000 ] : Loader : Type : 1 Vaddr : 002 b9770 Filesz : 14964 Memsz : 733156
20 : [ MIPS32 R4K 00000000 ] : Loader : Loadable Segment Copied to 08 c47220 , size 000 b2fe4
*/
static bool kernelRunning = false ;
2012-12-27 22:21:39 +00:00
KernelObjectPool kernelObjects ;
2013-01-10 22:42:46 +00:00
KernelStats kernelStats ;
2013-05-04 11:34:33 +00:00
u32 registeredExitCbId ;
2012-11-01 15:19:01 +00:00
void __KernelInit ( )
{
if ( kernelRunning )
{
2013-09-07 20:02:55 +00:00
ERROR_LOG ( SCEKERNEL , " Can't init kernel when kernel is running " ) ;
2012-11-01 15:19:01 +00:00
return ;
}
2020-08-18 07:18:24 +00:00
INFO_LOG ( SCEKERNEL , " Initializing kernel... " ) ;
2012-11-01 15:19:01 +00:00
2013-01-02 09:09:44 +00:00
__KernelTimeInit ( ) ;
2012-12-27 23:56:46 +00:00
__InterruptsInit ( ) ;
2012-11-01 15:19:01 +00:00
__KernelMemoryInit ( ) ;
__KernelThreadingInit ( ) ;
2012-12-24 05:27:26 +00:00
__KernelAlarmInit ( ) ;
2013-03-01 14:55:58 +00:00
__KernelVTimerInit ( ) ;
2012-12-24 05:27:26 +00:00
__KernelEventFlagInit ( ) ;
__KernelMbxInit ( ) ;
2012-12-27 23:56:46 +00:00
__KernelMutexInit ( ) ;
__KernelSemaInit ( ) ;
2013-08-18 16:35:17 +00:00
__KernelMsgPipeInit ( ) ;
2012-11-01 15:19:01 +00:00
__IoInit ( ) ;
2013-07-05 08:55:57 +00:00
__JpegInit ( ) ;
2012-11-01 15:19:01 +00:00
__AudioInit ( ) ;
2012-12-17 20:45:32 +00:00
__SasInit ( ) ;
2013-02-01 16:31:51 +00:00
__AtracInit ( ) ;
2013-07-21 04:49:49 +00:00
__CccInit ( ) ;
2012-11-01 15:19:01 +00:00
__DisplayInit ( ) ;
__GeInit ( ) ;
2012-11-10 09:15:11 +00:00
__PowerInit ( ) ;
2012-11-01 15:19:01 +00:00
__UtilityInit ( ) ;
__UmdInit ( ) ;
2013-06-08 20:53:36 +00:00
__MpegInit ( ) ;
2012-12-24 18:44:40 +00:00
__PsmfInit ( ) ;
2012-12-02 23:44:23 +00:00
__CtrlInit ( ) ;
2013-05-05 17:12:29 +00:00
__RtcInit ( ) ;
2012-12-06 15:24:25 +00:00
__SslInit ( ) ;
2012-12-24 06:47:52 +00:00
__ImposeInit ( ) ;
__UsbInit ( ) ;
2012-12-28 07:00:04 +00:00
__FontInit ( ) ;
2013-03-24 23:07:30 +00:00
__NetInit ( ) ;
2013-09-06 22:55:42 +00:00
__NetAdhocInit ( ) ;
2013-05-19 22:45:34 +00:00
__VaudioInit ( ) ;
2013-05-18 04:49:44 +00:00
__CheatInit ( ) ;
2013-10-01 22:54:15 +00:00
__HeapInit ( ) ;
2014-03-04 15:55:08 +00:00
__DmacInit ( ) ;
2014-03-27 21:53:57 +00:00
__AudioCodecInit ( ) ;
2014-04-04 21:01:25 +00:00
__VideoPmpInit ( ) ;
2017-08-28 10:55:35 +00:00
__UsbGpsInit ( ) ;
2019-08-25 19:14:01 +00:00
__UsbCamInit ( ) ;
2020-07-31 02:24:17 +00:00
__UsbMicInit ( ) ;
2020-08-07 13:09:14 +00:00
__OpenPSIDInit ( ) ;
2013-03-04 22:34:17 +00:00
2013-01-02 20:00:10 +00:00
SaveState : : Init ( ) ; // Must be after IO, as it may create a directory
2014-02-09 21:56:08 +00:00
Reporting : : Init ( ) ;
2012-12-09 20:49:16 +00:00
2012-11-18 12:04:49 +00:00
// "Internal" PSP libraries
__PPGeInit ( ) ;
2012-11-01 15:19:01 +00:00
kernelRunning = true ;
2013-09-07 20:02:55 +00:00
INFO_LOG ( SCEKERNEL , " Kernel initialized. " ) ;
2012-11-01 15:19:01 +00:00
}
void __KernelShutdown ( )
{
if ( ! kernelRunning )
{
2013-09-07 20:02:55 +00:00
ERROR_LOG ( SCEKERNEL , " Can't shut down kernel - not running " ) ;
2012-11-01 15:19:01 +00:00
return ;
}
kernelObjects . List ( ) ;
2013-09-07 20:02:55 +00:00
INFO_LOG ( SCEKERNEL , " Shutting down kernel - %i kernel objects alive " , kernelObjects . GetCount ( ) ) ;
2013-03-11 07:18:59 +00:00
hleCurrentThreadName = NULL ;
2012-11-01 15:19:01 +00:00
kernelObjects . Clear ( ) ;
2020-08-07 13:09:14 +00:00
__OpenPSIDShutdown ( ) ;
2019-08-25 19:14:01 +00:00
__UsbCamShutdown ( ) ;
2020-07-31 02:24:17 +00:00
__UsbMicShutdown ( ) ;
2020-01-09 13:57:09 +00:00
__UsbGpsShutdown ( ) ;
2019-08-25 19:14:01 +00:00
2014-03-27 21:53:57 +00:00
__AudioCodecShutdown ( ) ;
2014-04-04 21:01:25 +00:00
__VideoPmpShutdown ( ) ;
2014-04-11 07:03:13 +00:00
__AACShutdown ( ) ;
2013-09-06 22:55:42 +00:00
__NetAdhocShutdown ( ) ;
2014-07-31 18:46:49 +00:00
__NetShutdown ( ) ;
2013-02-22 19:05:07 +00:00
__FontShutdown ( ) ;
2013-10-25 03:07:07 +00:00
__Mp3Shutdown ( ) ;
2012-11-13 17:05:26 +00:00
__MpegShutdown ( ) ;
2012-12-24 18:44:40 +00:00
__PsmfShutdown ( ) ;
2012-11-18 12:04:49 +00:00
__PPGeShutdown ( ) ;
2012-12-09 20:49:16 +00:00
2012-12-24 09:41:15 +00:00
__CtrlShutdown ( ) ;
__UtilityShutdown ( ) ;
2012-11-01 15:19:01 +00:00
__GeShutdown ( ) ;
2012-12-17 20:45:32 +00:00
__SasShutdown ( ) ;
2012-12-25 14:28:34 +00:00
__DisplayShutdown ( ) ;
2013-02-01 16:31:51 +00:00
__AtracShutdown ( ) ;
2012-11-01 15:19:01 +00:00
__AudioShutdown ( ) ;
__IoShutdown ( ) ;
2012-12-23 10:19:55 +00:00
__KernelMutexShutdown ( ) ;
2012-11-01 15:19:01 +00:00
__KernelThreadingShutdown ( ) ;
__KernelMemoryShutdown ( ) ;
2012-12-27 23:56:46 +00:00
__InterruptsShutdown ( ) ;
2013-05-18 04:49:44 +00:00
__CheatShutdown ( ) ;
2013-05-24 06:40:03 +00:00
__KernelModuleShutdown ( ) ;
2012-11-01 15:19:01 +00:00
CoreTiming : : ClearPendingEvents ( ) ;
CoreTiming : : UnregisterAllEvents ( ) ;
2014-02-16 04:34:03 +00:00
Reporting : : Shutdown ( ) ;
2016-09-24 17:37:30 +00:00
SaveState : : Shutdown ( ) ;
2012-11-01 15:19:01 +00:00
kernelRunning = false ;
}
2012-12-27 04:15:31 +00:00
void __KernelDoState ( PointerWrap & p )
{
2013-09-15 03:23:03 +00:00
{
2013-09-29 07:19:54 +00:00
auto s = p . Section ( " Kernel " , 1 , 2 ) ;
2013-09-15 03:23:03 +00:00
if ( ! s )
return ;
2020-08-10 04:20:42 +00:00
Do ( p , kernelRunning ) ;
2013-09-15 03:23:03 +00:00
kernelObjects . DoState ( p ) ;
2013-09-29 07:19:54 +00:00
if ( s > = 2 )
2020-08-10 04:20:42 +00:00
Do ( p , registeredExitCbId ) ;
2013-09-15 03:23:03 +00:00
}
{
auto s = p . Section ( " Kernel Modules " , 1 ) ;
if ( ! s )
return ;
__InterruptsDoState ( p ) ;
// Memory needs to be after kernel objects, which may free kernel memory.
__KernelMemoryDoState ( p ) ;
__KernelThreadingDoState ( p ) ;
__KernelAlarmDoState ( p ) ;
__KernelVTimerDoState ( p ) ;
__KernelEventFlagDoState ( p ) ;
__KernelMbxDoState ( p ) ;
__KernelModuleDoState ( p ) ;
__KernelMsgPipeDoState ( p ) ;
__KernelMutexDoState ( p ) ;
__KernelSemaDoState ( p ) ;
__KernelTimeDoState ( p ) ;
}
{
auto s = p . Section ( " HLE Modules " , 1 ) ;
if ( ! s )
return ;
__AtracDoState ( p ) ;
__AudioDoState ( p ) ;
__CccDoState ( p ) ;
__CtrlDoState ( p ) ;
__DisplayDoState ( p ) ;
__FontDoState ( p ) ;
__GeDoState ( p ) ;
__ImposeDoState ( p ) ;
__IoDoState ( p ) ;
__JpegDoState ( p ) ;
2013-10-25 03:07:07 +00:00
__Mp3DoState ( p ) ;
2013-09-15 03:23:03 +00:00
__MpegDoState ( p ) ;
__NetDoState ( p ) ;
__NetAdhocDoState ( p ) ;
__PowerDoState ( p ) ;
__PsmfDoState ( p ) ;
__PsmfPlayerDoState ( p ) ;
__RtcDoState ( p ) ;
__SasDoState ( p ) ;
__SslDoState ( p ) ;
__UmdDoState ( p ) ;
__UtilityDoState ( p ) ;
__UsbDoState ( p ) ;
__VaudioDoState ( p ) ;
__HeapDoState ( p ) ;
__PPGeDoState ( p ) ;
2013-10-07 14:46:18 +00:00
__CheatDoState ( p ) ;
2014-03-27 14:10:53 +00:00
__sceAudiocodecDoState ( p ) ;
2014-04-04 21:01:25 +00:00
__VideoPmpDoState ( p ) ;
2014-04-11 07:03:13 +00:00
__AACDoState ( p ) ;
2017-10-04 08:33:41 +00:00
__UsbGpsDoState ( p ) ;
2020-08-01 11:50:23 +00:00
__UsbMicDoState ( p ) ;
2017-10-04 08:33:41 +00:00
// IMPORTANT! Add new sections last!
2013-09-15 03:23:03 +00:00
}
{
auto s = p . Section ( " Kernel Cleanup " , 1 ) ;
if ( ! s )
return ;
__InterruptsDoStateLate ( p ) ;
__KernelThreadingDoStateLate ( p ) ;
2014-02-17 17:43:12 +00:00
Reporting : : DoState ( p ) ;
2013-09-15 03:23:03 +00:00
}
2012-12-27 04:15:31 +00:00
}
2012-11-06 21:03:25 +00:00
bool __KernelIsRunning ( ) {
return kernelRunning ;
}
2020-07-12 14:47:53 +00:00
std : : string __KernelStateSummary ( ) {
2023-03-31 08:08:12 +00:00
return __KernelThreadingSummary ( ) ;
2020-07-12 14:47:53 +00:00
}
2012-11-01 15:19:01 +00:00
void sceKernelExitGame ( )
{
2013-09-07 20:02:55 +00:00
INFO_LOG ( SCEKERNEL , " sceKernelExitGame " ) ;
2012-12-30 03:36:03 +00:00
__KernelSwitchOffThread ( " game exited " ) ;
2012-11-01 15:19:01 +00:00
Core_Stop ( ) ;
}
2012-11-08 15:28:45 +00:00
void sceKernelExitGameWithStatus ( )
{
2013-09-07 20:02:55 +00:00
INFO_LOG ( SCEKERNEL , " sceKernelExitGameWithStatus " ) ;
2012-12-30 03:36:03 +00:00
__KernelSwitchOffThread ( " game exited " ) ;
2012-11-08 15:28:45 +00:00
Core_Stop ( ) ;
}
2013-01-31 03:14:03 +00:00
u32 sceKernelDevkitVersion ( )
2012-11-01 15:19:01 +00:00
{
2013-12-13 18:06:44 +00:00
int firmwareVersion = g_Config . iFirmwareVersion ;
2013-01-31 03:14:03 +00:00
int major = firmwareVersion / 100 ;
int minor = ( firmwareVersion / 10 ) % 10 ;
int revision = firmwareVersion % 10 ;
int devkitVersion = ( major < < 24 ) | ( minor < < 16 ) | ( revision < < 8 ) | 0x10 ;
2016-06-27 03:50:58 +00:00
2018-05-07 04:28:57 +00:00
DEBUG_LOG ( SCEKERNEL , " %08x=sceKernelDevkitVersion() " , devkitVersion ) ;
2013-01-31 03:14:03 +00:00
return devkitVersion ;
2012-11-01 15:19:01 +00:00
}
2013-01-02 01:22:08 +00:00
u32 sceKernelRegisterKprintfHandler ( )
2012-11-01 15:19:01 +00:00
{
2013-09-07 20:02:55 +00:00
ERROR_LOG ( SCEKERNEL , " UNIMPL sceKernelRegisterKprintfHandler() " ) ;
2013-01-02 01:22:08 +00:00
return 0 ;
2012-11-01 15:19:01 +00:00
}
2014-11-17 20:25:08 +00:00
2015-03-22 23:57:56 +00:00
int sceKernelRegisterDefaultExceptionHandler ( )
2012-11-01 15:19:01 +00:00
{
2013-09-07 20:02:55 +00:00
ERROR_LOG ( SCEKERNEL , " UNIMPL sceKernelRegisterDefaultExceptionHandler() " ) ;
2015-03-22 23:57:56 +00:00
return 0 ;
2012-11-01 15:19:01 +00:00
}
2013-01-02 01:22:08 +00:00
void sceKernelSetGPO ( u32 ledAddr )
2012-11-01 15:19:01 +00:00
{
// Sets debug LEDs.
2022-07-17 16:23:46 +00:00
// Not really interesting, and a few games really spam it
// DEBUG_LOG(SCEKERNEL, "sceKernelSetGPO(%02x)", ledAddr);
2012-11-01 15:19:01 +00:00
}
2013-01-02 01:22:08 +00:00
u32 sceKernelGetGPI ( )
2012-11-01 15:19:01 +00:00
{
// Always returns 0 on production systems.
2013-09-07 20:02:55 +00:00
DEBUG_LOG ( SCEKERNEL , " 0=sceKernelGetGPI() " ) ;
2013-01-02 01:22:08 +00:00
return 0 ;
2012-11-01 15:19:01 +00:00
}
2013-01-22 19:28:05 +00:00
// #define LOG_CACHE
// Don't even log these by default, they're spammy and we probably won't
// need to emulate them. Useful for invalidating cached textures though,
// and in the future display lists (although hashing takes care of those
// for now).
2013-01-02 08:54:23 +00:00
int sceKernelDcacheInvalidateRange ( u32 addr , int size )
2012-12-21 09:18:52 +00:00
{
2013-01-22 19:28:05 +00:00
# ifdef LOG_CACHE
2013-09-07 20:02:55 +00:00
NOTICE_LOG ( CPU , " sceKernelDcacheInvalidateRange(%08x, %i) " , addr , size ) ;
2013-01-22 19:28:05 +00:00
# endif
2013-01-05 23:30:31 +00:00
if ( size < 0 | | ( int ) addr + size < 0 )
return SCE_KERNEL_ERROR_ILLEGAL_ADDR ;
if ( size > 0 )
{
if ( ( addr % 64 ) ! = 0 | | ( size % 64 ) ! = 0 )
return SCE_KERNEL_ERROR_CACHE_ALIGNMENT ;
if ( addr ! = 0 )
2013-05-06 05:52:01 +00:00
gpu - > InvalidateCache ( addr , size , GPU_INVALIDATE_HINT ) ;
2013-01-03 23:32:18 +00:00
}
2013-05-28 08:29:16 +00:00
hleEatCycles ( 190 ) ;
2013-01-02 08:54:23 +00:00
return 0 ;
2012-12-21 09:18:52 +00:00
}
2013-03-16 08:38:50 +00:00
int sceKernelIcacheInvalidateRange ( u32 addr , int size ) {
2014-06-19 08:08:45 +00:00
DEBUG_LOG ( CPU , " sceKernelIcacheInvalidateRange(%08x, %i) " , addr , size ) ;
2022-10-16 01:27:52 +00:00
if ( size ! = 0 )
currentMIPS - > InvalidateICache ( addr , size ) ;
2013-03-16 08:38:50 +00:00
return 0 ;
}
2013-01-02 08:54:23 +00:00
int sceKernelDcacheWritebackAll ( )
2012-11-01 15:19:01 +00:00
{
2013-01-22 19:28:05 +00:00
# ifdef LOG_CACHE
2013-09-07 20:02:55 +00:00
NOTICE_LOG ( CPU , " sceKernelDcacheWritebackAll() " ) ;
2013-01-22 19:28:05 +00:00
# endif
2013-01-03 23:32:18 +00:00
// Some games seem to use this a lot, it doesn't make sense
2013-01-03 07:21:02 +00:00
// to zap the whole texture cache.
2013-05-06 05:52:01 +00:00
gpu - > InvalidateCache ( 0 , - 1 , GPU_INVALIDATE_ALL ) ;
2013-05-28 08:29:16 +00:00
hleEatCycles ( 3524 ) ;
2014-06-13 07:30:21 +00:00
hleReSchedule ( " dcache writeback all " ) ;
2013-01-02 08:54:23 +00:00
return 0 ;
2012-11-01 15:19:01 +00:00
}
2013-03-16 08:38:50 +00:00
2013-01-02 08:54:23 +00:00
int sceKernelDcacheWritebackRange ( u32 addr , int size )
2012-11-01 15:19:01 +00:00
{
2013-01-22 19:28:05 +00:00
# ifdef LOG_CACHE
2013-09-07 20:02:55 +00:00
NOTICE_LOG ( CPU , " sceKernelDcacheWritebackRange(%08x, %i) " , addr , size ) ;
2013-01-22 19:28:05 +00:00
# endif
2013-01-05 23:30:31 +00:00
if ( size < 0 )
return SCE_KERNEL_ERROR_INVALID_SIZE ;
2013-01-03 23:32:18 +00:00
if ( size > 0 & & addr ! = 0 ) {
2013-05-06 05:52:01 +00:00
gpu - > InvalidateCache ( addr , size , GPU_INVALIDATE_HINT ) ;
2013-01-03 23:32:18 +00:00
}
2013-05-28 08:29:16 +00:00
hleEatCycles ( 165 ) ;
2013-01-02 08:54:23 +00:00
return 0 ;
2012-11-01 15:19:01 +00:00
}
2015-11-25 12:00:07 +00:00
2013-01-02 08:54:23 +00:00
int sceKernelDcacheWritebackInvalidateRange ( u32 addr , int size )
2012-11-01 15:19:01 +00:00
{
2013-01-22 19:28:05 +00:00
# ifdef LOG_CACHE
2013-09-07 20:02:55 +00:00
NOTICE_LOG ( CPU , " sceKernelDcacheInvalidateRange(%08x, %i) " , addr , size ) ;
2013-01-22 19:28:05 +00:00
# endif
2013-01-05 23:30:31 +00:00
if ( size < 0 )
return SCE_KERNEL_ERROR_INVALID_SIZE ;
2013-01-03 23:32:18 +00:00
if ( size > 0 & & addr ! = 0 ) {
2013-05-06 05:52:01 +00:00
gpu - > InvalidateCache ( addr , size , GPU_INVALIDATE_HINT ) ;
2013-01-03 23:32:18 +00:00
}
2013-05-28 08:29:16 +00:00
hleEatCycles ( 165 ) ;
2013-01-02 08:54:23 +00:00
return 0 ;
2012-11-01 15:19:01 +00:00
}
2015-11-25 12:00:07 +00:00
2013-01-02 08:54:23 +00:00
int sceKernelDcacheWritebackInvalidateAll ( )
2012-11-01 15:19:01 +00:00
{
2013-01-22 19:28:05 +00:00
# ifdef LOG_CACHE
2013-09-07 20:02:55 +00:00
NOTICE_LOG ( CPU , " sceKernelDcacheInvalidateAll() " ) ;
2013-01-22 19:28:05 +00:00
# endif
2013-05-06 05:52:01 +00:00
gpu - > InvalidateCache ( 0 , - 1 , GPU_INVALIDATE_ALL ) ;
2013-05-28 08:29:16 +00:00
hleEatCycles ( 1165 ) ;
2014-06-13 07:30:21 +00:00
hleReSchedule ( " dcache invalidate all " ) ;
2013-01-02 08:54:23 +00:00
return 0 ;
2012-11-01 15:19:01 +00:00
}
2013-01-22 19:28:05 +00:00
u32 sceKernelIcacheInvalidateAll ( )
{
# ifdef LOG_CACHE
NOTICE_LOG ( CPU , " Icache invalidated - should clear JIT someday " ) ;
# endif
2015-07-19 20:08:32 +00:00
// Note that this doesn't actually fully invalidate all with such a large range.
currentMIPS - > InvalidateICache ( 0 , 0x3FFFFFFF ) ;
2013-01-22 19:28:05 +00:00
return 0 ;
}
u32 sceKernelIcacheClearAll ( )
{
# ifdef LOG_CACHE
NOTICE_LOG ( CPU , " Icache cleared - should clear JIT someday " ) ;
# endif
DEBUG_LOG ( CPU , " Icache cleared - should clear JIT someday " ) ;
2015-07-19 20:08:32 +00:00
// Note that this doesn't actually fully invalidate all with such a large range.
currentMIPS - > InvalidateICache ( 0 , 0x3FFFFFFF ) ;
2013-01-22 19:28:05 +00:00
return 0 ;
}
2013-12-31 05:37:19 +00:00
void KernelObject : : GetQuickInfo ( char * ptr , int size )
{
strcpy ( ptr , " - " ) ;
}
2015-11-25 12:00:07 +00:00
KernelObjectPool : : KernelObjectPool ( ) {
2012-11-01 15:19:01 +00:00
memset ( occupied , 0 , sizeof ( bool ) * maxCount ) ;
2013-09-17 15:11:51 +00:00
nextID = initialNextID ;
2012-11-01 15:19:01 +00:00
}
2015-11-25 12:00:07 +00:00
SceUID KernelObjectPool : : Create ( KernelObject * obj , int rangeBottom , int rangeTop ) {
2012-11-04 12:28:52 +00:00
if ( rangeTop > maxCount )
rangeTop = maxCount ;
2013-04-01 05:29:44 +00:00
if ( nextID > = rangeBottom & & nextID < rangeTop )
rangeBottom = nextID + + ;
2015-11-25 12:00:07 +00:00
for ( int i = rangeBottom ; i < rangeTop ; i + + ) {
if ( ! occupied [ i ] ) {
2012-11-04 12:28:52 +00:00
occupied [ i ] = true ;
2012-11-01 15:19:01 +00:00
pool [ i ] = obj ;
pool [ i ] - > uid = i + handleOffset ;
return i + handleOffset ;
}
}
2013-09-07 20:02:55 +00:00
2013-09-07 20:31:14 +00:00
ERROR_LOG_REPORT ( SCEKERNEL , " Unable to allocate kernel object, too many objects slots in use. " ) ;
2012-11-01 15:19:01 +00:00
return 0 ;
}
2015-11-25 12:00:07 +00:00
bool KernelObjectPool : : IsValid ( SceUID handle ) const {
2012-11-01 15:19:01 +00:00
int index = handle - handleOffset ;
2015-11-25 12:00:07 +00:00
if ( index < 0 | | index > = maxCount )
2012-11-01 15:19:01 +00:00
return false ;
2015-11-25 12:00:07 +00:00
else
return occupied [ index ] ;
2012-11-01 15:19:01 +00:00
}
2015-11-25 12:00:07 +00:00
void KernelObjectPool : : Clear ( ) {
for ( int i = 0 ; i < maxCount ; i + + ) {
// brutally clear everything, no validation
2012-11-01 15:19:01 +00:00
if ( occupied [ i ] )
delete pool [ i ] ;
2015-11-25 12:00:07 +00:00
pool [ i ] = nullptr ;
occupied [ i ] = false ;
2012-11-01 15:19:01 +00:00
}
2013-09-17 15:11:51 +00:00
nextID = initialNextID ;
2012-11-01 15:19:01 +00:00
}
2012-11-06 14:46:21 +00:00
2015-11-25 12:00:07 +00:00
void KernelObjectPool : : List ( ) {
for ( int i = 0 ; i < maxCount ; i + + ) {
if ( occupied [ i ] ) {
2012-11-01 15:19:01 +00:00
char buffer [ 256 ] ;
2015-11-25 12:00:07 +00:00
if ( pool [ i ] ) {
2023-04-28 19:04:05 +00:00
pool [ i ] - > GetQuickInfo ( buffer , sizeof ( buffer ) ) ;
2013-09-07 20:02:55 +00:00
INFO_LOG ( SCEKERNEL , " KO %i: %s \" %s \" : %s " , i + handleOffset , pool [ i ] - > GetTypeName ( ) , pool [ i ] - > GetName ( ) , buffer ) ;
2015-11-25 12:00:07 +00:00
} else {
strcpy ( buffer , " WTF? Zero Pointer " ) ;
2012-11-01 15:19:01 +00:00
}
}
}
}
2012-11-06 14:46:21 +00:00
2015-11-25 12:00:07 +00:00
int KernelObjectPool : : GetCount ( ) const {
2012-11-01 15:19:01 +00:00
int count = 0 ;
2015-11-25 12:00:07 +00:00
for ( int i = 0 ; i < maxCount ; i + + ) {
2012-11-01 15:19:01 +00:00
if ( occupied [ i ] )
count + + ;
}
return count ;
}
2015-11-25 12:00:07 +00:00
void KernelObjectPool : : DoState ( PointerWrap & p ) {
2013-09-15 03:23:03 +00:00
auto s = p . Section ( " KernelObjectPool " , 1 ) ;
if ( ! s )
return ;
2012-12-27 04:15:31 +00:00
int _maxCount = maxCount ;
2020-08-10 04:20:42 +00:00
Do ( p , _maxCount ) ;
2012-12-27 06:45:19 +00:00
2015-11-25 12:00:07 +00:00
if ( _maxCount ! = maxCount ) {
2013-04-13 08:39:17 +00:00
p . SetError ( p . ERROR_FAILURE ) ;
2013-09-07 20:02:55 +00:00
ERROR_LOG ( SCEKERNEL , " Unable to load state: different kernel object storage. " ) ;
2013-04-13 08:39:17 +00:00
return ;
}
2012-12-27 06:45:19 +00:00
2015-11-25 12:00:07 +00:00
if ( p . mode = = p . MODE_READ ) {
hleCurrentThreadName = nullptr ;
2012-12-27 23:56:46 +00:00
kernelObjects . Clear ( ) ;
2013-03-11 06:52:11 +00:00
}
2012-12-27 23:56:46 +00:00
2020-08-10 04:20:42 +00:00
Do ( p , nextID ) ;
DoArray ( p , occupied , maxCount ) ;
2015-11-25 12:00:07 +00:00
for ( int i = 0 ; i < maxCount ; + + i ) {
2012-12-27 04:15:31 +00:00
if ( ! occupied [ i ] )
continue ;
2012-12-27 06:45:19 +00:00
int type ;
2015-11-25 12:00:07 +00:00
if ( p . mode = = p . MODE_READ ) {
2020-08-10 04:20:42 +00:00
Do ( p , type ) ;
2012-12-27 06:45:19 +00:00
pool [ i ] = CreateByIDType ( type ) ;
2012-12-27 06:50:45 +00:00
// Already logged an error.
2015-11-25 12:00:07 +00:00
if ( pool [ i ] = = nullptr )
2012-12-27 06:50:45 +00:00
return ;
2013-09-04 18:19:32 +00:00
pool [ i ] - > uid = i + handleOffset ;
2015-11-25 12:00:07 +00:00
} else {
2012-12-27 06:45:19 +00:00
type = pool [ i ] - > GetIDType ( ) ;
2020-08-10 04:20:42 +00:00
Do ( p , type ) ;
2012-12-27 06:45:19 +00:00
}
pool [ i ] - > DoState ( p ) ;
2013-10-07 03:03:17 +00:00
if ( p . error > = p . ERROR_FAILURE )
break ;
2012-12-27 04:15:31 +00:00
}
}
2015-11-25 12:00:07 +00:00
KernelObject * KernelObjectPool : : CreateByIDType ( int type ) {
2012-12-27 06:45:19 +00:00
// Used for save states. This is ugly, but what other way is there?
2015-11-25 12:00:07 +00:00
switch ( type ) {
2012-12-27 06:45:19 +00:00
case SCE_KERNEL_TMID_Alarm :
return __KernelAlarmObject ( ) ;
case SCE_KERNEL_TMID_EventFlag :
return __KernelEventFlagObject ( ) ;
case SCE_KERNEL_TMID_Mbox :
return __KernelMbxObject ( ) ;
case SCE_KERNEL_TMID_Fpl :
return __KernelMemoryFPLObject ( ) ;
case SCE_KERNEL_TMID_Vpl :
return __KernelMemoryVPLObject ( ) ;
case PPSSPP_KERNEL_TMID_PMB :
return __KernelMemoryPMBObject ( ) ;
case PPSSPP_KERNEL_TMID_Module :
return __KernelModuleObject ( ) ;
case SCE_KERNEL_TMID_Mpipe :
return __KernelMsgPipeObject ( ) ;
case SCE_KERNEL_TMID_Mutex :
return __KernelMutexObject ( ) ;
case SCE_KERNEL_TMID_LwMutex :
return __KernelLwMutexObject ( ) ;
case SCE_KERNEL_TMID_Semaphore :
return __KernelSemaphoreObject ( ) ;
case SCE_KERNEL_TMID_Callback :
return __KernelCallbackObject ( ) ;
case SCE_KERNEL_TMID_Thread :
return __KernelThreadObject ( ) ;
case SCE_KERNEL_TMID_VTimer :
return __KernelVTimerObject ( ) ;
2013-12-03 07:29:52 +00:00
case SCE_KERNEL_TMID_Tlspl :
2014-08-02 18:26:45 +00:00
case SCE_KERNEL_TMID_Tlspl_v0 :
2013-12-03 07:29:52 +00:00
return __KernelTlsplObject ( ) ;
2012-12-27 06:45:19 +00:00
case PPSSPP_KERNEL_TMID_File :
return __KernelFileNodeObject ( ) ;
case PPSSPP_KERNEL_TMID_DirList :
return __KernelDirListingObject ( ) ;
2014-01-05 06:41:37 +00:00
case SCE_KERNEL_TMID_ThreadEventHandler :
return __KernelThreadEventHandlerObject ( ) ;
2012-12-27 06:45:19 +00:00
default :
2017-03-06 12:10:23 +00:00
ERROR_LOG ( SAVESTATE , " Unable to load state: could not find object type %d. " , type ) ;
2012-12-27 06:50:45 +00:00
return NULL ;
2012-12-27 06:45:19 +00:00
}
}
2012-11-09 16:51:45 +00:00
struct SystemStatus {
2013-11-06 16:58:06 +00:00
SceSize_le size ;
SceUInt_le status ;
SceUInt_le clockPart1 ;
SceUInt_le clockPart2 ;
SceUInt_le perfcounter1 ;
SceUInt_le perfcounter2 ;
SceUInt_le perfcounter3 ;
2012-11-09 16:51:45 +00:00
} ;
2014-12-08 09:40:08 +00:00
static int sceKernelReferSystemStatus ( u32 statusPtr ) {
2013-09-07 20:02:55 +00:00
DEBUG_LOG ( SCEKERNEL , " sceKernelReferSystemStatus(%08x) " , statusPtr ) ;
2022-09-03 17:37:58 +00:00
auto status = PSPPointer < SystemStatus > : : Create ( statusPtr ) ;
if ( status . IsValid ( ) ) {
memset ( ( SystemStatus * ) status , 0 , sizeof ( SystemStatus ) ) ;
status - > size = sizeof ( SystemStatus ) ;
2013-03-04 21:15:39 +00:00
// TODO: Fill in the struct!
2022-09-03 17:37:58 +00:00
status . NotifyWrite ( " SystemStatus " ) ;
2012-11-09 16:51:45 +00:00
}
return 0 ;
}
2013-03-04 22:39:59 +00:00
struct DebugProfilerRegs {
u32 enable ;
u32 systemck ;
u32 cpuck ;
u32 internal ;
u32 memory ;
u32 copz ;
u32 vfpu ;
u32 sleep ;
u32 bus_access ;
u32 uncached_load ;
u32 uncached_store ;
u32 cached_load ;
u32 cached_store ;
u32 i_miss ;
u32 d_miss ;
u32 d_writeback ;
u32 cop0_inst ;
u32 fpu_inst ;
u32 vfpu_inst ;
u32 local_bus ;
} ;
2014-12-08 09:40:08 +00:00
static u32 sceKernelReferThreadProfiler ( u32 statusPtr ) {
2013-09-07 20:02:55 +00:00
ERROR_LOG ( SCEKERNEL , " FAKE sceKernelReferThreadProfiler() " ) ;
2013-03-04 22:39:59 +00:00
2013-03-04 23:20:11 +00:00
// Can we confirm that the struct above is the right struct?
// If so, re-enable this code.
2022-09-03 17:37:58 +00:00
//auto regs = PSPPointer<DebugProfilerRegs>::Create(statusPtr);
2013-03-04 23:20:11 +00:00
// TODO: fill the struct.
2022-09-03 17:37:58 +00:00
//if (regs.IsValid()) {
// memset((DebugProfilerRegs *)regs, 0, sizeof(DebugProfilerRegs));
// regs.NotifyWrite("ThreadProfiler");
2013-03-04 23:20:11 +00:00
//}
2013-03-04 21:15:39 +00:00
return 0 ;
}
2014-12-08 09:40:08 +00:00
static int sceKernelReferGlobalProfiler ( u32 statusPtr ) {
2013-09-07 20:02:55 +00:00
ERROR_LOG ( SCEKERNEL , " UNIMPL sceKernelReferGlobalProfiler(%08x) " , statusPtr ) ;
2012-11-11 23:04:57 +00:00
// Ignore for now
return 0 ;
}
2012-11-09 16:51:45 +00:00
2012-11-01 15:19:01 +00:00
const HLEFunction ThreadManForUser [ ] =
{
2015-03-22 23:57:56 +00:00
{ 0X55C20A00 , & WrapI_CUUU < sceKernelCreateEventFlag > , " sceKernelCreateEventFlag " , ' i ' , " sxxx " } ,
{ 0X812346E4 , & WrapU_IU < sceKernelClearEventFlag > , " sceKernelClearEventFlag " , ' x ' , " ix " } ,
{ 0XEF9E4C70 , & WrapU_I < sceKernelDeleteEventFlag > , " sceKernelDeleteEventFlag " , ' x ' , " i " } ,
{ 0X1FB15A32 , & WrapU_IU < sceKernelSetEventFlag > , " sceKernelSetEventFlag " , ' x ' , " ix " } ,
2015-10-25 16:06:10 +00:00
{ 0X402FCF22 , & WrapI_IUUUU < sceKernelWaitEventFlag > , " sceKernelWaitEventFlag " , ' i ' , " ixxpp " , HLE_NOT_IN_INTERRUPT } ,
{ 0X328C546A , & WrapI_IUUUU < sceKernelWaitEventFlagCB > , " sceKernelWaitEventFlagCB " , ' i ' , " ixxpp " , HLE_NOT_IN_INTERRUPT } ,
{ 0X30FD48F0 , & WrapI_IUUU < sceKernelPollEventFlag > , " sceKernelPollEventFlag " , ' i ' , " ixxp " } ,
{ 0XCD203292 , & WrapU_IUU < sceKernelCancelEventFlag > , " sceKernelCancelEventFlag " , ' x ' , " ixp " } ,
2015-03-22 23:57:56 +00:00
{ 0XA66B0120 , & WrapU_IU < sceKernelReferEventFlagStatus > , " sceKernelReferEventFlagStatus " , ' x ' , " ix " } ,
{ 0X8FFDF9A2 , & WrapI_IIU < sceKernelCancelSema > , " sceKernelCancelSema " , ' i ' , " iix " } ,
2022-10-16 15:48:15 +00:00
{ 0XD6DA4BA1 , & WrapI_CUIIU < sceKernelCreateSema > , " sceKernelCreateSema " , ' i ' , " sxiip " } ,
2015-03-22 23:57:56 +00:00
{ 0X28B6489C , & WrapI_I < sceKernelDeleteSema > , " sceKernelDeleteSema " , ' i ' , " i " } ,
{ 0X58B1F937 , & WrapI_II < sceKernelPollSema > , " sceKernelPollSema " , ' i ' , " ii " } ,
2022-09-03 17:37:58 +00:00
{ 0XBC6FEBC5 , & WrapI_IU < sceKernelReferSemaStatus > , " sceKernelReferSemaStatus " , ' i ' , " ip " } ,
2015-03-22 23:57:56 +00:00
{ 0X3F53E640 , & WrapI_II < sceKernelSignalSema > , " sceKernelSignalSema " , ' i ' , " ii " } ,
{ 0X4E3A1105 , & WrapI_IIU < sceKernelWaitSema > , " sceKernelWaitSema " , ' i ' , " iix " , HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
{ 0X6D212BAC , & WrapI_IIU < sceKernelWaitSemaCB > , " sceKernelWaitSemaCB " , ' i ' , " iix " , HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
{ 0X60107536 , & WrapI_U < sceKernelDeleteLwMutex > , " sceKernelDeleteLwMutex " , ' i ' , " x " } ,
{ 0X19CFF145 , & WrapI_UCUIU < sceKernelCreateLwMutex > , " sceKernelCreateLwMutex " , ' i ' , " xsxix " } ,
2022-09-03 17:37:58 +00:00
{ 0X4C145944 , & WrapI_IU < sceKernelReferLwMutexStatusByID > , " sceKernelReferLwMutexStatusByID " , ' i ' , " xp " } ,
2013-02-25 06:50:48 +00:00
// NOTE: LockLwMutex, UnlockLwMutex, and ReferLwMutexStatus are in Kernel_Library, see sceKernelInterrupt.cpp.
2013-04-14 18:03:23 +00:00
// The below should not be called directly.
2015-03-22 23:57:56 +00:00
//{0x71040D5C, nullptr, "_sceKernelTryLockLwMutex", '?', "" },
//{0x7CFF8CF3, nullptr, "_sceKernelLockLwMutex", '?', "" },
//{0x31327F19, nullptr, "_sceKernelLockLwMutexCB", '?', "" },
//{0xBEED3A47, nullptr, "_sceKernelUnlockLwMutex", '?', "" },
{ 0XF8170FBE , & WrapI_I < sceKernelDeleteMutex > , " sceKernelDeleteMutex " , ' i ' , " i " } ,
{ 0XB011B11F , & WrapI_IIU < sceKernelLockMutex > , " sceKernelLockMutex " , ' i ' , " iix " , HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
{ 0X5BF4DD27 , & WrapI_IIU < sceKernelLockMutexCB > , " sceKernelLockMutexCB " , ' i ' , " iix " , HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
{ 0X6B30100F , & WrapI_II < sceKernelUnlockMutex > , " sceKernelUnlockMutex " , ' i ' , " ii " } ,
2022-10-16 15:40:01 +00:00
{ 0XB7D098C6 , & WrapI_CUIU < sceKernelCreateMutex > , " sceKernelCreateMutex " , ' i ' , " sxip " } ,
2015-03-22 23:57:56 +00:00
{ 0X0DDCD2C9 , & WrapI_II < sceKernelTryLockMutex > , " sceKernelTryLockMutex " , ' i ' , " ii " } ,
2022-09-03 17:37:58 +00:00
{ 0XA9C2CB9A , & WrapI_IU < sceKernelReferMutexStatus > , " sceKernelReferMutexStatus " , ' i ' , " ip " } ,
2015-03-22 23:57:56 +00:00
{ 0X87D9223C , & WrapI_IIU < sceKernelCancelMutex > , " sceKernelCancelMutex " , ' i ' , " iix " } ,
{ 0XFCCFAD26 , & WrapI_I < sceKernelCancelWakeupThread > , " sceKernelCancelWakeupThread " , ' i ' , " i " } ,
{ 0X1AF94D03 , nullptr , " sceKernelDonateWakeupThread " , ' ? ' , " " } ,
{ 0XEA748E31 , & WrapI_UU < sceKernelChangeCurrentThreadAttr > , " sceKernelChangeCurrentThreadAttr " , ' i ' , " xx " } ,
{ 0X71BC9871 , & WrapI_II < sceKernelChangeThreadPriority > , " sceKernelChangeThreadPriority " , ' i ' , " ii " } ,
{ 0X446D8DE6 , & WrapI_CUUIUU < sceKernelCreateThread > , " sceKernelCreateThread " , ' i ' , " sxxixx " , HLE_NOT_IN_INTERRUPT } ,
{ 0X9FA03CD3 , & WrapI_I < sceKernelDeleteThread > , " sceKernelDeleteThread " , ' i ' , " i " } ,
2016-05-31 03:06:14 +00:00
{ 0XBD123D9E , & WrapI_U < sceKernelDelaySysClockThread > , " sceKernelDelaySysClockThread " , ' i ' , " P " , HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
{ 0X1181E963 , & WrapI_U < sceKernelDelaySysClockThreadCB > , " sceKernelDelaySysClockThreadCB " , ' i ' , " P " , HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
2015-03-22 23:57:56 +00:00
{ 0XCEADEB47 , & WrapI_U < sceKernelDelayThread > , " sceKernelDelayThread " , ' i ' , " x " , HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
{ 0X68DA9E36 , & WrapI_U < sceKernelDelayThreadCB > , " sceKernelDelayThreadCB " , ' i ' , " x " , HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
2020-08-17 15:16:15 +00:00
{ 0XAA73C935 , & WrapI_I < sceKernelExitThread > , " sceKernelExitThread " , ' i ' , " i " } ,
2020-08-18 13:22:12 +00:00
{ 0X809CE29B , & WrapI_I < sceKernelExitDeleteThread > , " sceKernelExitDeleteThread " , ' i ' , " i " } ,
2015-03-22 23:57:56 +00:00
{ 0x94aa61ee , & WrapI_V < sceKernelGetThreadCurrentPriority > , " sceKernelGetThreadCurrentPriority " , ' i ' , " " } ,
{ 0X293B45B8 , & WrapI_V < sceKernelGetThreadId > , " sceKernelGetThreadId " , ' i ' , " " , HLE_NOT_IN_INTERRUPT } ,
{ 0X3B183E26 , & WrapI_I < sceKernelGetThreadExitStatus > , " sceKernelGetThreadExitStatus " , ' i ' , " i " } ,
{ 0X52089CA1 , & WrapI_I < sceKernelGetThreadStackFreeSize > , " sceKernelGetThreadStackFreeSize " , ' i ' , " i " } ,
{ 0XFFC36A14 , & WrapU_UU < sceKernelReferThreadRunStatus > , " sceKernelReferThreadRunStatus " , ' x ' , " xx " } ,
2020-02-22 12:15:13 +00:00
{ 0X17C1684E , & WrapU_UU < sceKernelReferThreadStatus > , " sceKernelReferThreadStatus " , ' i ' , " xp " } ,
2015-03-22 23:57:56 +00:00
{ 0X2C34E053 , & WrapI_I < sceKernelReleaseWaitThread > , " sceKernelReleaseWaitThread " , ' i ' , " i " } ,
{ 0X75156E8F , & WrapI_I < sceKernelResumeThread > , " sceKernelResumeThread " , ' i ' , " i " } ,
{ 0X3AD58B8C , & WrapU_V < sceKernelSuspendDispatchThread > , " sceKernelSuspendDispatchThread " , ' x ' , " " , HLE_NOT_IN_INTERRUPT } ,
{ 0X27E22EC2 , & WrapU_U < sceKernelResumeDispatchThread > , " sceKernelResumeDispatchThread " , ' x ' , " x " , HLE_NOT_IN_INTERRUPT } ,
{ 0X912354A7 , & WrapI_I < sceKernelRotateThreadReadyQueue > , " sceKernelRotateThreadReadyQueue " , ' i ' , " i " } ,
{ 0X9ACE131E , & WrapI_V < sceKernelSleepThread > , " sceKernelSleepThread " , ' i ' , " " , HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
{ 0X82826F70 , & WrapI_V < sceKernelSleepThreadCB > , " sceKernelSleepThreadCB " , ' i ' , " " , HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
{ 0XF475845D , & WrapI_IIU < sceKernelStartThread > , " sceKernelStartThread " , ' i ' , " iix " , HLE_NOT_IN_INTERRUPT } ,
{ 0X9944F31F , & WrapI_I < sceKernelSuspendThread > , " sceKernelSuspendThread " , ' i ' , " i " } ,
{ 0X616403BA , & WrapI_I < sceKernelTerminateThread > , " sceKernelTerminateThread " , ' i ' , " i " } ,
{ 0X383F7BCC , & WrapI_I < sceKernelTerminateDeleteThread > , " sceKernelTerminateDeleteThread " , ' i ' , " i " } ,
{ 0X840E8133 , & WrapI_IU < sceKernelWaitThreadEndCB > , " sceKernelWaitThreadEndCB " , ' i ' , " ix " } ,
{ 0XD13BDE95 , & WrapI_V < sceKernelCheckThreadStack > , " sceKernelCheckThreadStack " , ' i ' , " " } ,
{ 0X94416130 , & WrapU_UUUU < sceKernelGetThreadmanIdList > , " sceKernelGetThreadmanIdList " , ' x ' , " xxxx " } ,
{ 0X57CF62DD , & WrapU_U < sceKernelGetThreadmanIdType > , " sceKernelGetThreadmanIdType " , ' x ' , " x " } ,
{ 0XBC80EC7C , & WrapU_UUU < sceKernelExtendThreadStack > , " sceKernelExtendThreadStack " , ' x ' , " xxx " } ,
2013-04-14 18:03:23 +00:00
// NOTE: Takes a UID from sceKernelMemory's AllocMemoryBlock and seems thread stack related.
2015-03-22 23:57:56 +00:00
//{0x28BFD974, nullptr, "ThreadManForUser_28BFD974", '?', "" },
2012-11-01 15:19:01 +00:00
2015-03-22 23:57:56 +00:00
{ 0X82BC5777 , & WrapU64_V < sceKernelGetSystemTimeWide > , " sceKernelGetSystemTimeWide " , ' X ' , " " } ,
{ 0XDB738F35 , & WrapI_U < sceKernelGetSystemTime > , " sceKernelGetSystemTime " , ' i ' , " x " } ,
{ 0X369ED59D , & WrapU_V < sceKernelGetSystemTimeLow > , " sceKernelGetSystemTimeLow " , ' x ' , " " } ,
2012-11-01 15:19:01 +00:00
2015-03-22 23:57:56 +00:00
{ 0X8218B4DD , & WrapI_U < sceKernelReferGlobalProfiler > , " sceKernelReferGlobalProfiler " , ' i ' , " x " } ,
{ 0X627E6F3A , & WrapI_U < sceKernelReferSystemStatus > , " sceKernelReferSystemStatus " , ' i ' , " x " } ,
{ 0X64D4540E , & WrapU_U < sceKernelReferThreadProfiler > , " sceKernelReferThreadProfiler " , ' x ' , " x " } ,
2012-11-01 15:19:01 +00:00
//Fifa Street 2 uses alarms
2015-03-22 23:57:56 +00:00
{ 0X6652B8CA , & WrapI_UUU < sceKernelSetAlarm > , " sceKernelSetAlarm " , ' i ' , " xxx " } ,
{ 0XB2C25152 , & WrapI_UUU < sceKernelSetSysClockAlarm > , " sceKernelSetSysClockAlarm " , ' i ' , " xxx " } ,
{ 0X7E65B999 , & WrapI_I < sceKernelCancelAlarm > , " sceKernelCancelAlarm " , ' i ' , " i " } ,
{ 0XDAA3F564 , & WrapI_IU < sceKernelReferAlarmStatus > , " sceKernelReferAlarmStatus " , ' i ' , " ix " } ,
{ 0XBA6B92E2 , & WrapI_UUU < sceKernelSysClock2USec > , " sceKernelSysClock2USec " , ' i ' , " xxx " } ,
{ 0X110DEC9A , & WrapI_UU < sceKernelUSec2SysClock > , " sceKernelUSec2SysClock " , ' i ' , " xx " } ,
{ 0XC8CD158C , & WrapU64_U < sceKernelUSec2SysClockWide > , " sceKernelUSec2SysClockWide " , ' X ' , " x " } ,
{ 0XE1619D7C , & WrapI_UUUU < sceKernelSysClock2USecWide > , " sceKernelSysClock2USecWide " , ' i ' , " xxxx " } ,
{ 0X278C0DF5 , & WrapI_IU < sceKernelWaitThreadEnd > , " sceKernelWaitThreadEnd " , ' i ' , " ix " } ,
{ 0XD59EAD2F , & WrapI_I < sceKernelWakeupThread > , " sceKernelWakeupThread " , ' i ' , " i " } , //AI Go, audio?
2016-05-29 14:31:22 +00:00
{ 0x0C106E53 , & WrapI_CIUUU < sceKernelRegisterThreadEventHandler > , " sceKernelRegisterThreadEventHandler " , ' i ' , " sixxx " , } ,
{ 0x72F3C145 , & WrapI_I < sceKernelReleaseThreadEventHandler > , " sceKernelReleaseThreadEventHandler " , ' i ' , " i " } ,
{ 0x369EEB6B , & WrapI_IU < sceKernelReferThreadEventHandlerStatus > , " sceKernelReferThreadEventHandlerStatus " , ' i ' , " ip " } ,
2015-03-22 23:57:56 +00:00
{ 0x349d6d6c , & sceKernelCheckCallback , " sceKernelCheckCallback " , ' i ' , " " } ,
{ 0XE81CAF8F , & WrapI_CUU < sceKernelCreateCallback > , " sceKernelCreateCallback " , ' i ' , " sxx " } ,
{ 0XEDBA5844 , & WrapI_I < sceKernelDeleteCallback > , " sceKernelDeleteCallback " , ' i ' , " i " } ,
{ 0XC11BA8C4 , & WrapI_II < sceKernelNotifyCallback > , " sceKernelNotifyCallback " , ' i ' , " ii " } ,
{ 0XBA4051D6 , & WrapI_I < sceKernelCancelCallback > , " sceKernelCancelCallback " , ' i ' , " i " } ,
{ 0X2A3D44FF , & WrapI_I < sceKernelGetCallbackCount > , " sceKernelGetCallbackCount " , ' i ' , " i " } ,
2015-03-23 00:11:52 +00:00
{ 0X730ED8BC , & WrapI_IU < sceKernelReferCallbackStatus > , " sceKernelReferCallbackStatus " , ' i ' , " ip " } ,
2015-03-22 23:57:56 +00:00
{ 0X8125221D , & WrapI_CUU < sceKernelCreateMbx > , " sceKernelCreateMbx " , ' i ' , " sxx " } ,
{ 0X86255ADA , & WrapI_I < sceKernelDeleteMbx > , " sceKernelDeleteMbx " , ' i ' , " i " } ,
{ 0XE9B3061E , & WrapI_IU < sceKernelSendMbx > , " sceKernelSendMbx " , ' i ' , " ix " } ,
{ 0X18260574 , & WrapI_IUU < sceKernelReceiveMbx > , " sceKernelReceiveMbx " , ' i ' , " ixx " , HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
{ 0XF3986382 , & WrapI_IUU < sceKernelReceiveMbxCB > , " sceKernelReceiveMbxCB " , ' i ' , " ixx " , HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
{ 0X0D81716A , & WrapI_IU < sceKernelPollMbx > , " sceKernelPollMbx " , ' i ' , " ix " } ,
{ 0X87D4DD36 , & WrapI_IU < sceKernelCancelReceiveMbx > , " sceKernelCancelReceiveMbx " , ' i ' , " ix " } ,
2022-09-03 17:37:58 +00:00
{ 0XA8E8C846 , & WrapI_IU < sceKernelReferMbxStatus > , " sceKernelReferMbxStatus " , ' i ' , " ip " } ,
2015-03-22 23:57:56 +00:00
2022-09-20 16:20:05 +00:00
{ 0X7C0DC2A0 , & WrapI_CIUUU < sceKernelCreateMsgPipe > , " sceKernelCreateMsgPipe " , ' i ' , " sixxp " } ,
2015-03-22 23:57:56 +00:00
{ 0XF0B7DA1C , & WrapI_I < sceKernelDeleteMsgPipe > , " sceKernelDeleteMsgPipe " , ' i ' , " i " } ,
{ 0X876DBFAD , & WrapI_IUUUUU < sceKernelSendMsgPipe > , " sceKernelSendMsgPipe " , ' i ' , " ixxxxx " } ,
{ 0X7C41F2C2 , & WrapI_IUUUUU < sceKernelSendMsgPipeCB > , " sceKernelSendMsgPipeCB " , ' i ' , " ixxxxx " } ,
{ 0X884C9F90 , & WrapI_IUUUU < sceKernelTrySendMsgPipe > , " sceKernelTrySendMsgPipe " , ' i ' , " ixxxx " } ,
{ 0X74829B76 , & WrapI_IUUUUU < sceKernelReceiveMsgPipe > , " sceKernelReceiveMsgPipe " , ' i ' , " ixxxxx " } ,
{ 0XFBFA697D , & WrapI_IUUUUU < sceKernelReceiveMsgPipeCB > , " sceKernelReceiveMsgPipeCB " , ' i ' , " ixxxxx " } ,
{ 0XDF52098F , & WrapI_IUUUU < sceKernelTryReceiveMsgPipe > , " sceKernelTryReceiveMsgPipe " , ' i ' , " ixxxx " } ,
{ 0X349B864D , & WrapI_IUU < sceKernelCancelMsgPipe > , " sceKernelCancelMsgPipe " , ' i ' , " ixx " } ,
2022-09-03 17:37:58 +00:00
{ 0X33BE4024 , & WrapI_IU < sceKernelReferMsgPipeStatus > , " sceKernelReferMsgPipeStatus " , ' i ' , " ip " } ,
2015-03-22 23:57:56 +00:00
2022-09-20 15:57:24 +00:00
{ 0X56C039B5 , & WrapI_CIUUU < sceKernelCreateVpl > , " sceKernelCreateVpl " , ' i ' , " sixxp " } ,
2015-03-22 23:57:56 +00:00
{ 0X89B3D48C , & WrapI_I < sceKernelDeleteVpl > , " sceKernelDeleteVpl " , ' i ' , " i " } ,
{ 0XBED27435 , & WrapI_IUUU < sceKernelAllocateVpl > , " sceKernelAllocateVpl " , ' i ' , " ixxx " , HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
{ 0XEC0A693F , & WrapI_IUUU < sceKernelAllocateVplCB > , " sceKernelAllocateVplCB " , ' i ' , " ixxx " , HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
{ 0XAF36D708 , & WrapI_IUU < sceKernelTryAllocateVpl > , " sceKernelTryAllocateVpl " , ' i ' , " ixx " } ,
{ 0XB736E9FF , & WrapI_IU < sceKernelFreeVpl > , " sceKernelFreeVpl " , ' i ' , " ix " } ,
{ 0X1D371B8A , & WrapI_IU < sceKernelCancelVpl > , " sceKernelCancelVpl " , ' i ' , " ix " } ,
2022-09-03 17:37:58 +00:00
{ 0X39810265 , & WrapI_IU < sceKernelReferVplStatus > , " sceKernelReferVplStatus " , ' i ' , " ip " } ,
2015-03-22 23:57:56 +00:00
2022-09-20 15:31:44 +00:00
{ 0XC07BB470 , & WrapI_CUUUUU < sceKernelCreateFpl > , " sceKernelCreateFpl " , ' i ' , " sixxxp " } ,
2015-03-22 23:57:56 +00:00
{ 0XED1410E0 , & WrapI_I < sceKernelDeleteFpl > , " sceKernelDeleteFpl " , ' i ' , " i " } ,
{ 0XD979E9BF , & WrapI_IUU < sceKernelAllocateFpl > , " sceKernelAllocateFpl " , ' i ' , " ixx " , HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
{ 0XE7282CB6 , & WrapI_IUU < sceKernelAllocateFplCB > , " sceKernelAllocateFplCB " , ' i ' , " ixx " , HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
{ 0X623AE665 , & WrapI_IU < sceKernelTryAllocateFpl > , " sceKernelTryAllocateFpl " , ' i ' , " ix " } ,
{ 0XF6414A71 , & WrapI_IU < sceKernelFreeFpl > , " sceKernelFreeFpl " , ' i ' , " ix " } ,
{ 0XA8AA591F , & WrapI_IU < sceKernelCancelFpl > , " sceKernelCancelFpl " , ' i ' , " ix " } ,
2022-09-03 17:37:58 +00:00
{ 0XD8199E4C , & WrapI_IU < sceKernelReferFplStatus > , " sceKernelReferFplStatus " , ' i ' , " ip " } ,
2015-03-22 23:57:56 +00:00
{ 0X20FFF560 , & WrapU_CU < sceKernelCreateVTimer > , " sceKernelCreateVTimer " , ' x ' , " sx " , HLE_NOT_IN_INTERRUPT } ,
{ 0X328F9E52 , & WrapU_I < sceKernelDeleteVTimer > , " sceKernelDeleteVTimer " , ' x ' , " i " , HLE_NOT_IN_INTERRUPT } ,
{ 0XC68D9437 , & WrapU_I < sceKernelStartVTimer > , " sceKernelStartVTimer " , ' x ' , " i " } ,
{ 0XD0AEEE87 , & WrapU_I < sceKernelStopVTimer > , " sceKernelStopVTimer " , ' x ' , " i " } ,
{ 0XD2D615EF , & WrapU_I < sceKernelCancelVTimerHandler > , " sceKernelCancelVTimerHandler " , ' x ' , " i " } ,
{ 0XB3A59970 , & WrapU_IU < sceKernelGetVTimerBase > , " sceKernelGetVTimerBase " , ' x ' , " ix " } ,
{ 0XB7C18B77 , & WrapU64_I < sceKernelGetVTimerBaseWide > , " sceKernelGetVTimerBaseWide " , ' X ' , " i " } ,
{ 0X034A921F , & WrapU_IU < sceKernelGetVTimerTime > , " sceKernelGetVTimerTime " , ' x ' , " ix " } ,
{ 0XC0B3FFD2 , & WrapU64_I < sceKernelGetVTimerTimeWide > , " sceKernelGetVTimerTimeWide " , ' X ' , " i " } ,
{ 0X5F32BEAA , & WrapU_IU < sceKernelReferVTimerStatus > , " sceKernelReferVTimerStatus " , ' x ' , " ix " } ,
{ 0X542AD630 , & WrapU_IU < sceKernelSetVTimerTime > , " sceKernelSetVTimerTime " , ' x ' , " ix " } ,
{ 0XFB6425C3 , & WrapU64_IU64 < sceKernelSetVTimerTimeWide > , " sceKernelSetVTimerTimeWide " , ' X ' , " iX " } ,
{ 0XD8B299AE , & WrapU_IUUU < sceKernelSetVTimerHandler > , " sceKernelSetVTimerHandler " , ' x ' , " ixxx " } ,
{ 0X53B00E9A , & WrapU_IU64UU < sceKernelSetVTimerHandlerWide > , " sceKernelSetVTimerHandlerWide " , ' x ' , " iXxx " } ,
2022-09-20 16:05:39 +00:00
{ 0X8DAFF657 , & WrapI_CUUUUU < sceKernelCreateTlspl > , " sceKernelCreateTlspl " , ' i ' , " sixxxp " } ,
2015-03-22 23:57:56 +00:00
{ 0X32BF938E , & WrapI_I < sceKernelDeleteTlspl > , " sceKernelDeleteTlspl " , ' i ' , " i " } ,
2022-09-03 17:37:58 +00:00
{ 0X721067F3 , & WrapI_IU < sceKernelReferTlsplStatus > , " sceKernelReferTlsplStatus " , ' i ' , " xp " } ,
2013-04-14 19:52:56 +00:00
// Not completely certain about args.
2015-03-22 23:57:56 +00:00
{ 0X4A719FB2 , & WrapI_I < sceKernelFreeTlspl > , " sceKernelFreeTlspl " , ' i ' , " i " } ,
2013-12-03 07:29:52 +00:00
// Internal. Takes (uid, &addr) as parameters... probably.
2015-03-22 23:57:56 +00:00
//{0x65F54FFB, nullptr, "_sceKernelAllocateTlspl", 'v', "" },
2013-12-03 07:29:52 +00:00
// NOTE: sceKernelGetTlsAddr is in Kernel_Library, see sceKernelInterrupt.cpp.
2013-04-08 03:57:53 +00:00
2012-11-07 14:44:48 +00:00
// Not sure if these should be hooked up. See below.
2015-03-22 23:57:56 +00:00
{ 0x0E927AED , & _sceKernelReturnFromTimerHandler , " _sceKernelReturnFromTimerHandler " , ' v ' , " " } ,
{ 0X532A522E , & WrapV_I < _sceKernelExitThread > , " _sceKernelExitThread " , ' v ' , " i " } ,
2012-11-01 15:19:01 +00:00
// Shouldn't hook this up. No games should import this function manually and call it.
// {0x6E9EA350, _sceKernelReturnFromCallback,"_sceKernelReturnFromCallback"},
2020-07-27 13:18:38 +00:00
{ 0X71EC4271 , & WrapU_UU < sceKernelLibcGettimeofday > , " sceKernelLibcGettimeofday " , ' x ' , " xx " } ,
{ 0X79D1C3FA , & WrapI_V < sceKernelDcacheWritebackAll > , " sceKernelDcacheWritebackAll " , ' i ' , " " } ,
{ 0X91E4F6A7 , & WrapU_V < sceKernelLibcClock > , " sceKernelLibcClock " , ' x ' , " " } ,
{ 0XB435DEC5 , & WrapI_V < sceKernelDcacheWritebackInvalidateAll > , " sceKernelDcacheWritebackInvalidateAll " , ' i ' , " " } ,
2012-11-01 15:19:01 +00:00
} ;
2013-08-25 02:48:32 +00:00
const HLEFunction ThreadManForKernel [ ] =
{
2016-08-04 16:19:47 +00:00
{ 0xCEADEB47 , & WrapI_U < sceKernelDelayThread > , " sceKernelDelayThread " , ' i ' , " x " , HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED | HLE_KERNEL_SYSCALL } ,
{ 0x446D8DE6 , & WrapI_CUUIUU < sceKernelCreateThread > , " sceKernelCreateThread " , ' i ' , " sxxixx " , HLE_NOT_IN_INTERRUPT | HLE_KERNEL_SYSCALL } ,
{ 0xF475845D , & WrapI_IIU < sceKernelStartThread > , " sceKernelStartThread " , ' i ' , " iix " , HLE_NOT_IN_INTERRUPT | HLE_KERNEL_SYSCALL } ,
2020-06-07 02:37:50 +00:00
{ 0X9FA03CD3 , & WrapI_I < sceKernelDeleteThread > , " sceKernelDeleteThread " , ' i ' , " i " , HLE_KERNEL_SYSCALL } ,
2020-08-17 15:16:15 +00:00
{ 0XAA73C935 , & WrapI_I < sceKernelExitThread > , " sceKernelExitThread " , ' i ' , " i " , HLE_KERNEL_SYSCALL } ,
2020-08-18 13:03:45 +00:00
{ 0X809CE29B , & WrapI_I < sceKernelExitDeleteThread > , " sceKernelExitDeleteThread " , ' i ' , " i " , HLE_KERNEL_SYSCALL } ,
2020-06-13 13:17:56 +00:00
{ 0X9944F31F , & WrapI_I < sceKernelSuspendThread > , " sceKernelSuspendThread " , ' i ' , " i " , HLE_KERNEL_SYSCALL } ,
{ 0X75156E8F , & WrapI_I < sceKernelResumeThread > , " sceKernelResumeThread " , ' i ' , " i " , HLE_KERNEL_SYSCALL } ,
{ 0X94416130 , & WrapU_UUUU < sceKernelGetThreadmanIdList > , " sceKernelGetThreadmanIdList " , ' x ' , " xxxx " , HLE_KERNEL_SYSCALL } ,
2020-12-20 10:14:38 +00:00
{ 0x278c0df5 , & WrapI_IU < sceKernelWaitThreadEnd > , " sceKernelWaitThreadEnd " , ' i ' , " ix " , HLE_KERNEL_SYSCALL } ,
2022-10-16 15:48:15 +00:00
{ 0xd6da4ba1 , & WrapI_CUIIU < sceKernelCreateSema > , " sceKernelCreateSema " , ' i ' , " sxiip " , HLE_KERNEL_SYSCALL } ,
2020-12-20 10:14:38 +00:00
{ 0x28b6489c , & WrapI_I < sceKernelDeleteSema > , " sceKernelDeleteSema " , ' i ' , " i " , HLE_KERNEL_SYSCALL } ,
{ 0x3f53e640 , & WrapI_II < sceKernelSignalSema > , " sceKernelSignalSema " , ' i ' , " ii " , HLE_KERNEL_SYSCALL } ,
{ 0x4e3a1105 , & WrapI_IIU < sceKernelWaitSema > , " sceKernelWaitSema " , ' i ' , " iix " , HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED | HLE_KERNEL_SYSCALL } ,
{ 0x58b1f937 , & WrapI_II < sceKernelPollSema > , " sceKernelPollSema " , ' i ' , " ii " , HLE_KERNEL_SYSCALL } ,
{ 0x55c20a00 , & WrapI_CUUU < sceKernelCreateEventFlag > , " sceKernelCreateEventFlag " , ' i ' , " sxxx " , HLE_KERNEL_SYSCALL } ,
{ 0xef9e4c70 , & WrapU_I < sceKernelDeleteEventFlag > , " sceKernelDeleteEventFlag " , ' x ' , " i " , HLE_KERNEL_SYSCALL } ,
{ 0x1fb15a32 , & WrapU_IU < sceKernelSetEventFlag > , " sceKernelSetEventFlag " , ' x ' , " ix " , HLE_KERNEL_SYSCALL } ,
2020-12-20 10:17:00 +00:00
{ 0x812346e4 , & WrapU_IU < sceKernelClearEventFlag > , " sceKernelClearEventFlag " , ' x ' , " ix " , HLE_KERNEL_SYSCALL } ,
2020-12-20 10:14:38 +00:00
{ 0x402fcf22 , & WrapI_IUUUU < sceKernelWaitEventFlag > , " sceKernelWaitEventFlag " , ' i ' , " ixxpp " , HLE_NOT_IN_INTERRUPT | HLE_KERNEL_SYSCALL } ,
2022-09-20 15:31:44 +00:00
{ 0xc07bb470 , & WrapI_CUUUUU < sceKernelCreateFpl > , " sceKernelCreateFpl " , ' i ' , " sixxxp " , HLE_KERNEL_SYSCALL } ,
2020-12-20 10:14:38 +00:00
{ 0xed1410e0 , & WrapI_I < sceKernelDeleteFpl > , " sceKernelDeleteFpl " , ' i ' , " i " , HLE_KERNEL_SYSCALL } ,
{ 0x623ae665 , & WrapI_IU < sceKernelTryAllocateFpl > , " sceKernelTryAllocateFpl " , ' i ' , " ix " , HLE_KERNEL_SYSCALL } ,
{ 0x616403ba , & WrapI_I < sceKernelTerminateThread > , " sceKernelTerminateThread " , ' i ' , " i " , HLE_KERNEL_SYSCALL } ,
{ 0x383f7bcc , & WrapI_I < sceKernelTerminateDeleteThread > , " sceKernelTerminateDeleteThread " , ' i ' , " i " , HLE_KERNEL_SYSCALL } ,
{ 0x57cf62dd , & WrapU_U < sceKernelGetThreadmanIdType > , " sceKernelGetThreadmanIdType " , ' x ' , " x " , HLE_KERNEL_SYSCALL } ,
2021-04-11 00:10:35 +00:00
{ 0x94aa61ee , & WrapI_V < sceKernelGetThreadCurrentPriority > , " sceKernelGetThreadCurrentPriority " , ' i ' , " " , HLE_KERNEL_SYSCALL } ,
{ 0x293B45B8 , & WrapI_V < sceKernelGetThreadId > , " sceKernelGetThreadId " , ' i ' , " " , HLE_KERNEL_SYSCALL | HLE_NOT_IN_INTERRUPT } ,
{ 0x3B183E26 , & WrapI_I < sceKernelGetThreadExitStatus > , " sceKernelGetThreadExitStatus " , ' i ' , " i " , HLE_KERNEL_SYSCALL } ,
{ 0x82BC5777 , & WrapU64_V < sceKernelGetSystemTimeWide > , " sceKernelGetSystemTimeWide " , ' X ' , " " , HLE_KERNEL_SYSCALL } ,
{ 0xDB738F35 , & WrapI_U < sceKernelGetSystemTime > , " sceKernelGetSystemTime " , ' i ' , " x " , HLE_KERNEL_SYSCALL } ,
{ 0x369ED59D , & WrapU_V < sceKernelGetSystemTimeLow > , " sceKernelGetSystemTimeLow " , ' x ' , " " , HLE_KERNEL_SYSCALL } ,
{ 0x6652B8CA , & WrapI_UUU < sceKernelSetAlarm > , " sceKernelSetAlarm " , ' i ' , " xxx " , HLE_KERNEL_SYSCALL } ,
{ 0xB2C25152 , & WrapI_UUU < sceKernelSetSysClockAlarm > , " sceKernelSetSysClockAlarm " , ' i ' , " xxx " , HLE_KERNEL_SYSCALL } ,
{ 0x7E65B999 , & WrapI_I < sceKernelCancelAlarm > , " sceKernelCancelAlarm " , ' i ' , " i " , HLE_KERNEL_SYSCALL } ,
{ 0xDAA3F564 , & WrapI_IU < sceKernelReferAlarmStatus > , " sceKernelReferAlarmStatus " , ' i ' , " ix " , HLE_KERNEL_SYSCALL } ,
{ 0x8125221D , & WrapI_CUU < sceKernelCreateMbx > , " sceKernelCreateMbx " , ' i ' , " sxx " , HLE_KERNEL_SYSCALL } ,
{ 0x86255ADA , & WrapI_I < sceKernelDeleteMbx > , " sceKernelDeleteMbx " , ' i ' , " i " , HLE_KERNEL_SYSCALL } ,
{ 0xE9B3061E , & WrapI_IU < sceKernelSendMbx > , " sceKernelSendMbx " , ' i ' , " ix " , HLE_KERNEL_SYSCALL } ,
{ 0x18260574 , & WrapI_IUU < sceKernelReceiveMbx > , " sceKernelReceiveMbx " , ' i ' , " ixx " , HLE_KERNEL_SYSCALL | HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
{ 0xF3986382 , & WrapI_IUU < sceKernelReceiveMbxCB > , " sceKernelReceiveMbxCB " , ' i ' , " ixx " , HLE_KERNEL_SYSCALL | HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
{ 0x0D81716A , & WrapI_IU < sceKernelPollMbx > , " sceKernelPollMbx " , ' i ' , " ix " , HLE_KERNEL_SYSCALL } ,
{ 0x87D4DD36 , & WrapI_IU < sceKernelCancelReceiveMbx > , " sceKernelCancelReceiveMbx " , ' i ' , " ix " , HLE_KERNEL_SYSCALL } ,
2022-09-03 17:37:58 +00:00
{ 0xA8E8C846 , & WrapI_IU < sceKernelReferMbxStatus > , " sceKernelReferMbxStatus " , ' i ' , " ip " , HLE_KERNEL_SYSCALL } ,
2022-09-20 15:57:24 +00:00
{ 0x56C039B5 , & WrapI_CIUUU < sceKernelCreateVpl > , " sceKernelCreateVpl " , ' i ' , " sixxp " , HLE_KERNEL_SYSCALL } ,
2021-04-11 00:10:35 +00:00
{ 0x89B3D48C , & WrapI_I < sceKernelDeleteVpl > , " sceKernelDeleteVpl " , ' i ' , " i " , HLE_KERNEL_SYSCALL } ,
{ 0xBED27435 , & WrapI_IUUU < sceKernelAllocateVpl > , " sceKernelAllocateVpl " , ' i ' , " ixxx " , HLE_KERNEL_SYSCALL | HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
{ 0xEC0A693F , & WrapI_IUUU < sceKernelAllocateVplCB > , " sceKernelAllocateVplCB " , ' i ' , " ixxx " , HLE_KERNEL_SYSCALL | HLE_NOT_IN_INTERRUPT | HLE_NOT_DISPATCH_SUSPENDED } ,
{ 0xAF36D708 , & WrapI_IUU < sceKernelTryAllocateVpl > , " sceKernelTryAllocateVpl " , ' i ' , " ixx " , HLE_KERNEL_SYSCALL } ,
{ 0xB736E9FF , & WrapI_IU < sceKernelFreeVpl > , " sceKernelFreeVpl " , ' i ' , " ix " , HLE_KERNEL_SYSCALL } ,
{ 0x1D371B8A , & WrapI_IU < sceKernelCancelVpl > , " sceKernelCancelVpl " , ' i ' , " ix " , HLE_KERNEL_SYSCALL } ,
2022-09-03 17:37:58 +00:00
{ 0x39810265 , & WrapI_IU < sceKernelReferVplStatus > , " sceKernelReferVplStatus " , ' i ' , " ip " , HLE_KERNEL_SYSCALL } ,
2013-08-25 02:48:32 +00:00
} ;
2012-11-01 15:19:01 +00:00
void Register_ThreadManForUser ( )
{
RegisterModule ( " ThreadManForUser " , ARRAY_SIZE ( ThreadManForUser ) , ThreadManForUser ) ;
}
const HLEFunction LoadExecForUser [ ] =
{
2015-03-22 23:57:56 +00:00
{ 0X05572A5F , & WrapV_V < sceKernelExitGame > , " sceKernelExitGame " , ' v ' , " " } ,
{ 0X4AC57943 , & WrapI_I < sceKernelRegisterExitCallback > , " sceKernelRegisterExitCallback " , ' i ' , " i " } ,
{ 0XBD2F1094 , & WrapI_CU < sceKernelLoadExec > , " sceKernelLoadExec " , ' i ' , " sx " } ,
{ 0X2AC9954B , & WrapV_V < sceKernelExitGameWithStatus > , " sceKernelExitGameWithStatus " , ' v ' , " " } ,
{ 0X362A956B , & WrapI_V < LoadExecForUser_362A956B > , " LoadExecForUser_362A956B " , ' i ' , " " } ,
{ 0X8ADA38D3 , nullptr , " LoadExecForUser_8ADA38D3 " , ' ? ' , " " } ,
2012-11-01 15:19:01 +00:00
} ;
void Register_LoadExecForUser ( )
{
RegisterModule ( " LoadExecForUser " , ARRAY_SIZE ( LoadExecForUser ) , LoadExecForUser ) ;
}
2014-01-21 14:02:07 +00:00
const HLEFunction LoadExecForKernel [ ] =
{
2016-08-04 16:19:47 +00:00
{ 0x4AC57943 , & WrapI_I < sceKernelRegisterExitCallback > , " sceKernelRegisterExitCallback " , ' i ' , " i " , HLE_KERNEL_SYSCALL } ,
2021-10-18 13:50:18 +00:00
{ 0XA3D5E142 , nullptr , " sceKernelExitVSHVSH " , ' ? ' , " " } ,
{ 0X28D0D249 , & WrapI_CU < sceKernelLoadExec > , " sceKernelLoadExecVSHMs2 " , ' i ' , " sx " } ,
2020-06-07 03:46:08 +00:00
{ 0x6D302D3D , & WrapV_V < sceKernelExitGame > , " sceKernelExitVSHKernel " , ' v ' , " x " , HLE_KERNEL_SYSCALL } , // when called in game mode it will have the same effect that sceKernelExitGame
2014-01-21 14:02:07 +00:00
} ;
void Register_LoadExecForKernel ( )
{
RegisterModule ( " LoadExecForKernel " , ARRAY_SIZE ( LoadExecForKernel ) , LoadExecForKernel ) ;
}
2012-11-01 15:19:01 +00:00
const HLEFunction ExceptionManagerForKernel [ ] =
{
2015-03-22 23:57:56 +00:00
{ 0X3FB264FC , nullptr , " sceKernelRegisterExceptionHandler " , ' ? ' , " " } ,
{ 0X5A837AD4 , nullptr , " sceKernelRegisterPriorityExceptionHandler " , ' ? ' , " " } ,
2016-08-04 16:19:47 +00:00
{ 0x565C0B0E , & WrapI_V < sceKernelRegisterDefaultExceptionHandler > , " sceKernelRegisterDefaultExceptionHandler " , ' i ' , " " , HLE_KERNEL_SYSCALL } ,
2015-03-22 23:57:56 +00:00
{ 0X1AA6CFFA , nullptr , " sceKernelReleaseExceptionHandler " , ' ? ' , " " } ,
{ 0XDF83875E , nullptr , " sceKernelGetActiveDefaultExceptionHandler " , ' ? ' , " " } ,
{ 0X291FF031 , nullptr , " sceKernelReleaseDefaultExceptionHandler " , ' ? ' , " " } ,
{ 0X15ADC862 , nullptr , " sceKernelRegisterNmiHandler " , ' ? ' , " " } ,
{ 0XB15357C9 , nullptr , " sceKernelReleaseNmiHandler " , ' ? ' , " " } ,
2012-11-01 15:19:01 +00:00
} ;
void Register_ExceptionManagerForKernel ( )
{
RegisterModule ( " ExceptionManagerForKernel " , ARRAY_SIZE ( ExceptionManagerForKernel ) , ExceptionManagerForKernel ) ;
}
2013-07-29 20:19:53 +00:00
// Seen in some homebrew
const HLEFunction UtilsForKernel [ ] = {
2016-08-04 16:19:47 +00:00
{ 0xC2DF770E , WrapI_UI < sceKernelIcacheInvalidateRange > , " sceKernelIcacheInvalidateRange " , ' ? ' , " " , HLE_KERNEL_SYSCALL } ,
2015-03-22 23:57:56 +00:00
{ 0X78934841 , nullptr , " sceKernelGzipDecompress " , ' ? ' , " " } ,
{ 0XE8DB3CE6 , nullptr , " sceKernelDeflateDecompress " , ' ? ' , " " } ,
{ 0X840259F1 , nullptr , " sceKernelUtilsSha1Digest " , ' ? ' , " " } ,
{ 0X9E5C5086 , nullptr , " sceKernelUtilsMd5BlockInit " , ' ? ' , " " } ,
{ 0X61E1E525 , nullptr , " sceKernelUtilsMd5BlockUpdate " , ' ? ' , " " } ,
{ 0XB8D24E78 , nullptr , " sceKernelUtilsMd5BlockResult " , ' ? ' , " " } ,
{ 0XC8186A58 , nullptr , " sceKernelUtilsMd5Digest " , ' ? ' , " " } ,
{ 0X6C6887EE , nullptr , " UtilsForKernel_6C6887EE " , ' ? ' , " " } ,
{ 0X91E4F6A7 , nullptr , " sceKernelLibcClock " , ' ? ' , " " } ,
{ 0X27CC57F0 , nullptr , " sceKernelLibcTime " , ' ? ' , " " } ,
{ 0X79D1C3FA , nullptr , " sceKernelDcacheWritebackAll " , ' ? ' , " " } ,
{ 0X3EE30821 , nullptr , " sceKernelDcacheWritebackRange " , ' ? ' , " " } ,
{ 0X34B9FA9E , nullptr , " sceKernelDcacheWritebackInvalidateRange " , ' ? ' , " " } ,
{ 0XB435DEC5 , nullptr , " sceKernelDcacheWritebackInvalidateAll " , ' ? ' , " " } ,
{ 0XBFA98062 , nullptr , " sceKernelDcacheInvalidateRange " , ' ? ' , " " } ,
{ 0X920F104A , nullptr , " sceKernelIcacheInvalidateAll " , ' ? ' , " " } ,
{ 0XE860E75E , nullptr , " sceKernelUtilsMt19937Init " , ' ? ' , " " } ,
{ 0X06FB8A63 , nullptr , " sceKernelUtilsMt19937UInt " , ' ? ' , " " } ,
2013-07-29 20:19:53 +00:00
} ;
void Register_UtilsForKernel ( )
{
RegisterModule ( " UtilsForKernel " , ARRAY_SIZE ( UtilsForKernel ) , UtilsForKernel ) ;
}
2013-08-25 02:48:32 +00:00
void Register_ThreadManForKernel ( )
{
RegisterModule ( " ThreadManForKernel " , ARRAY_SIZE ( ThreadManForKernel ) , ThreadManForKernel ) ;
2013-12-29 23:11:29 +00:00
}