示例#1
0
 private static void dumpThreadTypeList(Memory mem, int list)
 {
     for (int cb = mem.read32(list); cb != list; cb = mem.read32(cb))
     {
         SceSysmemUidCB sceSysmemUidCB = new SceSysmemUidCB();
         sceSysmemUidCB.read(mem, cb);
         dumpThread(mem, cb + sceSysmemUidCB.size * 4, "Thread");
     }
 }
示例#2
0
        private static void dumpThread(Memory mem, int address, string comment)
        {
            int uid             = mem.read32(address + 8);
            int status          = mem.read32(address + 12);
            int currentPriority = mem.read32(address + 16);

            StringBuilder waitInfo = new StringBuilder();

            if (SceKernelThreadInfo.isWaitingStatus(status))
            {
                int waitType = mem.read32(address + 88);
                if (waitType != 0)
                {
                    waitInfo.Append(string.Format(", waitType=0x{0:X}({1})", waitType, SceKernelThreadInfo.getWaitName(waitType)));
                }

                int waitTypeCBaddr = mem.read32(address + 92);
                if (waitTypeCBaddr != 0)
                {
                    SceSysmemUidCB waitTypeCB = new SceSysmemUidCB();
                    waitTypeCB.read(mem, waitTypeCBaddr);
                    waitInfo.Append(string.Format(", waitUid=0x{0:X}({1})", waitTypeCB.uid, waitTypeCB.name));
                }

                if (waitType == SceKernelThreadInfo.PSP_WAIT_DELAY)
                {
                    int waitDelay = mem.read32(address + 96);
                    waitInfo.Append(string.Format(", waitDelay=0x{0:X}", waitDelay));
                }
                else if (waitType == SceKernelThreadInfo.PSP_WAIT_EVENTFLAG)
                {
                    int bits = mem.read32(address + 96);
                    waitInfo.Append(string.Format(", waitEventFlagBits=0x{0:X}", bits));
                }
            }

            int            cb             = SysMemForKernel.getCBFromUid(uid);
            SceSysmemUidCB sceSysmemUidCB = new SceSysmemUidCB();

            sceSysmemUidCB.read(mem, cb);

            //if (log.DebugEnabled)
            {
                Console.WriteLine(string.Format("{0}: uid=0x{1:X}, name='{2}', status=0x{3:X}({4}), currentPriority=0x{5:X}{6}", comment, uid, sceSysmemUidCB.name, status, SceKernelThreadInfo.getStatusName(status), currentPriority, waitInfo));
                if (log.TraceEnabled)
                {
                    log.trace(Utilities.getMemoryDump(address, 0x140));
                }
            }
        }