uOFW
Reverse engineered PSP kernel 6.60.
|
00001 /* Copyright (C) 2011, 2012 The uOFW team 00002 See the file COPYING for copying permission. 00003 */ 00004 00005 #include "common_header.h" 00006 #include "loadcore.h" 00007 00008 enum SceInterrupts { 00009 SCE_GPIO_INT = 4, 00010 SCE_ATA_INT = 5, 00011 SCE_UMD_INT = 6, 00012 SCE_MSCM0_INT = 7, 00013 SCE_WLAN_INT = 8, 00014 SCE_AUDIO_INT = 10, 00015 SCE_I2C_INT = 12, 00016 SCE_SIRCS_INT = 14, 00017 SCE_SYSTIMER0_INT = 15, 00018 SCE_SYSTIMER1_INT = 16, 00019 SCE_SYSTIMER2_INT = 17, 00020 SCE_SYSTIMER3_INT = 18, 00021 SCE_THREAD0_INT = 19, 00022 SCE_NAND_INT = 20, 00023 SCE_DMACPLUS_INT = 21, 00024 SCE_DMA0_INT = 22, 00025 SCE_DMA1_INT = 23, 00026 SCE_MEMLMD_INT = 24, 00027 SCE_GE_INT = 25, 00028 SCE_VBLANK_INT = 30, 00029 SCE_MECODEC_INT = 31, 00030 SCE_HPREMOTE_INT = 36, 00031 SCE_MSCM1_INT = 60, 00032 SCE_MSCM2_INT = 61, 00033 SCE_THREAD1_INT = 65, 00034 SCE_INTERRUPT_INT = 66 00035 }; 00036 00037 typedef struct { 00038 // Handler address 00039 s32 handler; // 0 00040 // GP of the module 00041 s32 gp; // 4 00042 // Argument given by sceKernelRegisterSubIntrHandler 00043 s32 arg; // 8 00044 s32 u12, u16, u20; 00045 // See disableCb 00046 s32 enableCb; // 24 00047 // Pointer to the callback called by sceKernelDisableSubIntr(), that takes the same arguments as it 00048 s32 disableCb; // 28 00049 // See disableCb 00050 s32 suspendCb; // 32 00051 // See disableCb 00052 s32 resumeCb; // 36 00053 // See disableCb 00054 s32 isOccuredCb; // 40 00055 s32 u44; 00056 // Some options 00057 s32 v48; // 48 00058 s32 u52, u56, u60; 00059 } SubInterrupt; // Size: 64 00060 00061 typedef struct { 00062 s32 size; // 0 00063 s32 u4; 00064 // Callback called before setting sub interrupt, when registering 00065 s32 (*cbRegBefore)(s32, s32, void*, void*); // 8 00066 // Callback called after 00067 s32 (*cbRegAfter)(s32, s32, void*, void*); // 12 00068 // Callback called before resetting handler to 0 00069 s32 (*cbRelBefore)(s32, s32); // 16 00070 // Callback called after 00071 s32 (*cbRelAfter)(s32, s32); // 20 00072 s32 (*cbEnable)(s32, s32); // 24 00073 s32 (*cbDisable)(s32, s32); // 28 00074 s32 (*cbSuspend)(s32, s32, s32*); // 32 00075 s32 (*cbResume)(s32, s32, s32); // 36 00076 s32 (*cbIsOccured)(s32, s32); // 40 00077 } SceIntrCb; // Size: 44 00078 00079 // Arg4 in sceKernelRegisterIntrHandler() 00080 typedef struct { 00081 // Handler address, sometimes OR'ed with 2 ?!? 00082 s32 handler; // 0 00083 // GP of the module 00084 s32 gp; // 4 00085 // Argument given by sceKernelRegisterIntrHandler 00086 void *arg; // 8 00087 s32 u12, u16, u20, u24, u28, u32, u36; 00088 // Pointer to sub interrupts 00089 SubInterrupt *subIntrs; // 40 00090 // Some value set by sceKernelRegisterIntrHandler, using arg4 SubIntrInfo.callbacks, contains some handlers ran by sceKernelRegisterSubIntrHandler 00091 SceIntrCb *cb; // 44 00092 // InterruptManagerForKernel_D01EAA3F changes a bit depending on arg1, sceKernelRegisterIntrHandler changes some also; lower byte is the max number of sub interrupts 00093 s32 v48; // 48 00094 s32 u52, u56, u60; 00095 } Interrupt; // Size: 64 00096 00097 typedef struct { 00098 s32 size; // must be 12 00099 s32 numSubIntrs; // 4 00100 SceIntrCb *callbacks; // 8 00101 } SubIntrInfo; // Size: 12 00102 00103 typedef struct { 00104 s32 size; 00105 s32 attr; 00106 void *cb; 00107 } SceIntrHandler; 00108 00109 typedef s32 (*MonitorCb)(s32 intrNum, s32 subIntrNum, s32, s32, s32, s32, s8); 00110 00111 s32 sceKernelRegisterIntrHandler(s32 intrNum, s32 arg1, void *func, void *arg3, SceIntrHandler *handler); 00112 s32 sceKernelSetUserModeIntrHanlerAcceptable(s32 intrNum, s32 subIntrNum, s32 setBit); 00113 s32 sceKernelReleaseIntrHandler(s32 intrNum); 00114 s32 sceKernelSetIntrLevel(s32 intrNum, s32 num); 00115 s32 sceKernelSetIntrLogging(s32 intrNum, s32 arg1); 00116 s32 sceKernelEnableIntr(s32 intNum); 00117 s32 sceKernelSuspendIntr(s32 arg0, s32 *arg1); 00118 s32 sceKernelResumeIntr(s32 intrNum, s32 arg1); 00119 void ReleaseContextHooks(); 00120 void InterruptManagerForKernel_E790EAED(s32 (*arg0)(), s32 (*arg1)()); 00121 s32 sceKernelCallSubIntrHandler(s32 intrNum, s32 subIntrNum, s32 arg2, s32 arg3); 00122 s32 sceKernelGetUserIntrStack(); 00123 s32 sceKernelRegisterSubIntrHandler(s32 intrNum, s32 subIntrNum, void *handler, void *arg); 00124 s32 sceKernelReleaseSubIntrHandler(s32 intrNum, s32 subIntrNum); 00125 s32 sceKernelEnableSubIntr(s32 intrNum, s32 subIntrNum); 00126 s32 sceKernelDisableSubIntr(s32 intrNum, s32 subIntrNum); 00127 s32 sceKernelSuspendSubIntr(s32 intrNum, s32 subIntrNum, s32 *arg2); 00128 s32 sceKernelResumeSubIntr(s32 intrNum, s32 subIntrNum, s32 arg2); 00129 s32 sceKernelIsSubInterruptOccured(s32 intrNum, s32 subIntrNum); 00130 s32 sceKernelQueryIntrHandlerInfo(s32 intrNum, s32 subIntrNum, s32 out); 00131 s32 sceKernelSetPrimarySyscallHandler(s32 syscallId, void (*syscall)()); 00132 void sceKernelCpuEnableIntr(); 00133 s32 InterruptManagerForKernel_6FCBA912(s32 set); 00134 s32 sceKernelClearIntrLogging(s32 intrNum); 00135 s32 sceKernelIsInterruptOccurred(s32 intrNum); 00136 s32 sceKernelDisableIntr(s32 intrNum); 00137 void RegisterSubIntrruptMonitor(MonitorCb before, MonitorCb after); 00138 void ReleaseSubIntrruptMonitor(); 00139 s32 UnSupportIntr(s32 intrNum); 00140 s32 InterruptManagerForKernel_8DFBD787(); 00141 s32 QueryIntrHandlerInfoForUser(); 00142 s32 sceKernelRegisterUserSpaceIntrStack(s32 addr, s32 size, s32 arg2); 00143 s32 sceKernelGetCpuClockCounter(); 00144 u64 sceKernelGetCpuClockCounterWide(); 00145 u32 _sceKernelGetCpuClockCounterLow(); 00146 s32 sceKernelRegisterSystemCallTable(SceSyscallTable *newMap); 00147 s32 sceKernelQuerySystemCall(void (*sysc)()); 00148 void InterruptManagerForKernel_E526B767(s32 arg); 00149 s32 sceKernelGetSyscallRA(void); 00150 s32 sceKernelCpuSuspendIntr(void); 00151 void sceKernelCpuResumeIntr(s32 intr); 00152 void sceKernelCpuResumeIntrWithSync(s32 intr); 00153 s32 sceKernelIsIntrContext(void); 00154 int sceKernelCallUserIntrHandler(int, int, int, int, int, int); 00155