Esempio n. 1
0
//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;
}
Esempio n. 2
0
/*
 * A new SceModule structure is allocated by creating an UID based
 * on g_ModuleType (the UID type for modules) and is
 * set to be the UID of the newly created module.
 */
SceModule *sceKernelCreateModule(void)
{
    s32 status;
    s32 intrState;    
    SceModule *mod;
    SceSysmemUidCB *cb = NULL;
    
    intrState = loadCoreCpuSuspendIntr();
    
    /*
     * The name of the created UID is temporary; once the module
     * is in the process of being loaded, its UID name is updated
     * based on the module's name and its purpose. 
     */
    status = sceKernelCreateUID(g_ModuleType, MODULE_TEMPORARY_UID_NAME, 0, &cb); //0x00006874
    if (status < 0) { //0x0000687C
        loadCoreCpuResumeIntr(intrState);
        return NULL;
    }
    
    mod = UID_CB_TO_DATA(cb, g_ModuleType, SceModule);
    if (mod == NULL) { //0x00006898
        loadCoreCpuResumeIntr(intrState);
        return NULL;
    }
    //0x000068D0 - 0x0000689C
    mod->modId = cb->uid; //0x000068A0
    mod->moduleStartThreadPriority = LOADCORE_ERROR;
    mod->moduleStartThreadStacksize = LOADCORE_ERROR;
    mod->moduleStartThreadAttr = LOADCORE_ERROR;
    mod->moduleStopThreadPriority = LOADCORE_ERROR;
    mod->moduleStopThreadStacksize = LOADCORE_ERROR;
    mod->moduleStopThreadAttr = LOADCORE_ERROR;
    mod->moduleRebootBeforeThreadPriority = LOADCORE_ERROR;
    mod->moduleRebootBeforeThreadStacksize = LOADCORE_ERROR;
    mod->moduleRebootBeforeThreadAttr = LOADCORE_ERROR;   
    mod->countRegVal = pspCop0StateGet(COP0_STATE_COUNT);
    
    loadCoreCpuResumeIntr(intrState); //0x000068D4
    return mod; 
}