Difference between revisions of "Initialize Thread"
Jump to navigation
Jump to search
(Created page with " # ROUTINE: INITIALIZE THREAD # Parameters: # r4 = (threadID) Thread ID to initialize # r5 = (funcPtr) Function pointer for thread to run 8014c8a0: 27bdf...") |
|||
Line 16: | Line 16: | ||
8014c8c8: 02038021 addu r16,r16,r3 # threadPtr = (threadID * sizeof(thread)) + (Thread array base pointer) | 8014c8c8: 02038021 addu r16,r16,r3 # threadPtr = (threadID * sizeof(thread)) + (Thread array base pointer) | ||
# // (Conceptually, thread = *threadPtr) | # // (Conceptually, thread = *threadPtr) | ||
− | 8014c8cc: ae020038 sw r2,0x0038(r16) # thread. | + | 8014c8cc: ae020038 sw r2,0x0038(r16) # thread.GlobalPointer = globalPointer |
8014c8d0: 260203f0 addiu r2,r16,0x03f0 # threadPtr + 0x3f0 | 8014c8d0: 260203f0 addiu r2,r16,0x03f0 # threadPtr + 0x3f0 | ||
− | 8014c8d4: ae02003c sw r2,0x003c(r16) # thread. | + | 8014c8d4: ae02003c sw r2,0x003c(r16) # thread.StackPointer = threadPtr + 0x3f0 // (Stack grows backwards) |
− | 8014c8d8: ae020040 sw r2,0x0040(r16) # thread. | + | 8014c8d8: ae020040 sw r2,0x0040(r16) # thread.FramePointer = threadPtr + 0x3f0 |
8014c8dc: 34020001 ori r2,r0,0x0001 # 1 | 8014c8dc: 34020001 ori r2,r0,0x0001 # 1 | ||
− | 8014c8e0: ae110044 sw r17,0x0044(r16) # thread. | + | 8014c8e0: ae110044 sw r17,0x0044(r16) # thread.CodePointer = funcPtr |
8014c8e4: ae020048 sw r2,0x0048(r16) # thread.IsRunning = 1 | 8014c8e4: ae020048 sw r2,0x0048(r16) # thread.IsRunning = 1 | ||
8014c8e8: ae00004c sw r0,0x004c(r16) # thread.TaskID = 0 | 8014c8e8: ae00004c sw r0,0x004c(r16) # thread.TaskID = 0 |
Latest revision as of 18:36, 7 January 2017
# ROUTINE: INITIALIZE THREAD # Parameters: # r4 = (threadID) Thread ID to initialize # r5 = (funcPtr) Function pointer for thread to run 8014c8a0: 27bdffe0 addiu r29,r29,-0x0020 8014c8a4: afb00010 sw r16,0x0010(r29) 8014c8a8: 00808021 addu r16,r4,r0 # threadID 8014c8ac: afb10014 sw r17,0x0014(r29) 8014c8b0: afbf0018 sw r31,0x0018(r29) 8014c8b4: 0c0532ed jal 0x8014cbb4 # ROUTINE: globalPointer = Return Global Pointer 8014c8b8: 00a08821 addu r17,r5,r0 # funcPtr 8014c8bc: 3c038016 lui r3,0x8016 8014c8c0: 8c635f98 lw r3,0x5f98(r3) # (Thread array base pointer) 8014c8c4: 00108280 sll r16,r16,0x0a # threadID * sizeof(thread) 8014c8c8: 02038021 addu r16,r16,r3 # threadPtr = (threadID * sizeof(thread)) + (Thread array base pointer) # // (Conceptually, thread = *threadPtr) 8014c8cc: ae020038 sw r2,0x0038(r16) # thread.GlobalPointer = globalPointer 8014c8d0: 260203f0 addiu r2,r16,0x03f0 # threadPtr + 0x3f0 8014c8d4: ae02003c sw r2,0x003c(r16) # thread.StackPointer = threadPtr + 0x3f0 // (Stack grows backwards) 8014c8d8: ae020040 sw r2,0x0040(r16) # thread.FramePointer = threadPtr + 0x3f0 8014c8dc: 34020001 ori r2,r0,0x0001 # 1 8014c8e0: ae110044 sw r17,0x0044(r16) # thread.CodePointer = funcPtr 8014c8e4: ae020048 sw r2,0x0048(r16) # thread.IsRunning = 1 8014c8e8: ae00004c sw r0,0x004c(r16) # thread.TaskID = 0 8014c8ec: ae00000c sw r0,0x000c(r16) # thread.0x0c = 0 8014c8f0: ae000050 sw r0,0x0050(r16) # thread.0x50 = 0 8014c8f4: ae000054 sw r0,0x0054(r16) # thread.0x54 = 0 8014c8f8: ae000058 sw r0,0x0058(r16) # thread.0x58 = 0 8014c8fc: ae00005c sw r0,0x005c(r16) # thread.0x5c = 0 8014c900: ae000060 sw r0,0x0060(r16) # thread.0x60 = 0 8014c904: ae000064 sw r0,0x0064(r16) # thread.0x64 = 0 8014c908: ae000068 sw r0,0x0068(r16) # thread.0x68 = 0 8014c90c: 8fbf0018 lw r31,0x0018(r29) 8014c910: 8fb10014 lw r17,0x0014(r29) 8014c914: 8fb00010 lw r16,0x0010(r29) 8014c918: 27bd0020 addiu r29,r29,0x0020 8014c91c: 03e00008 jr r31 8014c920: 00000000 nop