//Subroutine LoadCoreForKernel_CD26E0CA - Address 0x00006D68 SceModule *sceKernelGetModuleFromUID(SceUID uid) { u32 intrState; u32 intrState2; SceModule *mod = NULL; SceSysmemUidCB *block = NULL; intrState = loadCoreCpuSuspendIntr(); //0x00006D80 if (sceKernelGetUIDcontrolBlockWithType(uid, g_ModuleType, &block) < SCE_ERROR_OK) { //0x00006D94 & 0x00006D9C intrState2 = loadCoreCpuSuspendIntr(); //0x00006DD8 for (mod = g_loadCore.registeredMods; mod; mod = mod->next) { //0x00006DF4 - 0x00006E10 if (mod->modId == uid || mod->secId == uid) //0x00006DF4 & 0x00006E00 break; } loadCoreCpuResumeIntr(intrState2); //0x00006E14 } else { mod = UID_CB_TO_DATA(block, g_ModuleType, SceModule); } loadCoreCpuResumeIntr(intrState); //0x00006DB4 return mod; }
//5e98 int sceKernelDeleteMbx(SceUID mbxid) { SET_K1_SRL16; if(sceKernelIsIntrContext()) { RESET_K1; return SCE_KERNEL_ERROR_ILLEGAL_CONTEXT; } int intr = sceKernelCpuSuspendIntr(); uidControlBlock *cb; if(sceKernelGetUIDcontrolBlockWithType(mbxid, uidMboxType, &cb) != 0) { sceKernelCpuResumeIntr(intr); RESET_K1; return SCE_KERNEL_ERROR_UNKNOWN_MBXID; } if(IS_USER_MODE && !(cb->attr & 0x10)) { sceKernelCpuResumeIntr(intr); RESET_K1; return SCE_KERNEL_ERROR_ILLEGAL_PERM; } THREADMAN_TRACE(0x48, 1, mbxid); ASSERT(sceKernelDeleteUID(mbxid) <= 0); sceKernelCpuResumeIntr(intr); RESET_K1; return 0; }
//6868 int sceKernelReferMbxStatus(SceUID mbxid, SceKernelMbxInfo *info) { SET_K1_SRL16; int intr = sceKernelCpuSuspendIntr(); if(IS_USER_MODE && IS_ADDR_KERNEL(info)) { sceKernelCpuResumeIntr(intr); RESET_K1; return SCE_KERNEL_ERROR_ILLEGAL_ADDR; } uidControlBlock *cb; if(sceKernelGetUIDcontrolBlockWithType(mbxid, uidMboxType, &cb) != 0) { sceKernelCpuResumeIntr(intr); RESET_K1; return SCE_KERNEL_ERROR_UNKNOWN_MBXID; } if(IS_USER_MODE && !(cb->attr & 0x1)) { sceKernelCpuResumeIntr(intr); RESET_K1; return SCE_KERNEL_ERROR_ILLEGAL_PERM; } THREADMAN_TRACE(0x4E, 2, mbxid, info); SceKernelMbxInfo *buf = (SceKernelMbxInfo *)var_164a8; memset(buf, 0, sizeof(SceKernelMbxInfo)); buf->size = sizeof(SceKernelMbxInfo); if(cb->name) { strncpy(buf->name, cb->name, 0x1F); } WaitQInfo *qinfo = UID_INFO(WaitQInfo, cb, uidWaitQType); buf->attr = qinfo->unk_0; buf->numWaitThreads = qinfo->unk_8; MboxInfo *mbxinfo = UID_INFO(MboxInfo, cb, uidMboxType); buf->numMessages = mbxinfo->unk_4; if(mbxinfo->unk_8) { buf->firstMessage = mbxinfo->unk_8->unk_0; } memcpy(info, buf, MIN(buf->size, info->size)); sceKernelCpuResumeIntr(intr); RESET_K1; return 0; }
//5ff0 int sceKernelSendMbx(SceUID mbxid, void *message) { SET_K1_SRL16; int intr = sceKernelCpuSuspendIntr(); int isIntr = sceKernelIsIntrContext(); if(IS_USER_MODE && IS_ADDR_KERNEL(message)) { sceKernelCpuResumeIntr(intr); RESET_K1; return SCE_KERNEL_ERROR_ILLEGAL_ADDR; } uidControlBlock *cb; if(sceKernelGetUIDcontrolBlockWithType(mbxid, uidMboxType, &cb) != 0) { sceKernelCpuResumeIntr(intr); RESET_K1; return SCE_KERNEL_ERROR_UNKNOWN_MBXID; } if(IS_USER_MODE && !(cb->attr & 0x2)) { sceKernelCpuResumeIntr(intr); RESET_K1; return SCE_KERNEL_ERROR_ILLEGAL_PERM; } THREADMAN_TRACE(0x49, 2, mbxid, message); WaitQInfo *qinfo = UID_INFO(WaitQInfo, cb, uidWaitQType); MboxInfo *mbxinfo = UID_INFO(MboxInfo, cb, uidMboxType); if(qinfo->numWaitThreads > 0) { if(qinfo->waitThread->unk_24 != 0) { qinfo->waitThread->unk_24->unk_0 = message; } sub_00000480(cb, 0, isIntr, intr); } else { if(sub_00006ADC(mbxinfo, qinfo, message) != 0) { sceKernelCpuResumeIntr(intr); RESET_K1; return SCE_KERNEL_ERROR_ILLEGAL_ADDR; } } sceKernelCpuResumeIntr(intr); RESET_K1; return 0; }