int sub_00000588(void) { int intr; void (*ptr)(u32) = (void*)g_func_1200; (*ptr)(0); open_iso(); intr = sceKernelCpuSuspendIntr(); /* sceUmdManGetUmdDiscInfo patch */ _sw(0xE0000800, g_sceNp9660_driver_text_addr + g_offs->Data1); _sw(0x00000009, g_sceNp9660_driver_text_addr + g_offs->Data2); _sw(g_total_blocks, g_sceNp9660_driver_text_addr + g_offs->Data3); _sw(g_total_blocks, g_sceNp9660_driver_text_addr + g_offs->Data4); _sw(0x00000000, g_sceNp9660_driver_text_addr + g_offs->Data5); sceKernelCpuResumeIntr(intr); if(g_data_1204 == 0) { g_data_1204 = 1; sceKernelDelayThread(800000); } clear_cache(); sceKernelSetQTGP3(g_umddata); return 0; }
s32 sceSTimerAlloc() { if (sceKernelIsIntrContext() != 0) return 0x80020064; s32 oldIntr = sceKernelCpuSuspendIntr(); s32 i; for (i = 0; i < 4; i++) { if (timers[i].curTimer == -1) { timers[i].cb = NULL; timers[i].hw->unk0 = 0x80000000; timers[i].hw->unk8 = -1; timers[i].hw->unk12 = -1; (void)timers[i].hw->unk0; timers[i].curTimer = -1; timers[i].unk12 = 0; timers[i].unk16 = 0; timers[i].unk24 = 0; timers[i].unk28 = 0; timers[i].curTimer = ((initVar << 2) | i) & 0x7FFFFFFF; initVar += 7; sceKernelCpuResumeIntr(oldIntr); return timers[i].curTimer; } } sceKernelCpuResumeIntr(oldIntr); return 0x80020096; }
static u32 sub_05F0(void) { s32 pspModel; s32 apiType; s32 intrState; invoke_init_callback(3); patchGames(); sceKernelSetDNAS(0); intrState = sceKernelCpuSuspendIntr(); pspModel = sceKernelGetModel(); if (pspModel >= PSP_4000) { apiType = sceKernelApplicationType(); switch (apiType) { case SCE_INIT_APPLICATION_VSH: case SCE_INIT_APPLICATION_UPDATER: case SCE_INIT_APPLICATION_POPS: UtilsForKernel_39FFB756(81); break; default: UtilsForKernel_39FFB756(0); break; } } sceKernelCpuResumeIntr(intrState); PowerUnlock(); return SCE_ERROR_OK; }
s32 sceUmdModuleStart(s32 argc, void *argp) { s32 intrState; (void)argc; (void)argp; memset(&g_mediaMan, 0, sizeof g_mediaMan); // TODO: Check assignment order; might be :DMU g_umdFileSystem[0] = 'U'; g_umdFileSystem[1] = 'M'; g_umdFileSystem[2] = 'D'; g_umdFileSystem[3] = ':'; g_eventId = sceKernelCreateEventFlag("SceMediaManUser", SCE_KERNEL_EA_MULTI | 0x1, 0, NULL); if (g_eventId < 0) return SCE_KERNEL_NO_RESIDENT; g_isAssigned = SCE_UMD_DEVICE_NOT_ASSIGNED; intrState = sceKernelCpuSuspendIntr(); g_driveState |= SCE_UMD_MEDIA_OUT; sceKernelSetEventFlag(g_eventId, 1); sceKernelCpuResumeIntr(intrState); return SCE_KERNEL_RESIDENT; }
int sceKermit_driver_9160841C(int pin_n, int allow_callbacks) { /* lock the power source, no shutdown */ int res = sceKernelPowerLock(0); /* check if valid */ if (res == 0) { /* wait? */ sub_00000908(); /* suspend interrupts */ int intr = sceKernelCpuSuspendIntr(); PIN_HIGH(0xBC300038, pin_n); PIN_LOW(0xBC300050, pin_n); PIN_HIGH(0xBC300050, pin_n); /* resume all the interrupts */ sceKernelCpuResumeIntr(intr); /* wait on work sema */ if (allow_callbacks) sceKernelWaitSemaCB(g_work_sema[pin_n], 1, NULL); else sceKernelWaitSema(g_work_sema[pin_n], 1, NULL); /* unlock power */ res = sceKernelPowerUnlock(0); /* resolve +ve res to 0 */ if (res > 0) res = 0; } /* return the result */ return res; }
//OK int sceUsbAccGetInfo(u64 *lpDst) // at 0x00000068 { int ret = 0; int curIntCtrlState = sceKernelCpuSuspendIntr(); if (!g_bAttached) { sceKernelCpuResumeIntr(curIntCtrlState); return (0x80243007); } if (sceUsbBus_driver_8A3EB5D2() == 0) { sceKernelCpuResumeIntr(curIntCtrlState); return (0x80243701); } if (lpDst) { if (((((u32)lpDst + 8) | (u32)lpDst) & (pspSdkGetK1() << 11)) >= 0) { *lpDst = g_info; } } else { ret = 0x80243002; } sceKernelCpuResumeIntr(curIntCtrlState); return (ret); }
void checkDispatchCases(const char *name, void (*testfunc)(int)) { int state; dispatchCheckpoint("%s without changes:", name); testfunc(0); flushschedf(); didResched = 0; schedf("\n"); dispatchCheckpoint("%s with short dispatch suspend:", name); testfunc(1); flushschedf(); didResched = 0; schedf("\n"); dispatchCheckpoint("%s while dispatch suspended:", name); // Starting a thread apparently resumes the dispatch thread. ++ignoreResched; state = sceKernelSuspendDispatchThread(); dispatchCheckpoint("sceKernelSuspendDispatchThread: %08x", state); testfunc(0); dispatchCheckpoint("sceKernelResumeDispatchThread: %08x", sceKernelResumeDispatchThread(state)); --ignoreResched; flushschedf(); didResched = 0; schedf("\n"); dispatchCheckpoint("%s while intr suspended:", name); state = sceKernelCpuSuspendIntr(); dispatchCheckpoint("sceKernelCpuSuspendIntr: %08x", state); testfunc(1); dispatchCheckpoint("sceKernelCpuResumeIntr: %08x", sceKernelCpuResumeIntr(state)); flushschedf(); }
s32 sceSTimerSetHandler(s32 timerId, s32 arg1, SceSysTimerCb arg2, s32 arg3) { SceSysTimer *timer = &timers[timerId & 3]; if (timer->curTimer != timerId) return 0x80020097; s32 oldIntr = sceKernelCpuSuspendIntr(); s32 mask; if (arg1 <= 0x3FFFFF) mask = arg1; else mask = 0x3FFFFF; if (arg2 == NULL) { timer->cb = NULL; timer->unk24 = 0; timer->unk28 = 0; _sceSTimerStopCount(timer); sceKernelDisableIntr(timer->s32Num); } else { timer->cb = arg2; timer->unk28 = arg3; timer->hw->unk0 = timer->hw->unk256 & 0xFFC00000; timer->hw->unk0 |= mask; timer->hw->unk0 = timer->hw->unk256 | 0x80400000; sceKernelEnableIntr(timer->s32Num); } sceKernelCpuResumeIntr(oldIntr); return 0; }
int sub_01B8(int flag, int enable) { int oldIntr = sceKernelCpuSuspendIntr(); int reg = LW(0xBC10004C); *(int*)(0xBC10004C) = enable ? (reg | flag) : (reg ^ (reg & flag)); sceKernelCpuResumeIntr(intr); return (reg & flag) != 0; }
//Subroutine sceUmd_060E934D - Address 0x00000CF0 void sceUmdSetDetectUMDCallBackId(SceUID callbackId) { s32 intrState; intrState = sceKernelCpuSuspendIntr(); g_umdCallbackId = callbackId; sceKernelCpuResumeIntr(intrState); }
s32 sceSTimerStopCount(s32 timerId) { SceSysTimer *timer = &timers[timerId & 3]; if (timer->curTimer != timerId) return 0x80020097; s32 oldIntr = sceKernelCpuSuspendIntr(); _sceSTimerStopCount(timer); sceKernelCpuResumeIntr(oldIntr); return 0; }
//Subroutine sceUmd_07E98AF8 - Address 0x0000049C u32 sceUmdSetErrorStatus(s32 state) //param state: one of SCE_UMD_errors { s32 intrState; intrState = sceKernelCpuSuspendIntr(); g_errorState = state; sceKernelCpuResumeIntr(intrState); return SCE_ERROR_OK; }
//Subroutine sceUmd_982272FE - Address 0x00000444 void sceUmdSetDriveStatus(s32 state) { s32 intrState; intrState = sceKernelCpuSuspendIntr(); g_driveState |= state; sceKernelSetEventFlag(g_eventId, state); sceKernelCpuResumeIntr(intrState); }
//Subroutine sceUmd_6EDF57F1 - Address 0x000003E8 void sceUmdClearDriveStatus(s32 state) { s32 intrState; intrState = sceKernelCpuSuspendIntr(); sceKernelClearEventFlag(g_eventId, ~state); g_driveState &= (~state); sceKernelCpuResumeIntr(intrState); }
s32 module_reboot_before() { s32 oldIntr = sceKernelCpuSuspendIntr(); s32 i; for (i = 0; i < 4; i++) { _sceSTimerStopCount(&timers[i]); sceKernelReleaseIntrHandler(timers[i].s32Num); } sceKernelCpuResumeIntr(oldIntr); return 0; }
s32 sceSTimerResetCount(s32 timerId) { SceSysTimer *timer = &timers[timerId & 3]; if (timer->curTimer != timerId) return 0x80020097; s32 oldIntr = sceKernelCpuSuspendIntr(); timer->hw->unk0 |= 0x80000000; timer->unk24 = 0; sceKernelCpuResumeIntr(oldIntr); return 0; }
// OK int sceUsbAccGetAuthStat() // at 0x00000000 { int curIntCtrlState = sceKernelCpuSuspendIntr(); int ret = 0x80243007; if (g_bAttached) { ret = sceUsbBus_driver_8A3EB5D2() ? 0 : 0x80243701; } sceKernelCpuResumeIntr(curIntCtrlState); return (ret); }
//Subroutine sceUmd_76D356F9 - Address 0x000008B4 u32 sceUmd_76D356F9(s32 (*arg0)(void)) { s32 intrState; intrState = sceKernelCpuSuspendIntr(); g_mediaMan.unk60 = arg0; g_mediaMan.unk36 = pspGetGp(); sceKernelCpuResumeIntr(intrState); return SCE_ERROR_OK; }
extern "C" int main(int argc, char *argv[]) { checkpointNext("Not suspended:"); checkpoint(" 0: %08x", sceKernelIsCpuIntrSuspended(0)); checkpoint(" 1: %08x", sceKernelIsCpuIntrSuspended(1)); checkpoint(" 2: %08x", sceKernelIsCpuIntrSuspended(2)); checkpoint(" 0xDEADBEEF: %08x", sceKernelIsCpuIntrSuspended(0xDEADBEEF)); checkpointNext("Suspended:"); int flags1 = sceKernelCpuSuspendIntr(); int flags2 = sceKernelCpuSuspendIntr(); checkpoint(" 0: %08x", sceKernelIsCpuIntrSuspended(0)); checkpoint(" 1: %08x", sceKernelIsCpuIntrSuspended(1)); checkpoint(" 2: %08x", sceKernelIsCpuIntrSuspended(2)); checkpoint(" 0xDEADBEEF: %08x", sceKernelIsCpuIntrSuspended(0xDEADBEEF)); checkpoint(" flags (inner): %08x", sceKernelIsCpuIntrSuspended(flags2)); checkpoint(" flags (outer): %08x", sceKernelIsCpuIntrSuspended(flags1)); sceKernelCpuResumeIntr(flags2); sceKernelCpuResumeIntr(flags1); return 0; }
//Subroutine sceUmd_0E3F8ED9 - Address 0x0000087C u32 sceUmdUnRegisterReplaceCallBack(void) { s32 intrState; intrState = sceKernelCpuSuspendIntr(); g_mediaMan.umdReplaceCallback = NULL; g_mediaMan.umdReplaceCallbackGp = 0; sceKernelCpuResumeIntr(intrState); return SCE_ERROR_OK; }
//Subroutine sceUmd_3748C4DB - Address 0x00000838 u32 sceUmdRegisterReplaceCallBack(s32 (*umdReplaceCallback)(s32)) { s32 intrState; intrState = sceKernelCpuSuspendIntr(); g_mediaMan.umdReplaceCallback = umdReplaceCallback; g_mediaMan.umdReplaceCallbackGp = pspGetGp(); sceKernelCpuResumeIntr(intrState); return SCE_ERROR_OK; }
//Subroutine sceUmd_99CA645A - Address 0x00000694 void sceUmdUnRegisterDeactivateCallBack(void) { s32 intrState; intrState = sceKernelCpuSuspendIntr(); g_mediaMan.umdDeactivateCallback = NULL; g_mediaMan.umdDeactivateCallbackGp = 0; g_mediaMan.umdDeactivateCallbackParam = NULL; sceKernelCpuResumeIntr(intrState); }
//5d18 int sceKernelCreateMbx(const char *name, unsigned int attr, SceKernelMbxOptParam *opt) { SET_K1_SRL16; if(IS_USER_MODE && (IS_ADDR_KERNEL(name) || IS_ADDR_KERNEL(opt))) { RESET_K1; return SCE_KERNEL_ERROR_ILLEGAL_ADDR; } if(sceKernelIsIntrContext()) { RESET_K1; return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT; } if(attr & ~SCE_MBX_LEGAL_ATTR) { RESET_K1; return SCE_KERNEL_ERROR_ILLEGAL_ATTR; } int intr = sceKernelCpuSuspendIntr(); uidControlBlock *cb; int ret = sceKernelCreateUID(uidMboxType, name, IS_USER_MODE ? 0xFF : (attr & 0xFF), &cb); if(ret != 0) { sceKernelCpuResumeIntr(intr); RESET_K1; return ret; } WaitQInfo *qinfo = t7 = UID_INFO(WaitQInfo, cb, uidWaitQType); qinfo->attr = attr; MboxInfo *mbinfo = s0 = UID_INFO(MboxInfo, cb, uidMboxType); mbinfo->option = opt; THREADMAN_TRACE(0x47, 1, mbinfo); sceKernelCpuResumeIntr(intr); RESET_K1; return 0; }
//Subroutine sceUmd_63517CBA - Address 0x000005CC u32 sceUmdRegisterMediaPresentCallBack(s32(*MediaPresentCallback)(void *), void *param) { s32 intrState; intrState = sceKernelCpuSuspendIntr(); g_mediaMan.umdMediaPresentCallback = MediaPresentCallback; g_mediaMan.umdMediaPresentCallbackParam = param; g_mediaMan.umdMediaPresentCallbackGp = pspGetGp(); sceKernelCpuResumeIntr(intrState); return SCE_ERROR_OK; }
int pspDveMgrCheckVideoOut() { int k1 = pspSdkSetK1(0); int intr = sceKernelCpuSuspendIntr(); // Warning: nid changed between 3.60 and 3.71 int cable = sceHprm_driver_1528D408(); sceKernelCpuResumeIntr(intr); pspSdkSetK1(k1); return cable; }
//Subroutine sceUmd_48EF868C - Address 0x0000053C u32 sceUmdRegisterGetUMDInfoCallBack(s32 (*umdInfoCallback)(SceUmdDiscInfo *), SceUmdDiscInfo *pDiscInfo) { s32 intrState; intrState = sceKernelCpuSuspendIntr(); g_mediaMan.umdInfoCallback = umdInfoCallback; g_mediaMan.umdInfoCallbackDiscInfo = pDiscInfo; g_mediaMan.umdInfoCallbackGp = pspGetGp(); sceKernelCpuResumeIntr(intrState); return SCE_ERROR_OK; }
//Subroutine sceUmd_A0E8E513 - Address 0x00000590 u32 sceUmdUnRegisterGetUMDInfoCallBack(void) { s32 intrState; intrState = sceKernelCpuSuspendIntr(); g_mediaMan.umdInfoCallback = NULL; g_mediaMan.umdInfoCallbackGp = 0; g_mediaMan.umdInfoCallbackDiscInfo = NULL; sceKernelCpuResumeIntr(intrState); return SCE_ERROR_OK; }
//Subroutine sceUmd_D1C80E51 - Address 0x00000720 u32 sceUmdRegisterDeactivateCallBack(s32 (*deactivateCallback)(s32, void *), void *param) { s32 intrState; intrState = sceKernelCpuSuspendIntr(); g_mediaMan.umdDeactivateCallback = deactivateCallback; g_mediaMan.umdDeactivateCallbackParam = param; g_mediaMan.umdDeactivateCallbackGp = pspGetGp(); sceKernelCpuResumeIntr(intrState); return SCE_ERROR_OK; }
//67b4 int sceKernelSysEventDispatch(int ev_type_mask, int ev_id, char *ev_name, void *param, int *result, int break_nonzero, PspSysEventHandler *break_handler) { int ret; SceSysEventHandler *handler; // fp = gp; int intr = sceKernelCpuSuspendIntr(); for(handler = sys_event_handlers; handler; handler = handler->next) { if(handler->typemask & unk_a0) { //687c handler->busy = 1; sceKernelCpuResumeIntr(intr); // v0 = gp; // gp = s0->r28; ret = handler->handler(unk_a1, unk_a2, unk_a3, unk_t0); intr = sceKernelCpuSuspendIntr(); handler->busy = 0; if((ret >> 31) & (0 < unk_t1)) { //68d0 if(unk_t2 != 0) { unk_t2->unk_0 = s0; } break; } ret = 0; } }
//Subroutine sceUmd_1471F63D - Address 0x00000620 u32 sceUmdUnRegisterMediaPresentCallBack(void) { s32 intrState; intrState = sceKernelCpuSuspendIntr(); g_mediaMan.umdMediaPresentCallbackParam = NULL; g_mediaMan.umdMediaPresentCallbackGp = 0; g_mediaMan.umdMediaPresentCallback = NULL; sceKernelCpuResumeIntr(intrState); return SCE_ERROR_OK; }