prime/asm/Dolphin/os/OSThread.s

1182 lines
54 KiB
ArmAsm

.include "macros.inc"
.section .bss
.balign 8
RunQueue:
.skip 0x9F8
.section .sbss
.balign 8
RunQueueBits:
.skip 0x4
RunQueueHint:
.skip 0x4
Reschedule:
.skip 0x8
.section .sdata
.balign 8
.global lbl_805A8B50
lbl_805A8B50:
# ROM: 0x3F64F0
.4byte DefaultSwitchThreadCallback
.4byte 0
.section .text, "ax"
.global DefaultSwitchThreadCallback
DefaultSwitchThreadCallback:
/* 80384468 003813C8 4E 80 00 20 */ blr
.global __OSThreadInit
__OSThreadInit:
/* 8038446C 003813CC 7C 08 02 A6 */ mflr r0
/* 80384470 003813D0 3C 60 80 54 */ lis r3, RunQueue@ha
/* 80384474 003813D4 90 01 00 04 */ stw r0, 4(r1)
/* 80384478 003813D8 38 00 00 02 */ li r0, 2
/* 8038447C 003813DC 38 80 00 10 */ li r4, 0x10
/* 80384480 003813E0 94 21 FF E8 */ stwu r1, -0x18(r1)
/* 80384484 003813E4 93 E1 00 14 */ stw r31, 0x14(r1)
/* 80384488 003813E8 93 C1 00 10 */ stw r30, 0x10(r1)
/* 8038448C 003813EC 93 A1 00 0C */ stw r29, 0xc(r1)
/* 80384490 003813F0 3B A0 00 00 */ li r29, 0
/* 80384494 003813F4 93 81 00 08 */ stw r28, 8(r1)
/* 80384498 003813F8 3B 83 15 F8 */ addi r28, r3, RunQueue@l
/* 8038449C 003813FC 3B FC 04 18 */ addi r31, r28, 0x418
/* 803844A0 00381400 B0 1C 06 E0 */ sth r0, 0x6e0(r28)
/* 803844A4 00381404 38 00 00 01 */ li r0, 1
/* 803844A8 00381408 38 7F 02 E8 */ addi r3, r31, 0x2e8
/* 803844AC 0038140C B0 1C 06 E2 */ sth r0, 0x6e2(r28)
/* 803844B0 00381410 38 00 FF FF */ li r0, -1
/* 803844B4 00381414 90 9C 06 EC */ stw r4, 0x6ec(r28)
/* 803844B8 00381418 90 9C 06 E8 */ stw r4, 0x6e8(r28)
/* 803844BC 0038141C 93 BC 06 E4 */ stw r29, 0x6e4(r28)
/* 803844C0 00381420 90 1C 06 F0 */ stw r0, 0x6f0(r28)
/* 803844C4 00381424 93 BC 07 08 */ stw r29, 0x708(r28)
/* 803844C8 00381428 48 00 00 FD */ bl OSInitThreadQueue
/* 803844CC 0038142C 93 BC 07 10 */ stw r29, 0x710(r28)
/* 803844D0 00381430 3F C0 80 00 */ lis r30, 0x800000D8@ha
/* 803844D4 00381434 38 7F 00 00 */ addi r3, r31, 0
/* 803844D8 00381438 93 BC 07 0C */ stw r29, 0x70c(r28)
/* 803844DC 0038143C 93 FE 00 D8 */ stw r31, 0x800000D8@l(r30)
/* 803844E0 00381440 4B FF B1 35 */ bl OSClearContext
/* 803844E4 00381444 7F E3 FB 78 */ mr r3, r31
/* 803844E8 00381448 4B FF AF 35 */ bl OSSetCurrentContext
/* 803844EC 0038144C 3C 60 80 5C */ lis r3, _stack_addr@ha
/* 803844F0 00381450 38 03 00 C8 */ addi r0, r3, _stack_addr@l
/* 803844F4 00381454 3C 60 80 5B */ lis r3, _stack_end@ha
/* 803844F8 00381458 90 1C 07 1C */ stw r0, 0x71c(r28)
/* 803844FC 0038145C 38 03 F4 C8 */ addi r0, r3, _stack_end@l
/* 80384500 00381460 90 1C 07 20 */ stw r0, 0x720(r28)
/* 80384504 00381464 3C 60 DE AE */ lis r3, 0xDEADBABE@ha
/* 80384508 00381468 38 03 BA BE */ addi r0, r3, 0xDEADBABE@l
/* 8038450C 0038146C 80 7C 07 20 */ lwz r3, 0x720(r28)
/* 80384510 00381470 7F E4 FB 78 */ mr r4, r31
/* 80384514 00381474 90 03 00 00 */ stw r0, 0(r3)
/* 80384518 00381478 81 8D 9F 90 */ lwz r12, lbl_805A8B50@sda21(r13)
/* 8038451C 0038147C 80 7E 00 E4 */ lwz r3, 0xe4(r30)
/* 80384520 00381480 7D 88 03 A6 */ mtlr r12
/* 80384524 00381484 4E 80 00 21 */ blrl
/* 80384528 00381488 93 FE 00 E4 */ stw r31, 0xe4(r30)
/* 8038452C 0038148C 38 60 00 00 */ li r3, 0
/* 80384530 00381490 48 00 0D CD */ bl OSClearStack
/* 80384534 00381494 93 AD AD 60 */ stw r29, RunQueueBits@sda21(r13)
/* 80384538 00381498 3B C0 00 00 */ li r30, 0
/* 8038453C 0038149C 57 C0 18 38 */ slwi r0, r30, 3
/* 80384540 003814A0 93 AD AD 64 */ stw r29, RunQueueHint@sda21(r13)
/* 80384544 003814A4 7F BC 02 14 */ add r29, r28, r0
lbl_80384548:
/* 80384548 003814A8 7F A3 EB 78 */ mr r3, r29
/* 8038454C 003814AC 48 00 00 79 */ bl OSInitThreadQueue
/* 80384550 003814B0 3B DE 00 01 */ addi r30, r30, 1
/* 80384554 003814B4 2C 1E 00 1F */ cmpwi r30, 0x1f
/* 80384558 003814B8 3B BD 00 08 */ addi r29, r29, 8
/* 8038455C 003814BC 40 81 FF EC */ ble lbl_80384548
/* 80384560 003814C0 3F C0 80 00 */ lis r30, 0x800000DC@ha
/* 80384564 003814C4 38 7E 00 DC */ addi r3, r30, 0x800000DC@l
/* 80384568 003814C8 48 00 00 5D */ bl OSInitThreadQueue
/* 8038456C 003814CC 38 9E 00 DC */ addi r4, r30, 0xdc
/* 80384570 003814D0 84 64 00 04 */ lwzu r3, 4(r4)
/* 80384574 003814D4 28 03 00 00 */ cmplwi r3, 0
/* 80384578 003814D8 40 82 00 0C */ bne lbl_80384584
/* 8038457C 003814DC 93 FE 00 DC */ stw r31, 0xdc(r30)
/* 80384580 003814E0 48 00 00 08 */ b lbl_80384588
lbl_80384584:
/* 80384584 003814E4 93 E3 02 FC */ stw r31, 0x2fc(r3)
lbl_80384588:
/* 80384588 003814E8 90 7F 03 00 */ stw r3, 0x300(r31)
/* 8038458C 003814EC 3B C0 00 00 */ li r30, 0
/* 80384590 003814F0 38 7C 07 30 */ addi r3, r28, 0x730
/* 80384594 003814F4 93 DF 02 FC */ stw r30, 0x2fc(r31)
/* 80384598 003814F8 93 E4 00 00 */ stw r31, 0(r4)
/* 8038459C 003814FC 4B FF B0 79 */ bl OSClearContext
/* 803845A0 00381500 93 CD AD 68 */ stw r30, Reschedule@sda21(r13)
/* 803845A4 00381504 80 01 00 1C */ lwz r0, 0x1c(r1)
/* 803845A8 00381508 83 E1 00 14 */ lwz r31, 0x14(r1)
/* 803845AC 0038150C 83 C1 00 10 */ lwz r30, 0x10(r1)
/* 803845B0 00381510 83 A1 00 0C */ lwz r29, 0xc(r1)
/* 803845B4 00381514 83 81 00 08 */ lwz r28, 8(r1)
/* 803845B8 00381518 38 21 00 18 */ addi r1, r1, 0x18
/* 803845BC 0038151C 7C 08 03 A6 */ mtlr r0
/* 803845C0 00381520 4E 80 00 20 */ blr
.global OSInitThreadQueue
OSInitThreadQueue:
/* 803845C4 00381524 38 00 00 00 */ li r0, 0
/* 803845C8 00381528 90 03 00 04 */ stw r0, 4(r3)
/* 803845CC 0038152C 90 03 00 00 */ stw r0, 0(r3)
/* 803845D0 00381530 4E 80 00 20 */ blr
.global OSGetCurrentThread
OSGetCurrentThread:
/* 803845D4 00381534 3C 60 80 00 */ lis r3, 0x800000E4@ha
/* 803845D8 00381538 80 63 00 E4 */ lwz r3, 0x800000E4@l(r3)
/* 803845DC 0038153C 4E 80 00 20 */ blr
.global OSDisableScheduler
OSDisableScheduler:
/* 803845E0 00381540 7C 08 02 A6 */ mflr r0
/* 803845E4 00381544 90 01 00 04 */ stw r0, 4(r1)
/* 803845E8 00381548 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 803845EC 0038154C 93 E1 00 0C */ stw r31, 0xc(r1)
/* 803845F0 00381550 4B FF D0 71 */ bl OSDisableInterrupts
/* 803845F4 00381554 80 8D AD 68 */ lwz r4, Reschedule@sda21(r13)
/* 803845F8 00381558 38 04 00 01 */ addi r0, r4, 1
/* 803845FC 0038155C 90 0D AD 68 */ stw r0, Reschedule@sda21(r13)
/* 80384600 00381560 7C 9F 23 78 */ mr r31, r4
/* 80384604 00381564 4B FF D0 85 */ bl OSRestoreInterrupts
/* 80384608 00381568 7F E3 FB 78 */ mr r3, r31
/* 8038460C 0038156C 80 01 00 14 */ lwz r0, 0x14(r1)
/* 80384610 00381570 83 E1 00 0C */ lwz r31, 0xc(r1)
/* 80384614 00381574 38 21 00 10 */ addi r1, r1, 0x10
/* 80384618 00381578 7C 08 03 A6 */ mtlr r0
/* 8038461C 0038157C 4E 80 00 20 */ blr
.global OSEnableScheduler
OSEnableScheduler:
/* 80384620 00381580 7C 08 02 A6 */ mflr r0
/* 80384624 00381584 90 01 00 04 */ stw r0, 4(r1)
/* 80384628 00381588 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 8038462C 0038158C 93 E1 00 0C */ stw r31, 0xc(r1)
/* 80384630 00381590 4B FF D0 31 */ bl OSDisableInterrupts
/* 80384634 00381594 80 8D AD 68 */ lwz r4, Reschedule@sda21(r13)
/* 80384638 00381598 38 04 FF FF */ addi r0, r4, -1
/* 8038463C 0038159C 90 0D AD 68 */ stw r0, Reschedule@sda21(r13)
/* 80384640 003815A0 7C 9F 23 78 */ mr r31, r4
/* 80384644 003815A4 4B FF D0 45 */ bl OSRestoreInterrupts
/* 80384648 003815A8 7F E3 FB 78 */ mr r3, r31
/* 8038464C 003815AC 80 01 00 14 */ lwz r0, 0x14(r1)
/* 80384650 003815B0 83 E1 00 0C */ lwz r31, 0xc(r1)
/* 80384654 003815B4 38 21 00 10 */ addi r1, r1, 0x10
/* 80384658 003815B8 7C 08 03 A6 */ mtlr r0
/* 8038465C 003815BC 4E 80 00 20 */ blr
.global UnsetRun
UnsetRun:
/* 80384660 003815C0 80 83 02 E0 */ lwz r4, 0x2e0(r3)
/* 80384664 003815C4 80 A3 02 DC */ lwz r5, 0x2dc(r3)
/* 80384668 003815C8 28 04 00 00 */ cmplwi r4, 0
/* 8038466C 003815CC 80 C3 02 E4 */ lwz r6, 0x2e4(r3)
/* 80384670 003815D0 40 82 00 0C */ bne lbl_8038467C
/* 80384674 003815D4 90 C5 00 04 */ stw r6, 4(r5)
/* 80384678 003815D8 48 00 00 08 */ b lbl_80384680
lbl_8038467C:
/* 8038467C 003815DC 90 C4 02 E4 */ stw r6, 0x2e4(r4)
lbl_80384680:
/* 80384680 003815E0 28 06 00 00 */ cmplwi r6, 0
/* 80384684 003815E4 40 82 00 0C */ bne lbl_80384690
/* 80384688 003815E8 90 85 00 00 */ stw r4, 0(r5)
/* 8038468C 003815EC 48 00 00 08 */ b lbl_80384694
lbl_80384690:
/* 80384690 003815F0 90 86 02 E0 */ stw r4, 0x2e0(r6)
lbl_80384694:
/* 80384694 003815F4 80 05 00 00 */ lwz r0, 0(r5)
/* 80384698 003815F8 28 00 00 00 */ cmplwi r0, 0
/* 8038469C 003815FC 40 82 00 20 */ bne lbl_803846BC
/* 803846A0 00381600 80 03 02 D0 */ lwz r0, 0x2d0(r3)
/* 803846A4 00381604 38 80 00 01 */ li r4, 1
/* 803846A8 00381608 80 AD AD 60 */ lwz r5, RunQueueBits@sda21(r13)
/* 803846AC 0038160C 20 00 00 1F */ subfic r0, r0, 0x1f
/* 803846B0 00381610 7C 80 00 30 */ slw r0, r4, r0
/* 803846B4 00381614 7C A0 00 78 */ andc r0, r5, r0
/* 803846B8 00381618 90 0D AD 60 */ stw r0, RunQueueBits@sda21(r13)
lbl_803846BC:
/* 803846BC 0038161C 38 00 00 00 */ li r0, 0
/* 803846C0 00381620 90 03 02 DC */ stw r0, 0x2dc(r3)
/* 803846C4 00381624 4E 80 00 20 */ blr
.global __OSGetEffectivePriority
__OSGetEffectivePriority:
/* 803846C8 00381628 80 83 02 D4 */ lwz r4, 0x2d4(r3)
/* 803846CC 0038162C 80 A3 02 F4 */ lwz r5, 0x2f4(r3)
/* 803846D0 00381630 48 00 00 24 */ b lbl_803846F4
lbl_803846D4:
/* 803846D4 00381634 80 65 00 00 */ lwz r3, 0(r5)
/* 803846D8 00381638 28 03 00 00 */ cmplwi r3, 0
/* 803846DC 0038163C 41 82 00 14 */ beq lbl_803846F0
/* 803846E0 00381640 80 03 02 D0 */ lwz r0, 0x2d0(r3)
/* 803846E4 00381644 7C 00 20 00 */ cmpw r0, r4
/* 803846E8 00381648 40 80 00 08 */ bge lbl_803846F0
/* 803846EC 0038164C 7C 04 03 78 */ mr r4, r0
lbl_803846F0:
/* 803846F0 00381650 80 A5 00 10 */ lwz r5, 0x10(r5)
lbl_803846F4:
/* 803846F4 00381654 28 05 00 00 */ cmplwi r5, 0
/* 803846F8 00381658 40 82 FF DC */ bne lbl_803846D4
/* 803846FC 0038165C 7C 83 23 78 */ mr r3, r4
/* 80384700 00381660 4E 80 00 20 */ blr
.global SetEffectivePriority
SetEffectivePriority:
/* 80384704 00381664 7C 08 02 A6 */ mflr r0
/* 80384708 00381668 90 01 00 04 */ stw r0, 4(r1)
/* 8038470C 0038166C 94 21 FF E8 */ stwu r1, -0x18(r1)
/* 80384710 00381670 93 E1 00 14 */ stw r31, 0x14(r1)
/* 80384714 00381674 7C 7F 1B 78 */ mr r31, r3
/* 80384718 00381678 93 C1 00 10 */ stw r30, 0x10(r1)
/* 8038471C 0038167C 3B C4 00 00 */ addi r30, r4, 0
/* 80384720 00381680 A0 03 02 C8 */ lhz r0, 0x2c8(r3)
/* 80384724 00381684 2C 00 00 03 */ cmpwi r0, 3
/* 80384728 00381688 41 82 01 80 */ beq lbl_803848A8
/* 8038472C 0038168C 40 80 00 14 */ bge lbl_80384740
/* 80384730 00381690 2C 00 00 01 */ cmpwi r0, 1
/* 80384734 00381694 41 82 00 18 */ beq lbl_8038474C
/* 80384738 00381698 40 80 01 64 */ bge lbl_8038489C
/* 8038473C 0038169C 48 00 01 6C */ b lbl_803848A8
lbl_80384740:
/* 80384740 003816A0 2C 00 00 05 */ cmpwi r0, 5
/* 80384744 003816A4 40 80 01 64 */ bge lbl_803848A8
/* 80384748 003816A8 48 00 00 7C */ b lbl_803847C4
lbl_8038474C:
/* 8038474C 003816AC 7F E3 FB 78 */ mr r3, r31
/* 80384750 003816B0 4B FF FF 11 */ bl UnsetRun
/* 80384754 003816B4 93 DF 02 D0 */ stw r30, 0x2d0(r31)
/* 80384758 003816B8 3C 60 80 54 */ lis r3, RunQueue@ha
/* 8038475C 003816BC 38 03 15 F8 */ addi r0, r3, RunQueue@l
/* 80384760 003816C0 80 7F 02 D0 */ lwz r3, 0x2d0(r31)
/* 80384764 003816C4 54 63 18 38 */ slwi r3, r3, 3
/* 80384768 003816C8 7C 00 1A 14 */ add r0, r0, r3
/* 8038476C 003816CC 90 1F 02 DC */ stw r0, 0x2dc(r31)
/* 80384770 003816D0 80 9F 02 DC */ lwz r4, 0x2dc(r31)
/* 80384774 003816D4 80 64 00 04 */ lwz r3, 4(r4)
/* 80384778 003816D8 28 03 00 00 */ cmplwi r3, 0
/* 8038477C 003816DC 40 82 00 0C */ bne lbl_80384788
/* 80384780 003816E0 93 E4 00 00 */ stw r31, 0(r4)
/* 80384784 003816E4 48 00 00 08 */ b lbl_8038478C
lbl_80384788:
/* 80384788 003816E8 93 E3 02 E0 */ stw r31, 0x2e0(r3)
lbl_8038478C:
/* 8038478C 003816EC 90 7F 02 E4 */ stw r3, 0x2e4(r31)
/* 80384790 003816F0 38 00 00 00 */ li r0, 0
/* 80384794 003816F4 38 60 00 01 */ li r3, 1
/* 80384798 003816F8 90 1F 02 E0 */ stw r0, 0x2e0(r31)
/* 8038479C 003816FC 80 9F 02 DC */ lwz r4, 0x2dc(r31)
/* 803847A0 00381700 93 E4 00 04 */ stw r31, 4(r4)
/* 803847A4 00381704 80 1F 02 D0 */ lwz r0, 0x2d0(r31)
/* 803847A8 00381708 80 8D AD 60 */ lwz r4, RunQueueBits@sda21(r13)
/* 803847AC 0038170C 20 00 00 1F */ subfic r0, r0, 0x1f
/* 803847B0 00381710 7C 60 00 30 */ slw r0, r3, r0
/* 803847B4 00381714 7C 80 03 78 */ or r0, r4, r0
/* 803847B8 00381718 90 0D AD 60 */ stw r0, RunQueueBits@sda21(r13)
/* 803847BC 0038171C 90 6D AD 64 */ stw r3, RunQueueHint@sda21(r13)
/* 803847C0 00381720 48 00 00 E8 */ b lbl_803848A8
lbl_803847C4:
/* 803847C4 00381724 80 9F 02 E0 */ lwz r4, 0x2e0(r31)
/* 803847C8 00381728 80 BF 02 E4 */ lwz r5, 0x2e4(r31)
/* 803847CC 0038172C 28 04 00 00 */ cmplwi r4, 0
/* 803847D0 00381730 40 82 00 10 */ bne lbl_803847E0
/* 803847D4 00381734 80 7F 02 DC */ lwz r3, 0x2dc(r31)
/* 803847D8 00381738 90 A3 00 04 */ stw r5, 4(r3)
/* 803847DC 0038173C 48 00 00 08 */ b lbl_803847E4
lbl_803847E0:
/* 803847E0 00381740 90 A4 02 E4 */ stw r5, 0x2e4(r4)
lbl_803847E4:
/* 803847E4 00381744 28 05 00 00 */ cmplwi r5, 0
/* 803847E8 00381748 40 82 00 10 */ bne lbl_803847F8
/* 803847EC 0038174C 80 7F 02 DC */ lwz r3, 0x2dc(r31)
/* 803847F0 00381750 90 83 00 00 */ stw r4, 0(r3)
/* 803847F4 00381754 48 00 00 08 */ b lbl_803847FC
lbl_803847F8:
/* 803847F8 00381758 90 85 02 E0 */ stw r4, 0x2e0(r5)
lbl_803847FC:
/* 803847FC 0038175C 93 DF 02 D0 */ stw r30, 0x2d0(r31)
/* 80384800 00381760 80 9F 02 DC */ lwz r4, 0x2dc(r31)
/* 80384804 00381764 80 A4 00 00 */ lwz r5, 0(r4)
/* 80384808 00381768 48 00 00 08 */ b lbl_80384810
lbl_8038480C:
/* 8038480C 0038176C 80 A5 02 E0 */ lwz r5, 0x2e0(r5)
lbl_80384810:
/* 80384810 00381770 28 05 00 00 */ cmplwi r5, 0
/* 80384814 00381774 41 82 00 14 */ beq lbl_80384828
/* 80384818 00381778 80 65 02 D0 */ lwz r3, 0x2d0(r5)
/* 8038481C 0038177C 80 1F 02 D0 */ lwz r0, 0x2d0(r31)
/* 80384820 00381780 7C 03 00 00 */ cmpw r3, r0
/* 80384824 00381784 40 81 FF E8 */ ble lbl_8038480C
lbl_80384828:
/* 80384828 00381788 28 05 00 00 */ cmplwi r5, 0
/* 8038482C 0038178C 40 82 00 34 */ bne lbl_80384860
/* 80384830 00381790 80 64 00 04 */ lwz r3, 4(r4)
/* 80384834 00381794 28 03 00 00 */ cmplwi r3, 0
/* 80384838 00381798 40 82 00 0C */ bne lbl_80384844
/* 8038483C 0038179C 93 E4 00 00 */ stw r31, 0(r4)
/* 80384840 003817A0 48 00 00 08 */ b lbl_80384848
lbl_80384844:
/* 80384844 003817A4 93 E3 02 E0 */ stw r31, 0x2e0(r3)
lbl_80384848:
/* 80384848 003817A8 90 7F 02 E4 */ stw r3, 0x2e4(r31)
/* 8038484C 003817AC 38 00 00 00 */ li r0, 0
/* 80384850 003817B0 90 1F 02 E0 */ stw r0, 0x2e0(r31)
/* 80384854 003817B4 80 7F 02 DC */ lwz r3, 0x2dc(r31)
/* 80384858 003817B8 93 E3 00 04 */ stw r31, 4(r3)
/* 8038485C 003817BC 48 00 00 2C */ b lbl_80384888
lbl_80384860:
/* 80384860 003817C0 90 BF 02 E0 */ stw r5, 0x2e0(r31)
/* 80384864 003817C4 80 65 02 E4 */ lwz r3, 0x2e4(r5)
/* 80384868 003817C8 93 E5 02 E4 */ stw r31, 0x2e4(r5)
/* 8038486C 003817CC 28 03 00 00 */ cmplwi r3, 0
/* 80384870 003817D0 90 7F 02 E4 */ stw r3, 0x2e4(r31)
/* 80384874 003817D4 40 82 00 10 */ bne lbl_80384884
/* 80384878 003817D8 80 7F 02 DC */ lwz r3, 0x2dc(r31)
/* 8038487C 003817DC 93 E3 00 00 */ stw r31, 0(r3)
/* 80384880 003817E0 48 00 00 08 */ b lbl_80384888
lbl_80384884:
/* 80384884 003817E4 93 E3 02 E0 */ stw r31, 0x2e0(r3)
lbl_80384888:
/* 80384888 003817E8 80 7F 02 F0 */ lwz r3, 0x2f0(r31)
/* 8038488C 003817EC 28 03 00 00 */ cmplwi r3, 0
/* 80384890 003817F0 41 82 00 18 */ beq lbl_803848A8
/* 80384894 003817F4 80 63 00 08 */ lwz r3, 8(r3)
/* 80384898 003817F8 48 00 00 14 */ b lbl_803848AC
lbl_8038489C:
/* 8038489C 003817FC 38 00 00 01 */ li r0, 1
/* 803848A0 00381800 90 0D AD 64 */ stw r0, RunQueueHint@sda21(r13)
/* 803848A4 00381804 93 DF 02 D0 */ stw r30, 0x2d0(r31)
lbl_803848A8:
/* 803848A8 00381808 38 60 00 00 */ li r3, 0
lbl_803848AC:
/* 803848AC 0038180C 80 01 00 1C */ lwz r0, 0x1c(r1)
/* 803848B0 00381810 83 E1 00 14 */ lwz r31, 0x14(r1)
/* 803848B4 00381814 83 C1 00 10 */ lwz r30, 0x10(r1)
/* 803848B8 00381818 38 21 00 18 */ addi r1, r1, 0x18
/* 803848BC 0038181C 7C 08 03 A6 */ mtlr r0
/* 803848C0 00381820 4E 80 00 20 */ blr
.global SelectThread
SelectThread:
/* 803848C4 00381824 7C 08 02 A6 */ mflr r0
/* 803848C8 00381828 3C 80 80 54 */ lis r4, RunQueue@ha
/* 803848CC 0038182C 90 01 00 04 */ stw r0, 4(r1)
/* 803848D0 00381830 94 21 FF E8 */ stwu r1, -0x18(r1)
/* 803848D4 00381834 93 E1 00 14 */ stw r31, 0x14(r1)
/* 803848D8 00381838 3B E4 15 F8 */ addi r31, r4, RunQueue@l
/* 803848DC 0038183C 93 C1 00 10 */ stw r30, 0x10(r1)
/* 803848E0 00381840 3B C3 00 00 */ addi r30, r3, 0
/* 803848E4 00381844 80 0D AD 68 */ lwz r0, Reschedule@sda21(r13)
/* 803848E8 00381848 2C 00 00 00 */ cmpwi r0, 0
/* 803848EC 0038184C 40 81 00 0C */ ble lbl_803848F8
/* 803848F0 00381850 38 60 00 00 */ li r3, 0
/* 803848F4 00381854 48 00 01 E0 */ b lbl_80384AD4
lbl_803848F8:
/* 803848F8 00381858 4B FF AB 81 */ bl OSGetCurrentContext
/* 803848FC 0038185C 3C 80 80 00 */ lis r4, 0x800000E4@ha
/* 80384900 00381860 80 C4 00 E4 */ lwz r6, 0x800000E4@l(r4)
/* 80384904 00381864 7C 03 30 40 */ cmplw r3, r6
/* 80384908 00381868 38 66 00 00 */ addi r3, r6, 0
/* 8038490C 0038186C 41 82 00 0C */ beq lbl_80384918
/* 80384910 00381870 38 60 00 00 */ li r3, 0
/* 80384914 00381874 48 00 01 C0 */ b lbl_80384AD4
lbl_80384918:
/* 80384918 00381878 28 06 00 00 */ cmplwi r6, 0
/* 8038491C 0038187C 41 82 00 BC */ beq lbl_803849D8
/* 80384920 00381880 A0 06 02 C8 */ lhz r0, 0x2c8(r6)
/* 80384924 00381884 28 00 00 02 */ cmplwi r0, 2
/* 80384928 00381888 40 82 00 90 */ bne lbl_803849B8
/* 8038492C 0038188C 2C 1E 00 00 */ cmpwi r30, 0
/* 80384930 00381890 40 82 00 20 */ bne lbl_80384950
/* 80384934 00381894 80 8D AD 60 */ lwz r4, RunQueueBits@sda21(r13)
/* 80384938 00381898 80 06 02 D0 */ lwz r0, 0x2d0(r6)
/* 8038493C 0038189C 7C 84 00 34 */ cntlzw r4, r4
/* 80384940 003818A0 7C 00 20 00 */ cmpw r0, r4
/* 80384944 003818A4 41 81 00 0C */ bgt lbl_80384950
/* 80384948 003818A8 38 60 00 00 */ li r3, 0
/* 8038494C 003818AC 48 00 01 88 */ b lbl_80384AD4
lbl_80384950:
/* 80384950 003818B0 38 00 00 01 */ li r0, 1
/* 80384954 003818B4 B0 06 02 C8 */ sth r0, 0x2c8(r6)
/* 80384958 003818B8 80 06 02 D0 */ lwz r0, 0x2d0(r6)
/* 8038495C 003818BC 54 00 18 38 */ slwi r0, r0, 3
/* 80384960 003818C0 7C 1F 02 14 */ add r0, r31, r0
/* 80384964 003818C4 90 06 02 DC */ stw r0, 0x2dc(r6)
/* 80384968 003818C8 80 A6 02 DC */ lwz r5, 0x2dc(r6)
/* 8038496C 003818CC 80 85 00 04 */ lwz r4, 4(r5)
/* 80384970 003818D0 28 04 00 00 */ cmplwi r4, 0
/* 80384974 003818D4 40 82 00 0C */ bne lbl_80384980
/* 80384978 003818D8 90 C5 00 00 */ stw r6, 0(r5)
/* 8038497C 003818DC 48 00 00 08 */ b lbl_80384984
lbl_80384980:
/* 80384980 003818E0 90 C4 02 E0 */ stw r6, 0x2e0(r4)
lbl_80384984:
/* 80384984 003818E4 90 86 02 E4 */ stw r4, 0x2e4(r6)
/* 80384988 003818E8 38 00 00 00 */ li r0, 0
/* 8038498C 003818EC 38 80 00 01 */ li r4, 1
/* 80384990 003818F0 90 06 02 E0 */ stw r0, 0x2e0(r6)
/* 80384994 003818F4 80 A6 02 DC */ lwz r5, 0x2dc(r6)
/* 80384998 003818F8 90 C5 00 04 */ stw r6, 4(r5)
/* 8038499C 003818FC 80 06 02 D0 */ lwz r0, 0x2d0(r6)
/* 803849A0 00381900 80 AD AD 60 */ lwz r5, RunQueueBits@sda21(r13)
/* 803849A4 00381904 20 00 00 1F */ subfic r0, r0, 0x1f
/* 803849A8 00381908 7C 80 00 30 */ slw r0, r4, r0
/* 803849AC 0038190C 7C A0 03 78 */ or r0, r5, r0
/* 803849B0 00381910 90 0D AD 60 */ stw r0, RunQueueBits@sda21(r13)
/* 803849B4 00381914 90 8D AD 64 */ stw r4, RunQueueHint@sda21(r13)
lbl_803849B8:
/* 803849B8 00381918 A0 06 01 A2 */ lhz r0, 0x1a2(r6)
/* 803849BC 0038191C 54 00 07 BD */ rlwinm. r0, r0, 0, 0x1e, 0x1e
/* 803849C0 00381920 40 82 00 18 */ bne lbl_803849D8
/* 803849C4 00381924 4B FF AA C1 */ bl OSSaveContext
/* 803849C8 00381928 28 03 00 00 */ cmplwi r3, 0
/* 803849CC 0038192C 41 82 00 0C */ beq lbl_803849D8
/* 803849D0 00381930 38 60 00 00 */ li r3, 0
/* 803849D4 00381934 48 00 01 00 */ b lbl_80384AD4
lbl_803849D8:
/* 803849D8 00381938 81 8D 9F 90 */ lwz r12, lbl_805A8B50@sda21(r13)
/* 803849DC 0038193C 3F C0 80 00 */ lis r30, 0x800000E4@ha
/* 803849E0 00381940 80 7E 00 E4 */ lwz r3, 0x800000E4@l(r30)
/* 803849E4 00381944 38 80 00 00 */ li r4, 0
/* 803849E8 00381948 7D 88 03 A6 */ mtlr r12
/* 803849EC 0038194C 4E 80 00 21 */ blrl
/* 803849F0 00381950 80 0D AD 60 */ lwz r0, RunQueueBits@sda21(r13)
/* 803849F4 00381954 38 60 00 00 */ li r3, 0
/* 803849F8 00381958 90 7E 00 E4 */ stw r3, 0xe4(r30)
/* 803849FC 0038195C 28 00 00 00 */ cmplwi r0, 0
/* 80384A00 00381960 40 82 00 34 */ bne lbl_80384A34
/* 80384A04 00381964 38 7F 07 30 */ addi r3, r31, 0x730
/* 80384A08 00381968 4B FF AA 15 */ bl OSSetCurrentContext
lbl_80384A0C:
/* 80384A0C 0038196C 4B FF CC 69 */ bl OSEnableInterrupts
lbl_80384A10:
/* 80384A10 00381970 80 0D AD 60 */ lwz r0, RunQueueBits@sda21(r13)
/* 80384A14 00381974 28 00 00 00 */ cmplwi r0, 0
/* 80384A18 00381978 41 82 FF F8 */ beq lbl_80384A10
/* 80384A1C 0038197C 4B FF CC 45 */ bl OSDisableInterrupts
/* 80384A20 00381980 80 0D AD 60 */ lwz r0, RunQueueBits@sda21(r13)
/* 80384A24 00381984 28 00 00 00 */ cmplwi r0, 0
/* 80384A28 00381988 41 82 FF E4 */ beq lbl_80384A0C
/* 80384A2C 0038198C 38 7F 07 30 */ addi r3, r31, 0x730
/* 80384A30 00381990 4B FF AB E5 */ bl OSClearContext
lbl_80384A34:
/* 80384A34 00381994 38 60 00 00 */ li r3, 0
/* 80384A38 00381998 90 6D AD 64 */ stw r3, RunQueueHint@sda21(r13)
/* 80384A3C 0038199C 80 0D AD 60 */ lwz r0, RunQueueBits@sda21(r13)
/* 80384A40 003819A0 7C 07 00 34 */ cntlzw r7, r0
/* 80384A44 003819A4 54 E0 18 38 */ slwi r0, r7, 3
/* 80384A48 003819A8 7C 9F 02 14 */ add r4, r31, r0
/* 80384A4C 003819AC 80 A4 00 00 */ lwz r5, 0(r4)
/* 80384A50 003819B0 80 C5 02 E0 */ lwz r6, 0x2e0(r5)
/* 80384A54 003819B4 3B C5 00 00 */ addi r30, r5, 0
/* 80384A58 003819B8 28 06 00 00 */ cmplwi r6, 0
/* 80384A5C 003819BC 40 82 00 0C */ bne lbl_80384A68
/* 80384A60 003819C0 90 64 00 04 */ stw r3, 4(r4)
/* 80384A64 003819C4 48 00 00 08 */ b lbl_80384A6C
lbl_80384A68:
/* 80384A68 003819C8 90 66 02 E4 */ stw r3, 0x2e4(r6)
lbl_80384A6C:
/* 80384A6C 003819CC 90 C4 00 00 */ stw r6, 0(r4)
/* 80384A70 003819D0 80 04 00 00 */ lwz r0, 0(r4)
/* 80384A74 003819D4 28 00 00 00 */ cmplwi r0, 0
/* 80384A78 003819D8 40 82 00 1C */ bne lbl_80384A94
/* 80384A7C 003819DC 20 07 00 1F */ subfic r0, r7, 0x1f
/* 80384A80 003819E0 80 8D AD 60 */ lwz r4, RunQueueBits@sda21(r13)
/* 80384A84 003819E4 38 60 00 01 */ li r3, 1
/* 80384A88 003819E8 7C 60 00 30 */ slw r0, r3, r0
/* 80384A8C 003819EC 7C 80 00 78 */ andc r0, r4, r0
/* 80384A90 003819F0 90 0D AD 60 */ stw r0, RunQueueBits@sda21(r13)
lbl_80384A94:
/* 80384A94 003819F4 38 00 00 00 */ li r0, 0
/* 80384A98 003819F8 90 1E 02 DC */ stw r0, 0x2dc(r30)
/* 80384A9C 003819FC 38 00 00 02 */ li r0, 2
/* 80384AA0 00381A00 3F E0 80 00 */ lis r31, 0x800000E4@ha
/* 80384AA4 00381A04 B0 1E 02 C8 */ sth r0, 0x2c8(r30)
/* 80384AA8 00381A08 7F C4 F3 78 */ mr r4, r30
/* 80384AAC 00381A0C 81 8D 9F 90 */ lwz r12, lbl_805A8B50@sda21(r13)
/* 80384AB0 00381A10 80 7F 00 E4 */ lwz r3, 0x800000E4@l(r31)
/* 80384AB4 00381A14 7D 88 03 A6 */ mtlr r12
/* 80384AB8 00381A18 4E 80 00 21 */ blrl
/* 80384ABC 00381A1C 93 DF 00 E4 */ stw r30, 0xe4(r31)
/* 80384AC0 00381A20 7F C3 F3 78 */ mr r3, r30
/* 80384AC4 00381A24 4B FF A9 59 */ bl OSSetCurrentContext
/* 80384AC8 00381A28 7F C3 F3 78 */ mr r3, r30
/* 80384ACC 00381A2C 4B FF AA 39 */ bl OSLoadContext
/* 80384AD0 00381A30 7F C3 F3 78 */ mr r3, r30
lbl_80384AD4:
/* 80384AD4 00381A34 80 01 00 1C */ lwz r0, 0x1c(r1)
/* 80384AD8 00381A38 83 E1 00 14 */ lwz r31, 0x14(r1)
/* 80384ADC 00381A3C 83 C1 00 10 */ lwz r30, 0x10(r1)
/* 80384AE0 00381A40 38 21 00 18 */ addi r1, r1, 0x18
/* 80384AE4 00381A44 7C 08 03 A6 */ mtlr r0
/* 80384AE8 00381A48 4E 80 00 20 */ blr
.global __OSReschedule
__OSReschedule:
/* 80384AEC 00381A4C 7C 08 02 A6 */ mflr r0
/* 80384AF0 00381A50 90 01 00 04 */ stw r0, 4(r1)
/* 80384AF4 00381A54 94 21 FF F8 */ stwu r1, -8(r1)
/* 80384AF8 00381A58 80 0D AD 64 */ lwz r0, RunQueueHint@sda21(r13)
/* 80384AFC 00381A5C 2C 00 00 00 */ cmpwi r0, 0
/* 80384B00 00381A60 41 82 00 0C */ beq lbl_80384B0C
/* 80384B04 00381A64 38 60 00 00 */ li r3, 0
/* 80384B08 00381A68 4B FF FD BD */ bl SelectThread
lbl_80384B0C:
/* 80384B0C 00381A6C 80 01 00 0C */ lwz r0, 0xc(r1)
/* 80384B10 00381A70 38 21 00 08 */ addi r1, r1, 8
/* 80384B14 00381A74 7C 08 03 A6 */ mtlr r0
/* 80384B18 00381A78 4E 80 00 20 */ blr
.global OSYieldThread
OSYieldThread:
/* 80384B1C 00381A7C 7C 08 02 A6 */ mflr r0
/* 80384B20 00381A80 90 01 00 04 */ stw r0, 4(r1)
/* 80384B24 00381A84 94 21 FF F0 */ stwu r1, -0x10(r1)
/* 80384B28 00381A88 93 E1 00 0C */ stw r31, 0xc(r1)
/* 80384B2C 00381A8C 4B FF CB 35 */ bl OSDisableInterrupts
/* 80384B30 00381A90 3B E3 00 00 */ addi r31, r3, 0
/* 80384B34 00381A94 38 60 00 01 */ li r3, 1
/* 80384B38 00381A98 4B FF FD 8D */ bl SelectThread
/* 80384B3C 00381A9C 7F E3 FB 78 */ mr r3, r31
/* 80384B40 00381AA0 4B FF CB 49 */ bl OSRestoreInterrupts
/* 80384B44 00381AA4 80 01 00 14 */ lwz r0, 0x14(r1)
/* 80384B48 00381AA8 83 E1 00 0C */ lwz r31, 0xc(r1)
/* 80384B4C 00381AAC 38 21 00 10 */ addi r1, r1, 0x10
/* 80384B50 00381AB0 7C 08 03 A6 */ mtlr r0
/* 80384B54 00381AB4 4E 80 00 20 */ blr
.global OSCancelThread
OSCancelThread:
/* 80384B58 00381AB8 7C 08 02 A6 */ mflr r0
/* 80384B5C 00381ABC 90 01 00 04 */ stw r0, 4(r1)
/* 80384B60 00381AC0 94 21 FF E0 */ stwu r1, -0x20(r1)
/* 80384B64 00381AC4 93 E1 00 1C */ stw r31, 0x1c(r1)
/* 80384B68 00381AC8 93 C1 00 18 */ stw r30, 0x18(r1)
/* 80384B6C 00381ACC 7C 7E 1B 78 */ mr r30, r3
/* 80384B70 00381AD0 93 A1 00 14 */ stw r29, 0x14(r1)
/* 80384B74 00381AD4 4B FF CA ED */ bl OSDisableInterrupts
/* 80384B78 00381AD8 A0 1E 02 C8 */ lhz r0, 0x2c8(r30)
/* 80384B7C 00381ADC 3B E3 00 00 */ addi r31, r3, 0
/* 80384B80 00381AE0 2C 00 00 03 */ cmpwi r0, 3
/* 80384B84 00381AE4 41 82 00 DC */ beq lbl_80384C60
/* 80384B88 00381AE8 40 80 00 14 */ bge lbl_80384B9C
/* 80384B8C 00381AEC 2C 00 00 01 */ cmpwi r0, 1
/* 80384B90 00381AF0 41 82 00 18 */ beq lbl_80384BA8
/* 80384B94 00381AF4 40 80 00 2C */ bge lbl_80384BC0
/* 80384B98 00381AF8 48 00 00 C8 */ b lbl_80384C60
lbl_80384B9C:
/* 80384B9C 00381AFC 2C 00 00 05 */ cmpwi r0, 5
/* 80384BA0 00381B00 40 80 00 C0 */ bge lbl_80384C60
/* 80384BA4 00381B04 48 00 00 28 */ b lbl_80384BCC
lbl_80384BA8:
/* 80384BA8 00381B08 80 1E 02 CC */ lwz r0, 0x2cc(r30)
/* 80384BAC 00381B0C 2C 00 00 00 */ cmpwi r0, 0
/* 80384BB0 00381B10 41 81 00 BC */ bgt lbl_80384C6C
/* 80384BB4 00381B14 7F C3 F3 78 */ mr r3, r30
/* 80384BB8 00381B18 4B FF FA A9 */ bl UnsetRun
/* 80384BBC 00381B1C 48 00 00 B0 */ b lbl_80384C6C
lbl_80384BC0:
/* 80384BC0 00381B20 38 00 00 01 */ li r0, 1
/* 80384BC4 00381B24 90 0D AD 64 */ stw r0, RunQueueHint@sda21(r13)
/* 80384BC8 00381B28 48 00 00 A4 */ b lbl_80384C6C
lbl_80384BCC:
/* 80384BCC 00381B2C 80 9E 02 E0 */ lwz r4, 0x2e0(r30)
/* 80384BD0 00381B30 80 BE 02 E4 */ lwz r5, 0x2e4(r30)
/* 80384BD4 00381B34 28 04 00 00 */ cmplwi r4, 0
/* 80384BD8 00381B38 40 82 00 10 */ bne lbl_80384BE8
/* 80384BDC 00381B3C 80 7E 02 DC */ lwz r3, 0x2dc(r30)
/* 80384BE0 00381B40 90 A3 00 04 */ stw r5, 4(r3)
/* 80384BE4 00381B44 48 00 00 08 */ b lbl_80384BEC
lbl_80384BE8:
/* 80384BE8 00381B48 90 A4 02 E4 */ stw r5, 0x2e4(r4)
lbl_80384BEC:
/* 80384BEC 00381B4C 28 05 00 00 */ cmplwi r5, 0
/* 80384BF0 00381B50 40 82 00 10 */ bne lbl_80384C00
/* 80384BF4 00381B54 80 7E 02 DC */ lwz r3, 0x2dc(r30)
/* 80384BF8 00381B58 90 83 00 00 */ stw r4, 0(r3)
/* 80384BFC 00381B5C 48 00 00 08 */ b lbl_80384C04
lbl_80384C00:
/* 80384C00 00381B60 90 85 02 E0 */ stw r4, 0x2e0(r5)
lbl_80384C04:
/* 80384C04 00381B64 38 00 00 00 */ li r0, 0
/* 80384C08 00381B68 90 1E 02 DC */ stw r0, 0x2dc(r30)
/* 80384C0C 00381B6C 80 1E 02 CC */ lwz r0, 0x2cc(r30)
/* 80384C10 00381B70 2C 00 00 00 */ cmpwi r0, 0
/* 80384C14 00381B74 41 81 00 58 */ bgt lbl_80384C6C
/* 80384C18 00381B78 80 7E 02 F0 */ lwz r3, 0x2f0(r30)
/* 80384C1C 00381B7C 28 03 00 00 */ cmplwi r3, 0
/* 80384C20 00381B80 41 82 00 4C */ beq lbl_80384C6C
/* 80384C24 00381B84 83 A3 00 08 */ lwz r29, 8(r3)
lbl_80384C28:
/* 80384C28 00381B88 80 1D 02 CC */ lwz r0, 0x2cc(r29)
/* 80384C2C 00381B8C 2C 00 00 00 */ cmpwi r0, 0
/* 80384C30 00381B90 41 81 00 3C */ bgt lbl_80384C6C
/* 80384C34 00381B94 7F A3 EB 78 */ mr r3, r29
/* 80384C38 00381B98 4B FF FA 91 */ bl __OSGetEffectivePriority
/* 80384C3C 00381B9C 80 1D 02 D0 */ lwz r0, 0x2d0(r29)
/* 80384C40 00381BA0 38 83 00 00 */ addi r4, r3, 0
/* 80384C44 00381BA4 7C 00 20 00 */ cmpw r0, r4
/* 80384C48 00381BA8 41 82 00 24 */ beq lbl_80384C6C
/* 80384C4C 00381BAC 7F A3 EB 78 */ mr r3, r29
/* 80384C50 00381BB0 4B FF FA B5 */ bl SetEffectivePriority
/* 80384C54 00381BB4 7C 7D 1B 79 */ or. r29, r3, r3
/* 80384C58 00381BB8 40 82 FF D0 */ bne lbl_80384C28
/* 80384C5C 00381BBC 48 00 00 10 */ b lbl_80384C6C
lbl_80384C60:
/* 80384C60 00381BC0 7F E3 FB 78 */ mr r3, r31
/* 80384C64 00381BC4 4B FF CA 25 */ bl OSRestoreInterrupts
/* 80384C68 00381BC8 48 00 00 90 */ b lbl_80384CF8
lbl_80384C6C:
/* 80384C6C 00381BCC 7F C3 F3 78 */ mr r3, r30
/* 80384C70 00381BD0 4B FF A9 A5 */ bl OSClearContext
/* 80384C74 00381BD4 A0 1E 02 CA */ lhz r0, 0x2ca(r30)
/* 80384C78 00381BD8 54 00 07 FF */ clrlwi. r0, r0, 0x1f
/* 80384C7C 00381BDC 41 82 00 48 */ beq lbl_80384CC4
/* 80384C80 00381BE0 80 9E 02 FC */ lwz r4, 0x2fc(r30)
/* 80384C84 00381BE4 80 BE 03 00 */ lwz r5, 0x300(r30)
/* 80384C88 00381BE8 28 04 00 00 */ cmplwi r4, 0
/* 80384C8C 00381BEC 40 82 00 10 */ bne lbl_80384C9C
/* 80384C90 00381BF0 3C 60 80 00 */ lis r3, 0x800000E0@ha
/* 80384C94 00381BF4 90 A3 00 E0 */ stw r5, 0x800000E0@l(r3)
/* 80384C98 00381BF8 48 00 00 08 */ b lbl_80384CA0
lbl_80384C9C:
/* 80384C9C 00381BFC 90 A4 03 00 */ stw r5, 0x300(r4)
lbl_80384CA0:
/* 80384CA0 00381C00 28 05 00 00 */ cmplwi r5, 0
/* 80384CA4 00381C04 40 82 00 10 */ bne lbl_80384CB4
/* 80384CA8 00381C08 3C 60 80 00 */ lis r3, 0x800000DC@ha
/* 80384CAC 00381C0C 90 83 00 DC */ stw r4, 0x800000DC@l(r3)
/* 80384CB0 00381C10 48 00 00 08 */ b lbl_80384CB8
lbl_80384CB4:
/* 80384CB4 00381C14 90 85 02 FC */ stw r4, 0x2fc(r5)
lbl_80384CB8:
/* 80384CB8 00381C18 38 00 00 00 */ li r0, 0
/* 80384CBC 00381C1C B0 1E 02 C8 */ sth r0, 0x2c8(r30)
/* 80384CC0 00381C20 48 00 00 0C */ b lbl_80384CCC
lbl_80384CC4:
/* 80384CC4 00381C24 38 00 00 08 */ li r0, 8
/* 80384CC8 00381C28 B0 1E 02 C8 */ sth r0, 0x2c8(r30)
lbl_80384CCC:
/* 80384CCC 00381C2C 7F C3 F3 78 */ mr r3, r30
/* 80384CD0 00381C30 4B FF E0 E9 */ bl __OSUnlockAllMutex
/* 80384CD4 00381C34 38 7E 02 E8 */ addi r3, r30, 0x2e8
/* 80384CD8 00381C38 48 00 05 21 */ bl OSWakeupThread
/* 80384CDC 00381C3C 80 0D AD 64 */ lwz r0, RunQueueHint@sda21(r13)
/* 80384CE0 00381C40 2C 00 00 00 */ cmpwi r0, 0
/* 80384CE4 00381C44 41 82 00 0C */ beq lbl_80384CF0
/* 80384CE8 00381C48 38 60 00 00 */ li r3, 0
/* 80384CEC 00381C4C 4B FF FB D9 */ bl SelectThread
lbl_80384CF0:
/* 80384CF0 00381C50 7F E3 FB 78 */ mr r3, r31
/* 80384CF4 00381C54 4B FF C9 95 */ bl OSRestoreInterrupts
lbl_80384CF8:
/* 80384CF8 00381C58 80 01 00 24 */ lwz r0, 0x24(r1)
/* 80384CFC 00381C5C 83 E1 00 1C */ lwz r31, 0x1c(r1)
/* 80384D00 00381C60 83 C1 00 18 */ lwz r30, 0x18(r1)
/* 80384D04 00381C64 83 A1 00 14 */ lwz r29, 0x14(r1)
/* 80384D08 00381C68 38 21 00 20 */ addi r1, r1, 0x20
/* 80384D0C 00381C6C 7C 08 03 A6 */ mtlr r0
/* 80384D10 00381C70 4E 80 00 20 */ blr
.global OSResumeThread
OSResumeThread:
/* 80384D14 00381C74 7C 08 02 A6 */ mflr r0
/* 80384D18 00381C78 90 01 00 04 */ stw r0, 4(r1)
/* 80384D1C 00381C7C 94 21 FF D8 */ stwu r1, -0x28(r1)
/* 80384D20 00381C80 93 E1 00 24 */ stw r31, 0x24(r1)
/* 80384D24 00381C84 93 C1 00 20 */ stw r30, 0x20(r1)
/* 80384D28 00381C88 93 A1 00 1C */ stw r29, 0x1c(r1)
/* 80384D2C 00381C8C 7C 7D 1B 78 */ mr r29, r3
/* 80384D30 00381C90 4B FF C9 31 */ bl OSDisableInterrupts
/* 80384D34 00381C94 80 9D 02 CC */ lwz r4, 0x2cc(r29)
/* 80384D38 00381C98 3B E3 00 00 */ addi r31, r3, 0
/* 80384D3C 00381C9C 38 04 FF FF */ addi r0, r4, -1
/* 80384D40 00381CA0 90 1D 02 CC */ stw r0, 0x2cc(r29)
/* 80384D44 00381CA4 7C 9E 23 78 */ mr r30, r4
/* 80384D48 00381CA8 80 1D 02 CC */ lwz r0, 0x2cc(r29)
/* 80384D4C 00381CAC 2C 00 00 00 */ cmpwi r0, 0
/* 80384D50 00381CB0 40 80 00 10 */ bge lbl_80384D60
/* 80384D54 00381CB4 38 00 00 00 */ li r0, 0
/* 80384D58 00381CB8 90 1D 02 CC */ stw r0, 0x2cc(r29)
/* 80384D5C 00381CBC 48 00 02 18 */ b lbl_80384F74
lbl_80384D60:
/* 80384D60 00381CC0 40 82 02 14 */ bne lbl_80384F74
/* 80384D64 00381CC4 A0 1D 02 C8 */ lhz r0, 0x2c8(r29)
/* 80384D68 00381CC8 2C 00 00 04 */ cmpwi r0, 4
/* 80384D6C 00381CCC 41 82 00 B8 */ beq lbl_80384E24
/* 80384D70 00381CD0 40 80 01 F0 */ bge lbl_80384F60
/* 80384D74 00381CD4 2C 00 00 01 */ cmpwi r0, 1
/* 80384D78 00381CD8 41 82 00 08 */ beq lbl_80384D80
/* 80384D7C 00381CDC 48 00 01 E4 */ b lbl_80384F60
lbl_80384D80:
/* 80384D80 00381CE0 80 1D 02 D4 */ lwz r0, 0x2d4(r29)
/* 80384D84 00381CE4 80 7D 02 F4 */ lwz r3, 0x2f4(r29)
/* 80384D88 00381CE8 48 00 00 24 */ b lbl_80384DAC
lbl_80384D8C:
/* 80384D8C 00381CEC 80 83 00 00 */ lwz r4, 0(r3)
/* 80384D90 00381CF0 28 04 00 00 */ cmplwi r4, 0
/* 80384D94 00381CF4 41 82 00 14 */ beq lbl_80384DA8
/* 80384D98 00381CF8 80 84 02 D0 */ lwz r4, 0x2d0(r4)
/* 80384D9C 00381CFC 7C 04 00 00 */ cmpw r4, r0
/* 80384DA0 00381D00 40 80 00 08 */ bge lbl_80384DA8
/* 80384DA4 00381D04 7C 80 23 78 */ mr r0, r4
lbl_80384DA8:
/* 80384DA8 00381D08 80 63 00 10 */ lwz r3, 0x10(r3)
lbl_80384DAC:
/* 80384DAC 00381D0C 28 03 00 00 */ cmplwi r3, 0
/* 80384DB0 00381D10 40 82 FF DC */ bne lbl_80384D8C
/* 80384DB4 00381D14 90 1D 02 D0 */ stw r0, 0x2d0(r29)
/* 80384DB8 00381D18 3C 60 80 54 */ lis r3, RunQueue@ha
/* 80384DBC 00381D1C 38 03 15 F8 */ addi r0, r3, RunQueue@l
/* 80384DC0 00381D20 80 7D 02 D0 */ lwz r3, 0x2d0(r29)
/* 80384DC4 00381D24 54 63 18 38 */ slwi r3, r3, 3
/* 80384DC8 00381D28 7C 00 1A 14 */ add r0, r0, r3
/* 80384DCC 00381D2C 90 1D 02 DC */ stw r0, 0x2dc(r29)
/* 80384DD0 00381D30 80 9D 02 DC */ lwz r4, 0x2dc(r29)
/* 80384DD4 00381D34 80 64 00 04 */ lwz r3, 4(r4)
/* 80384DD8 00381D38 28 03 00 00 */ cmplwi r3, 0
/* 80384DDC 00381D3C 40 82 00 0C */ bne lbl_80384DE8
/* 80384DE0 00381D40 93 A4 00 00 */ stw r29, 0(r4)
/* 80384DE4 00381D44 48 00 00 08 */ b lbl_80384DEC
lbl_80384DE8:
/* 80384DE8 00381D48 93 A3 02 E0 */ stw r29, 0x2e0(r3)
lbl_80384DEC:
/* 80384DEC 00381D4C 90 7D 02 E4 */ stw r3, 0x2e4(r29)
/* 80384DF0 00381D50 38 00 00 00 */ li r0, 0
/* 80384DF4 00381D54 38 60 00 01 */ li r3, 1
/* 80384DF8 00381D58 90 1D 02 E0 */ stw r0, 0x2e0(r29)
/* 80384DFC 00381D5C 80 9D 02 DC */ lwz r4, 0x2dc(r29)
/* 80384E00 00381D60 93 A4 00 04 */ stw r29, 4(r4)
/* 80384E04 00381D64 80 1D 02 D0 */ lwz r0, 0x2d0(r29)
/* 80384E08 00381D68 80 8D AD 60 */ lwz r4, RunQueueBits@sda21(r13)
/* 80384E0C 00381D6C 20 00 00 1F */ subfic r0, r0, 0x1f
/* 80384E10 00381D70 7C 60 00 30 */ slw r0, r3, r0
/* 80384E14 00381D74 7C 80 03 78 */ or r0, r4, r0
/* 80384E18 00381D78 90 0D AD 60 */ stw r0, RunQueueBits@sda21(r13)
/* 80384E1C 00381D7C 90 6D AD 64 */ stw r3, RunQueueHint@sda21(r13)
/* 80384E20 00381D80 48 00 01 40 */ b lbl_80384F60
lbl_80384E24:
/* 80384E24 00381D84 80 9D 02 E0 */ lwz r4, 0x2e0(r29)
/* 80384E28 00381D88 80 BD 02 E4 */ lwz r5, 0x2e4(r29)
/* 80384E2C 00381D8C 28 04 00 00 */ cmplwi r4, 0
/* 80384E30 00381D90 40 82 00 10 */ bne lbl_80384E40
/* 80384E34 00381D94 80 7D 02 DC */ lwz r3, 0x2dc(r29)
/* 80384E38 00381D98 90 A3 00 04 */ stw r5, 4(r3)
/* 80384E3C 00381D9C 48 00 00 08 */ b lbl_80384E44
lbl_80384E40:
/* 80384E40 00381DA0 90 A4 02 E4 */ stw r5, 0x2e4(r4)
lbl_80384E44:
/* 80384E44 00381DA4 28 05 00 00 */ cmplwi r5, 0
/* 80384E48 00381DA8 40 82 00 10 */ bne lbl_80384E58
/* 80384E4C 00381DAC 80 7D 02 DC */ lwz r3, 0x2dc(r29)
/* 80384E50 00381DB0 90 83 00 00 */ stw r4, 0(r3)
/* 80384E54 00381DB4 48 00 00 08 */ b lbl_80384E5C
lbl_80384E58:
/* 80384E58 00381DB8 90 85 02 E0 */ stw r4, 0x2e0(r5)
lbl_80384E5C:
/* 80384E5C 00381DBC 80 1D 02 D4 */ lwz r0, 0x2d4(r29)
/* 80384E60 00381DC0 80 7D 02 F4 */ lwz r3, 0x2f4(r29)
/* 80384E64 00381DC4 48 00 00 24 */ b lbl_80384E88
lbl_80384E68:
/* 80384E68 00381DC8 80 83 00 00 */ lwz r4, 0(r3)
/* 80384E6C 00381DCC 28 04 00 00 */ cmplwi r4, 0
/* 80384E70 00381DD0 41 82 00 14 */ beq lbl_80384E84
/* 80384E74 00381DD4 80 84 02 D0 */ lwz r4, 0x2d0(r4)
/* 80384E78 00381DD8 7C 04 00 00 */ cmpw r4, r0
/* 80384E7C 00381DDC 40 80 00 08 */ bge lbl_80384E84
/* 80384E80 00381DE0 7C 80 23 78 */ mr r0, r4
lbl_80384E84:
/* 80384E84 00381DE4 80 63 00 10 */ lwz r3, 0x10(r3)
lbl_80384E88:
/* 80384E88 00381DE8 28 03 00 00 */ cmplwi r3, 0
/* 80384E8C 00381DEC 40 82 FF DC */ bne lbl_80384E68
/* 80384E90 00381DF0 90 1D 02 D0 */ stw r0, 0x2d0(r29)
/* 80384E94 00381DF4 80 9D 02 DC */ lwz r4, 0x2dc(r29)
/* 80384E98 00381DF8 80 A4 00 00 */ lwz r5, 0(r4)
/* 80384E9C 00381DFC 48 00 00 08 */ b lbl_80384EA4
lbl_80384EA0:
/* 80384EA0 00381E00 80 A5 02 E0 */ lwz r5, 0x2e0(r5)
lbl_80384EA4:
/* 80384EA4 00381E04 28 05 00 00 */ cmplwi r5, 0
/* 80384EA8 00381E08 41 82 00 14 */ beq lbl_80384EBC
/* 80384EAC 00381E0C 80 65 02 D0 */ lwz r3, 0x2d0(r5)
/* 80384EB0 00381E10 80 1D 02 D0 */ lwz r0, 0x2d0(r29)
/* 80384EB4 00381E14 7C 03 00 00 */ cmpw r3, r0
/* 80384EB8 00381E18 40 81 FF E8 */ ble lbl_80384EA0
lbl_80384EBC:
/* 80384EBC 00381E1C 28 05 00 00 */ cmplwi r5, 0
/* 80384EC0 00381E20 40 82 00 34 */ bne lbl_80384EF4
/* 80384EC4 00381E24 80 64 00 04 */ lwz r3, 4(r4)
/* 80384EC8 00381E28 28 03 00 00 */ cmplwi r3, 0
/* 80384ECC 00381E2C 40 82 00 0C */ bne lbl_80384ED8
/* 80384ED0 00381E30 93 A4 00 00 */ stw r29, 0(r4)
/* 80384ED4 00381E34 48 00 00 08 */ b lbl_80384EDC
lbl_80384ED8:
/* 80384ED8 00381E38 93 A3 02 E0 */ stw r29, 0x2e0(r3)
lbl_80384EDC:
/* 80384EDC 00381E3C 90 7D 02 E4 */ stw r3, 0x2e4(r29)
/* 80384EE0 00381E40 38 00 00 00 */ li r0, 0
/* 80384EE4 00381E44 90 1D 02 E0 */ stw r0, 0x2e0(r29)
/* 80384EE8 00381E48 80 7D 02 DC */ lwz r3, 0x2dc(r29)
/* 80384EEC 00381E4C 93 A3 00 04 */ stw r29, 4(r3)
/* 80384EF0 00381E50 48 00 00 2C */ b lbl_80384F1C
lbl_80384EF4:
/* 80384EF4 00381E54 90 BD 02 E0 */ stw r5, 0x2e0(r29)
/* 80384EF8 00381E58 80 65 02 E4 */ lwz r3, 0x2e4(r5)
/* 80384EFC 00381E5C 93 A5 02 E4 */ stw r29, 0x2e4(r5)
/* 80384F00 00381E60 28 03 00 00 */ cmplwi r3, 0
/* 80384F04 00381E64 90 7D 02 E4 */ stw r3, 0x2e4(r29)
/* 80384F08 00381E68 40 82 00 10 */ bne lbl_80384F18
/* 80384F0C 00381E6C 80 7D 02 DC */ lwz r3, 0x2dc(r29)
/* 80384F10 00381E70 93 A3 00 00 */ stw r29, 0(r3)
/* 80384F14 00381E74 48 00 00 08 */ b lbl_80384F1C
lbl_80384F18:
/* 80384F18 00381E78 93 A3 02 E0 */ stw r29, 0x2e0(r3)
lbl_80384F1C:
/* 80384F1C 00381E7C 80 7D 02 F0 */ lwz r3, 0x2f0(r29)
/* 80384F20 00381E80 28 03 00 00 */ cmplwi r3, 0
/* 80384F24 00381E84 41 82 00 3C */ beq lbl_80384F60
/* 80384F28 00381E88 83 A3 00 08 */ lwz r29, 8(r3)
lbl_80384F2C:
/* 80384F2C 00381E8C 80 1D 02 CC */ lwz r0, 0x2cc(r29)
/* 80384F30 00381E90 2C 00 00 00 */ cmpwi r0, 0
/* 80384F34 00381E94 41 81 00 2C */ bgt lbl_80384F60
/* 80384F38 00381E98 7F A3 EB 78 */ mr r3, r29
/* 80384F3C 00381E9C 4B FF F7 8D */ bl __OSGetEffectivePriority
/* 80384F40 00381EA0 80 1D 02 D0 */ lwz r0, 0x2d0(r29)
/* 80384F44 00381EA4 38 83 00 00 */ addi r4, r3, 0
/* 80384F48 00381EA8 7C 00 20 00 */ cmpw r0, r4
/* 80384F4C 00381EAC 41 82 00 14 */ beq lbl_80384F60
/* 80384F50 00381EB0 7F A3 EB 78 */ mr r3, r29
/* 80384F54 00381EB4 4B FF F7 B1 */ bl SetEffectivePriority
/* 80384F58 00381EB8 7C 7D 1B 79 */ or. r29, r3, r3
/* 80384F5C 00381EBC 40 82 FF D0 */ bne lbl_80384F2C
lbl_80384F60:
/* 80384F60 00381EC0 80 0D AD 64 */ lwz r0, RunQueueHint@sda21(r13)
/* 80384F64 00381EC4 2C 00 00 00 */ cmpwi r0, 0
/* 80384F68 00381EC8 41 82 00 0C */ beq lbl_80384F74
/* 80384F6C 00381ECC 38 60 00 00 */ li r3, 0
/* 80384F70 00381ED0 4B FF F9 55 */ bl SelectThread
lbl_80384F74:
/* 80384F74 00381ED4 7F E3 FB 78 */ mr r3, r31
/* 80384F78 00381ED8 4B FF C7 11 */ bl OSRestoreInterrupts
/* 80384F7C 00381EDC 7F C3 F3 78 */ mr r3, r30
/* 80384F80 00381EE0 80 01 00 2C */ lwz r0, 0x2c(r1)
/* 80384F84 00381EE4 83 E1 00 24 */ lwz r31, 0x24(r1)
/* 80384F88 00381EE8 83 C1 00 20 */ lwz r30, 0x20(r1)
/* 80384F8C 00381EEC 83 A1 00 1C */ lwz r29, 0x1c(r1)
/* 80384F90 00381EF0 38 21 00 28 */ addi r1, r1, 0x28
/* 80384F94 00381EF4 7C 08 03 A6 */ mtlr r0
/* 80384F98 00381EF8 4E 80 00 20 */ blr
.global OSSuspendThread
OSSuspendThread:
/* 80384F9C 00381EFC 7C 08 02 A6 */ mflr r0
/* 80384FA0 00381F00 90 01 00 04 */ stw r0, 4(r1)
/* 80384FA4 00381F04 94 21 FF E0 */ stwu r1, -0x20(r1)
/* 80384FA8 00381F08 93 E1 00 1C */ stw r31, 0x1c(r1)
/* 80384FAC 00381F0C 93 C1 00 18 */ stw r30, 0x18(r1)
/* 80384FB0 00381F10 93 A1 00 14 */ stw r29, 0x14(r1)
/* 80384FB4 00381F14 7C 7D 1B 78 */ mr r29, r3
/* 80384FB8 00381F18 4B FF C6 A9 */ bl OSDisableInterrupts
/* 80384FBC 00381F1C 80 9D 02 CC */ lwz r4, 0x2cc(r29)
/* 80384FC0 00381F20 3B E3 00 00 */ addi r31, r3, 0
/* 80384FC4 00381F24 38 04 00 01 */ addi r0, r4, 1
/* 80384FC8 00381F28 7C 9E 23 79 */ or. r30, r4, r4
/* 80384FCC 00381F2C 90 1D 02 CC */ stw r0, 0x2cc(r29)
/* 80384FD0 00381F30 40 82 01 14 */ bne lbl_803850E4
/* 80384FD4 00381F34 A0 1D 02 C8 */ lhz r0, 0x2c8(r29)
/* 80384FD8 00381F38 2C 00 00 03 */ cmpwi r0, 3
/* 80384FDC 00381F3C 41 82 00 F4 */ beq lbl_803850D0
/* 80384FE0 00381F40 40 80 00 14 */ bge lbl_80384FF4
/* 80384FE4 00381F44 2C 00 00 01 */ cmpwi r0, 1
/* 80384FE8 00381F48 41 82 00 28 */ beq lbl_80385010
/* 80384FEC 00381F4C 40 80 00 14 */ bge lbl_80385000
/* 80384FF0 00381F50 48 00 00 E0 */ b lbl_803850D0
lbl_80384FF4:
/* 80384FF4 00381F54 2C 00 00 05 */ cmpwi r0, 5
/* 80384FF8 00381F58 40 80 00 D8 */ bge lbl_803850D0
/* 80384FFC 00381F5C 48 00 00 20 */ b lbl_8038501C
lbl_80385000:
/* 80385000 00381F60 38 00 00 01 */ li r0, 1
/* 80385004 00381F64 90 0D AD 64 */ stw r0, RunQueueHint@sda21(r13)
/* 80385008 00381F68 B0 1D 02 C8 */ sth r0, 0x2c8(r29)
/* 8038500C 00381F6C 48 00 00 C4 */ b lbl_803850D0
lbl_80385010:
/* 80385010 00381F70 7F A3 EB 78 */ mr r3, r29
/* 80385014 00381F74 4B FF F6 4D */ bl UnsetRun
/* 80385018 00381F78 48 00 00 B8 */ b lbl_803850D0
lbl_8038501C:
/* 8038501C 00381F7C 80 9D 02 E0 */ lwz r4, 0x2e0(r29)
/* 80385020 00381F80 80 BD 02 E4 */ lwz r5, 0x2e4(r29)
/* 80385024 00381F84 28 04 00 00 */ cmplwi r4, 0
/* 80385028 00381F88 40 82 00 10 */ bne lbl_80385038
/* 8038502C 00381F8C 80 7D 02 DC */ lwz r3, 0x2dc(r29)
/* 80385030 00381F90 90 A3 00 04 */ stw r5, 4(r3)
/* 80385034 00381F94 48 00 00 08 */ b lbl_8038503C
lbl_80385038:
/* 80385038 00381F98 90 A4 02 E4 */ stw r5, 0x2e4(r4)
lbl_8038503C:
/* 8038503C 00381F9C 28 05 00 00 */ cmplwi r5, 0
/* 80385040 00381FA0 40 82 00 10 */ bne lbl_80385050
/* 80385044 00381FA4 80 7D 02 DC */ lwz r3, 0x2dc(r29)
/* 80385048 00381FA8 90 83 00 00 */ stw r4, 0(r3)
/* 8038504C 00381FAC 48 00 00 08 */ b lbl_80385054
lbl_80385050:
/* 80385050 00381FB0 90 85 02 E0 */ stw r4, 0x2e0(r5)
lbl_80385054:
/* 80385054 00381FB4 38 00 00 20 */ li r0, 0x20
/* 80385058 00381FB8 90 1D 02 D0 */ stw r0, 0x2d0(r29)
/* 8038505C 00381FBC 80 9D 02 DC */ lwz r4, 0x2dc(r29)
/* 80385060 00381FC0 80 64 00 04 */ lwz r3, 4(r4)
/* 80385064 00381FC4 28 03 00 00 */ cmplwi r3, 0
/* 80385068 00381FC8 40 82 00 0C */ bne lbl_80385074
/* 8038506C 00381FCC 93 A4 00 00 */ stw r29, 0(r4)
/* 80385070 00381FD0 48 00 00 08 */ b lbl_80385078
lbl_80385074:
/* 80385074 00381FD4 93 A3 02 E0 */ stw r29, 0x2e0(r3)
lbl_80385078:
/* 80385078 00381FD8 90 7D 02 E4 */ stw r3, 0x2e4(r29)
/* 8038507C 00381FDC 38 00 00 00 */ li r0, 0
/* 80385080 00381FE0 90 1D 02 E0 */ stw r0, 0x2e0(r29)
/* 80385084 00381FE4 80 7D 02 DC */ lwz r3, 0x2dc(r29)
/* 80385088 00381FE8 93 A3 00 04 */ stw r29, 4(r3)
/* 8038508C 00381FEC 80 7D 02 F0 */ lwz r3, 0x2f0(r29)
/* 80385090 00381FF0 28 03 00 00 */ cmplwi r3, 0
/* 80385094 00381FF4 41 82 00 3C */ beq lbl_803850D0
/* 80385098 00381FF8 83 A3 00 08 */ lwz r29, 8(r3)
lbl_8038509C:
/* 8038509C 00381FFC 80 1D 02 CC */ lwz r0, 0x2cc(r29)
/* 803850A0 00382000 2C 00 00 00 */ cmpwi r0, 0
/* 803850A4 00382004 41 81 00 2C */ bgt lbl_803850D0
/* 803850A8 00382008 7F A3 EB 78 */ mr r3, r29
/* 803850AC 0038200C 4B FF F6 1D */ bl __OSGetEffectivePriority
/* 803850B0 00382010 80 1D 02 D0 */ lwz r0, 0x2d0(r29)
/* 803850B4 00382014 38 83 00 00 */ addi r4, r3, 0
/* 803850B8 00382018 7C 00 20 00 */ cmpw r0, r4
/* 803850BC 0038201C 41 82 00 14 */ beq lbl_803850D0
/* 803850C0 00382020 7F A3 EB 78 */ mr r3, r29
/* 803850C4 00382024 4B FF F6 41 */ bl SetEffectivePriority
/* 803850C8 00382028 7C 7D 1B 79 */ or. r29, r3, r3
/* 803850CC 0038202C 40 82 FF D0 */ bne lbl_8038509C
lbl_803850D0:
/* 803850D0 00382030 80 0D AD 64 */ lwz r0, RunQueueHint@sda21(r13)
/* 803850D4 00382034 2C 00 00 00 */ cmpwi r0, 0
/* 803850D8 00382038 41 82 00 0C */ beq lbl_803850E4
/* 803850DC 0038203C 38 60 00 00 */ li r3, 0
/* 803850E0 00382040 4B FF F7 E5 */ bl SelectThread
lbl_803850E4:
/* 803850E4 00382044 7F E3 FB 78 */ mr r3, r31
/* 803850E8 00382048 4B FF C5 A1 */ bl OSRestoreInterrupts
/* 803850EC 0038204C 7F C3 F3 78 */ mr r3, r30
/* 803850F0 00382050 80 01 00 24 */ lwz r0, 0x24(r1)
/* 803850F4 00382054 83 E1 00 1C */ lwz r31, 0x1c(r1)
/* 803850F8 00382058 83 C1 00 18 */ lwz r30, 0x18(r1)
/* 803850FC 0038205C 83 A1 00 14 */ lwz r29, 0x14(r1)
/* 80385100 00382060 38 21 00 20 */ addi r1, r1, 0x20
/* 80385104 00382064 7C 08 03 A6 */ mtlr r0
/* 80385108 00382068 4E 80 00 20 */ blr
.global OSSleepThread
OSSleepThread:
/* 8038510C 0038206C 7C 08 02 A6 */ mflr r0
/* 80385110 00382070 90 01 00 04 */ stw r0, 4(r1)
/* 80385114 00382074 94 21 FF E8 */ stwu r1, -0x18(r1)
/* 80385118 00382078 93 E1 00 14 */ stw r31, 0x14(r1)
/* 8038511C 0038207C 93 C1 00 10 */ stw r30, 0x10(r1)
/* 80385120 00382080 7C 7E 1B 78 */ mr r30, r3
/* 80385124 00382084 4B FF C5 3D */ bl OSDisableInterrupts
/* 80385128 00382088 3C 80 80 00 */ lis r4, 0x800000E4@ha
/* 8038512C 0038208C 80 84 00 E4 */ lwz r4, 0x800000E4@l(r4)
/* 80385130 00382090 38 00 00 04 */ li r0, 4
/* 80385134 00382094 7C 7F 1B 78 */ mr r31, r3
/* 80385138 00382098 B0 04 02 C8 */ sth r0, 0x2c8(r4)
/* 8038513C 0038209C 93 C4 02 DC */ stw r30, 0x2dc(r4)
/* 80385140 003820A0 80 BE 00 00 */ lwz r5, 0(r30)
/* 80385144 003820A4 48 00 00 08 */ b lbl_8038514C
lbl_80385148:
/* 80385148 003820A8 80 A5 02 E0 */ lwz r5, 0x2e0(r5)
lbl_8038514C:
/* 8038514C 003820AC 28 05 00 00 */ cmplwi r5, 0
/* 80385150 003820B0 41 82 00 14 */ beq lbl_80385164
/* 80385154 003820B4 80 65 02 D0 */ lwz r3, 0x2d0(r5)
/* 80385158 003820B8 80 04 02 D0 */ lwz r0, 0x2d0(r4)
/* 8038515C 003820BC 7C 03 00 00 */ cmpw r3, r0
/* 80385160 003820C0 40 81 FF E8 */ ble lbl_80385148
lbl_80385164:
/* 80385164 003820C4 28 05 00 00 */ cmplwi r5, 0
/* 80385168 003820C8 40 82 00 30 */ bne lbl_80385198
/* 8038516C 003820CC 80 7E 00 04 */ lwz r3, 4(r30)
/* 80385170 003820D0 28 03 00 00 */ cmplwi r3, 0
/* 80385174 003820D4 40 82 00 0C */ bne lbl_80385180
/* 80385178 003820D8 90 9E 00 00 */ stw r4, 0(r30)
/* 8038517C 003820DC 48 00 00 08 */ b lbl_80385184
lbl_80385180:
/* 80385180 003820E0 90 83 02 E0 */ stw r4, 0x2e0(r3)
lbl_80385184:
/* 80385184 003820E4 90 64 02 E4 */ stw r3, 0x2e4(r4)
/* 80385188 003820E8 38 00 00 00 */ li r0, 0
/* 8038518C 003820EC 90 04 02 E0 */ stw r0, 0x2e0(r4)
/* 80385190 003820F0 90 9E 00 04 */ stw r4, 4(r30)
/* 80385194 003820F4 48 00 00 28 */ b lbl_803851BC
lbl_80385198:
/* 80385198 003820F8 90 A4 02 E0 */ stw r5, 0x2e0(r4)
/* 8038519C 003820FC 80 65 02 E4 */ lwz r3, 0x2e4(r5)
/* 803851A0 00382100 90 85 02 E4 */ stw r4, 0x2e4(r5)
/* 803851A4 00382104 28 03 00 00 */ cmplwi r3, 0
/* 803851A8 00382108 90 64 02 E4 */ stw r3, 0x2e4(r4)
/* 803851AC 0038210C 40 82 00 0C */ bne lbl_803851B8
/* 803851B0 00382110 90 9E 00 00 */ stw r4, 0(r30)
/* 803851B4 00382114 48 00 00 08 */ b lbl_803851BC
lbl_803851B8:
/* 803851B8 00382118 90 83 02 E0 */ stw r4, 0x2e0(r3)
lbl_803851BC:
/* 803851BC 0038211C 38 00 00 01 */ li r0, 1
/* 803851C0 00382120 90 0D AD 64 */ stw r0, RunQueueHint@sda21(r13)
/* 803851C4 00382124 80 0D AD 64 */ lwz r0, RunQueueHint@sda21(r13)
/* 803851C8 00382128 2C 00 00 00 */ cmpwi r0, 0
/* 803851CC 0038212C 41 82 00 0C */ beq lbl_803851D8
/* 803851D0 00382130 38 60 00 00 */ li r3, 0
/* 803851D4 00382134 4B FF F6 F1 */ bl SelectThread
lbl_803851D8:
/* 803851D8 00382138 7F E3 FB 78 */ mr r3, r31
/* 803851DC 0038213C 4B FF C4 AD */ bl OSRestoreInterrupts
/* 803851E0 00382140 80 01 00 1C */ lwz r0, 0x1c(r1)
/* 803851E4 00382144 83 E1 00 14 */ lwz r31, 0x14(r1)
/* 803851E8 00382148 83 C1 00 10 */ lwz r30, 0x10(r1)
/* 803851EC 0038214C 38 21 00 18 */ addi r1, r1, 0x18
/* 803851F0 00382150 7C 08 03 A6 */ mtlr r0
/* 803851F4 00382154 4E 80 00 20 */ blr
.global OSWakeupThread
OSWakeupThread:
/* 803851F8 00382158 7C 08 02 A6 */ mflr r0
/* 803851FC 0038215C 90 01 00 04 */ stw r0, 4(r1)
/* 80385200 00382160 94 21 FF E8 */ stwu r1, -0x18(r1)
/* 80385204 00382164 93 E1 00 14 */ stw r31, 0x14(r1)
/* 80385208 00382168 93 C1 00 10 */ stw r30, 0x10(r1)
/* 8038520C 0038216C 7C 7E 1B 78 */ mr r30, r3
/* 80385210 00382170 4B FF C4 51 */ bl OSDisableInterrupts
/* 80385214 00382174 3C 80 80 54 */ lis r4, RunQueue@ha
/* 80385218 00382178 3B E3 00 00 */ addi r31, r3, 0
/* 8038521C 0038217C 38 A4 15 F8 */ addi r5, r4, RunQueue@l
/* 80385220 00382180 48 00 00 9C */ b lbl_803852BC
lbl_80385224:
/* 80385224 00382184 80 66 02 E0 */ lwz r3, 0x2e0(r6)
/* 80385228 00382188 28 03 00 00 */ cmplwi r3, 0
/* 8038522C 0038218C 40 82 00 10 */ bne lbl_8038523C
/* 80385230 00382190 38 00 00 00 */ li r0, 0
/* 80385234 00382194 90 1E 00 04 */ stw r0, 4(r30)
/* 80385238 00382198 48 00 00 0C */ b lbl_80385244
lbl_8038523C:
/* 8038523C 0038219C 38 00 00 00 */ li r0, 0
/* 80385240 003821A0 90 03 02 E4 */ stw r0, 0x2e4(r3)
lbl_80385244:
/* 80385244 003821A4 90 7E 00 00 */ stw r3, 0(r30)
/* 80385248 003821A8 38 00 00 01 */ li r0, 1
/* 8038524C 003821AC B0 06 02 C8 */ sth r0, 0x2c8(r6)
/* 80385250 003821B0 80 06 02 CC */ lwz r0, 0x2cc(r6)
/* 80385254 003821B4 2C 00 00 00 */ cmpwi r0, 0
/* 80385258 003821B8 41 81 00 64 */ bgt lbl_803852BC
/* 8038525C 003821BC 80 06 02 D0 */ lwz r0, 0x2d0(r6)
/* 80385260 003821C0 54 00 18 38 */ slwi r0, r0, 3
/* 80385264 003821C4 7C 05 02 14 */ add r0, r5, r0
/* 80385268 003821C8 90 06 02 DC */ stw r0, 0x2dc(r6)
/* 8038526C 003821CC 80 86 02 DC */ lwz r4, 0x2dc(r6)
/* 80385270 003821D0 80 64 00 04 */ lwz r3, 4(r4)
/* 80385274 003821D4 28 03 00 00 */ cmplwi r3, 0
/* 80385278 003821D8 40 82 00 0C */ bne lbl_80385284
/* 8038527C 003821DC 90 C4 00 00 */ stw r6, 0(r4)
/* 80385280 003821E0 48 00 00 08 */ b lbl_80385288
lbl_80385284:
/* 80385284 003821E4 90 C3 02 E0 */ stw r6, 0x2e0(r3)
lbl_80385288:
/* 80385288 003821E8 90 66 02 E4 */ stw r3, 0x2e4(r6)
/* 8038528C 003821EC 38 00 00 00 */ li r0, 0
/* 80385290 003821F0 38 60 00 01 */ li r3, 1
/* 80385294 003821F4 90 06 02 E0 */ stw r0, 0x2e0(r6)
/* 80385298 003821F8 80 86 02 DC */ lwz r4, 0x2dc(r6)
/* 8038529C 003821FC 90 C4 00 04 */ stw r6, 4(r4)
/* 803852A0 00382200 80 06 02 D0 */ lwz r0, 0x2d0(r6)
/* 803852A4 00382204 80 8D AD 60 */ lwz r4, RunQueueBits@sda21(r13)
/* 803852A8 00382208 20 00 00 1F */ subfic r0, r0, 0x1f
/* 803852AC 0038220C 7C 60 00 30 */ slw r0, r3, r0
/* 803852B0 00382210 7C 80 03 78 */ or r0, r4, r0
/* 803852B4 00382214 90 0D AD 60 */ stw r0, RunQueueBits@sda21(r13)
/* 803852B8 00382218 90 6D AD 64 */ stw r3, RunQueueHint@sda21(r13)
lbl_803852BC:
/* 803852BC 0038221C 80 DE 00 00 */ lwz r6, 0(r30)
/* 803852C0 00382220 28 06 00 00 */ cmplwi r6, 0
/* 803852C4 00382224 40 82 FF 60 */ bne lbl_80385224
/* 803852C8 00382228 80 0D AD 64 */ lwz r0, RunQueueHint@sda21(r13)
/* 803852CC 0038222C 2C 00 00 00 */ cmpwi r0, 0
/* 803852D0 00382230 41 82 00 0C */ beq lbl_803852DC
/* 803852D4 00382234 38 60 00 00 */ li r3, 0
/* 803852D8 00382238 4B FF F5 ED */ bl SelectThread
lbl_803852DC:
/* 803852DC 0038223C 7F E3 FB 78 */ mr r3, r31
/* 803852E0 00382240 4B FF C3 A9 */ bl OSRestoreInterrupts
/* 803852E4 00382244 80 01 00 1C */ lwz r0, 0x1c(r1)
/* 803852E8 00382248 83 E1 00 14 */ lwz r31, 0x14(r1)
/* 803852EC 0038224C 83 C1 00 10 */ lwz r30, 0x10(r1)
/* 803852F0 00382250 38 21 00 18 */ addi r1, r1, 0x18
/* 803852F4 00382254 7C 08 03 A6 */ mtlr r0
/* 803852F8 00382258 4E 80 00 20 */ blr
.global OSClearStack
OSClearStack:
/* 803852FC 0038225C 7C 08 02 A6 */ mflr r0
/* 80385300 00382260 90 01 00 04 */ stw r0, 4(r1)
/* 80385304 00382264 54 60 82 1E */ rlwinm r0, r3, 0x10, 8, 0xf
/* 80385308 00382268 50 60 C0 0E */ rlwimi r0, r3, 0x18, 0, 7
/* 8038530C 0038226C 94 21 FF E8 */ stwu r1, -0x18(r1)
/* 80385310 00382270 50 60 44 2E */ rlwimi r0, r3, 8, 0x10, 0x17
/* 80385314 00382274 93 E1 00 14 */ stw r31, 0x14(r1)
/* 80385318 00382278 7C 1F 03 78 */ mr r31, r0
/* 8038531C 0038227C 50 7F 06 3E */ rlwimi r31, r3, 0, 0x18, 0x1f
/* 80385320 00382280 4B FF A2 BD */ bl OSGetStackPointer
/* 80385324 00382284 3C 80 80 00 */ lis r4, 0x800000E4@ha
/* 80385328 00382288 80 A4 00 E4 */ lwz r5, 0x800000E4@l(r4)
/* 8038532C 0038228C 38 83 00 03 */ addi r4, r3, 3
/* 80385330 00382290 80 A5 03 08 */ lwz r5, 0x308(r5)
/* 80385334 00382294 38 A5 00 04 */ addi r5, r5, 4
/* 80385338 00382298 7C 05 18 40 */ cmplw r5, r3
/* 8038533C 0038229C 7C 85 20 50 */ subf r4, r5, r4
/* 80385340 003822A0 54 84 F0 BE */ srwi r4, r4, 2
/* 80385344 003822A4 40 80 00 50 */ bge lbl_80385394
/* 80385348 003822A8 54 80 E8 FF */ rlwinm. r0, r4, 0x1d, 3, 0x1f
/* 8038534C 003822AC 7C 09 03 A6 */ mtctr r0
/* 80385350 003822B0 41 82 00 34 */ beq lbl_80385384
lbl_80385354:
/* 80385354 003822B4 93 E5 00 00 */ stw r31, 0(r5)
/* 80385358 003822B8 93 E5 00 04 */ stw r31, 4(r5)
/* 8038535C 003822BC 93 E5 00 08 */ stw r31, 8(r5)
/* 80385360 003822C0 93 E5 00 0C */ stw r31, 0xc(r5)
/* 80385364 003822C4 93 E5 00 10 */ stw r31, 0x10(r5)
/* 80385368 003822C8 93 E5 00 14 */ stw r31, 0x14(r5)
/* 8038536C 003822CC 93 E5 00 18 */ stw r31, 0x18(r5)
/* 80385370 003822D0 93 E5 00 1C */ stw r31, 0x1c(r5)
/* 80385374 003822D4 38 A5 00 20 */ addi r5, r5, 0x20
/* 80385378 003822D8 42 00 FF DC */ bdnz lbl_80385354
/* 8038537C 003822DC 70 84 00 07 */ andi. r4, r4, 7
/* 80385380 003822E0 41 82 00 14 */ beq lbl_80385394
lbl_80385384:
/* 80385384 003822E4 7C 89 03 A6 */ mtctr r4
lbl_80385388:
/* 80385388 003822E8 93 E5 00 00 */ stw r31, 0(r5)
/* 8038538C 003822EC 38 A5 00 04 */ addi r5, r5, 4
/* 80385390 003822F0 42 00 FF F8 */ bdnz lbl_80385388
lbl_80385394:
/* 80385394 003822F4 80 01 00 1C */ lwz r0, 0x1c(r1)
/* 80385398 003822F8 83 E1 00 14 */ lwz r31, 0x14(r1)
/* 8038539C 003822FC 38 21 00 18 */ addi r1, r1, 0x18
/* 803853A0 00382300 7C 08 03 A6 */ mtlr r0
/* 803853A4 00382304 4E 80 00 20 */ blr