Get Thread Running Task
Jump to navigation
Jump to search
# ROUTINE: GET THREAD RUNNING TASK # Searches running threads (outside of the main thread) for the given taskID. # Parameters: # r4 = (taskID) Task ID to search for # Returns: # r2 = (ID of thread running the given taskID), or 0 if no such thread exists 80149cbc: 27bdffe0 addiu r29,r29,-0x0020 80149cc0: afb20018 sw r18,0x0018(r29) 80149cc4: 00809021 addu r18,r4,r0 # taskID 80149cc8: afb00010 sw r16,0x0010(r29) 80149ccc: 34100001 ori r16,r0,0x0001 # loopthreadID = 1 80149cd0: afb10014 sw r17,0x0014(r29) 80149cd4: 34110400 ori r17,r0,0x0400 # threadOffset = sizeof(thread) 80149cd8: afbf001c sw r31,0x001c(r29) # do { 80149cdc: 3c028017 lui r2,0x8017 80149ce0: 8c424038 lw r2,0x4038(r2) # runningthreadID 80149ce4: 00000000 nop 80149ce8: 1202000b beq r16,r2,0x80149d18 # if (loopThreadID != runningthreadID) { 80149cec: 00000000 nop 80149cf0: 0c053325 jal 0x8014cc94 # isRunning = Check Thread Running Status (loopThreadID); 80149cf4: 02002021 addu r4,r16,r0 80149cf8: 10400007 beq r2,r0,0x80149d18 # if (isRunning) { 80149cfc: 00000000 nop 80149d00: 3c018017 lui r1,0x8017 80149d04: 00310821 addu r1,r1,r17 80149d08: 8c2298b8 lw r2,-0x6748(r1) # threads[loopThreadID].TaskID 80149d0c: 00000000 nop 80149d10: 10520006 beq r2,r18,0x80149d2c # if (threads[loopThreadID].TaskID) == taskID) 80149d14: 02001021 addu r2,r16,r0 # return loopThreadID; # } # } 80149d18: 26100001 addiu r16,r16,0x0001 # loopThreadID = loopThreadID + 1 80149d1c: 2a020010 slti r2,r16,0x0010 80149d20: 1440ffee bne r2,r0,0x80149cdc 80149d24: 26310400 addiu r17,r17,0x0400 # threadOffset = threadOffset + sizeof(thread) # } while (loopThreadID < 16); 80149d28: 00001021 addu r2,r0,r0 # return 0; 80149d2c: 8fbf001c lw r31,0x001c(r29) 80149d30: 8fb20018 lw r18,0x0018(r29) 80149d34: 8fb10014 lw r17,0x0014(r29) 80149d38: 8fb00010 lw r16,0x0010(r29) 80149d3c: 27bd0020 addiu r29,r29,0x0020 80149d40: 03e00008 jr r31 80149d44: 00000000 nop