.include "macros.inc" .section .data .balign 8 lbl_803F22E0: .4byte OnReset .4byte 0x7f .4byte 0 .4byte 0 .section .text, "ax" .fn OnReset, local /* 80382A14 0037F974 7C 08 02 A6 */ mflr r0 /* 80382A18 0037F978 2C 03 00 00 */ cmpwi r3, 0 /* 80382A1C 0037F97C 90 01 00 04 */ stw r0, 4(r1) /* 80382A20 0037F980 94 21 FF F8 */ stwu r1, -8(r1) /* 80382A24 0037F984 41 82 00 18 */ beq .L_80382A3C /* 80382A28 0037F988 3C 60 CC 00 */ lis r3, 0xCC004010@ha /* 80382A2C 0037F98C 38 00 00 FF */ li r0, 0xff /* 80382A30 0037F990 B0 03 40 10 */ sth r0, 0xCC004010@l(r3) /* 80382A34 0037F994 3C 60 F0 00 */ lis r3, 0xf000 /* 80382A38 0037F998 4B FF EF F1 */ bl __OSMaskInterrupts .L_80382A3C: /* 80382A3C 0037F99C 38 60 00 01 */ li r3, 1 /* 80382A40 0037F9A0 80 01 00 0C */ lwz r0, 0xc(r1) /* 80382A44 0037F9A4 38 21 00 08 */ addi r1, r1, 8 /* 80382A48 0037F9A8 7C 08 03 A6 */ mtlr r0 /* 80382A4C 0037F9AC 4E 80 00 20 */ blr .endfn OnReset .global MEMIntrruptHandler MEMIntrruptHandler: /* 80382A50 0037F9B0 7C 08 02 A6 */ mflr r0 /* 80382A54 0037F9B4 3C 60 CC 00 */ lis r3, 0xCC004000@ha /* 80382A58 0037F9B8 90 01 00 04 */ stw r0, 4(r1) /* 80382A5C 0037F9BC 39 03 40 00 */ addi r8, r3, 0xCC004000@l /* 80382A60 0037F9C0 38 00 00 00 */ li r0, 0 /* 80382A64 0037F9C4 94 21 FF F8 */ stwu r1, -8(r1) /* 80382A68 0037F9C8 A0 E3 40 24 */ lhz r7, 0x4024(r3) /* 80382A6C 0037F9CC 3C 60 80 54 */ lis r3, __OSErrorTable@ha /* 80382A70 0037F9D0 A0 C8 00 22 */ lhz r6, 0x22(r8) /* 80382A74 0037F9D4 38 63 12 50 */ addi r3, r3, __OSErrorTable@l /* 80382A78 0037F9D8 A0 A8 00 1E */ lhz r5, 0x1e(r8) /* 80382A7C 0037F9DC 50 E6 81 9E */ rlwimi r6, r7, 0x10, 6, 0xf /* 80382A80 0037F9E0 B0 08 00 20 */ sth r0, 0x20(r8) /* 80382A84 0037F9E4 81 83 00 3C */ lwz r12, 0x3c(r3) /* 80382A88 0037F9E8 28 0C 00 00 */ cmplwi r12, 0 /* 80382A8C 0037F9EC 41 82 00 18 */ beq lbl_80382AA4 /* 80382A90 0037F9F0 7D 88 03 A6 */ mtlr r12 /* 80382A94 0037F9F4 38 60 00 0F */ li r3, 0xf /* 80382A98 0037F9F8 4C C6 31 82 */ crclr 6 /* 80382A9C 0037F9FC 4E 80 00 21 */ blrl /* 80382AA0 0037FA00 48 00 00 0C */ b lbl_80382AAC lbl_80382AA4: /* 80382AA4 0037FA04 38 60 00 0F */ li r3, 0xf /* 80382AA8 0037FA08 4B FF D2 C9 */ bl __OSUnhandledException lbl_80382AAC: /* 80382AAC 0037FA0C 80 01 00 0C */ lwz r0, 0xc(r1) /* 80382AB0 0037FA10 38 21 00 08 */ addi r1, r1, 8 /* 80382AB4 0037FA14 7C 08 03 A6 */ mtlr r0 /* 80382AB8 0037FA18 4E 80 00 20 */ blr .global OSProtectRange OSProtectRange: /* 80382ABC 0037FA1C 7C 08 02 A6 */ mflr r0 /* 80382AC0 0037FA20 90 01 00 04 */ stw r0, 4(r1) /* 80382AC4 0037FA24 94 21 FF D0 */ stwu r1, -0x30(r1) /* 80382AC8 0037FA28 BF 41 00 18 */ stmw r26, 0x18(r1) /* 80382ACC 0037FA2C 3B 43 00 00 */ addi r26, r3, 0 /* 80382AD0 0037FA30 28 1A 00 04 */ cmplwi r26, 4 /* 80382AD4 0037FA34 40 80 00 98 */ bge lbl_80382B6C /* 80382AD8 0037FA38 7C 64 2A 14 */ add r3, r4, r5 /* 80382ADC 0037FA3C 38 03 03 FF */ addi r0, r3, 0x3ff /* 80382AE0 0037FA40 54 9B 00 2A */ rlwinm r27, r4, 0, 0, 0x15 /* 80382AE4 0037FA44 54 1D 00 2A */ rlwinm r29, r0, 0, 0, 0x15 /* 80382AE8 0037FA48 38 7B 00 00 */ addi r3, r27, 0 /* 80382AEC 0037FA4C 54 DF 07 BE */ clrlwi r31, r6, 0x1e /* 80382AF0 0037FA50 7C 9B E8 50 */ subf r4, r27, r29 /* 80382AF4 0037FA54 4B FF BF BD */ bl DCFlushRange /* 80382AF8 0037FA58 4B FF EB 69 */ bl OSDisableInterrupts /* 80382AFC 0037FA5C 3C 00 80 00 */ lis r0, 0x8000 /* 80382B00 0037FA60 7C 1E D4 30 */ srw r30, r0, r26 /* 80382B04 0037FA64 3B 83 00 00 */ addi r28, r3, 0 /* 80382B08 0037FA68 38 7E 00 00 */ addi r3, r30, 0 /* 80382B0C 0037FA6C 4B FF EF 1D */ bl __OSMaskInterrupts /* 80382B10 0037FA70 3C 60 CC 00 */ lis r3, 0xCC004000@ha /* 80382B14 0037FA74 38 A3 40 00 */ addi r5, r3, 0xCC004000@l /* 80382B18 0037FA78 57 43 10 3A */ slwi r3, r26, 2 /* 80382B1C 0037FA7C 57 60 B4 3E */ rlwinm r0, r27, 0x16, 0x10, 0x1f /* 80382B20 0037FA80 7C 05 1B 2E */ sthx r0, r5, r3 /* 80382B24 0037FA84 57 A4 B4 3E */ rlwinm r4, r29, 0x16, 0x10, 0x1f /* 80382B28 0037FA88 7C 65 1A 14 */ add r3, r5, r3 /* 80382B2C 0037FA8C B0 83 00 02 */ sth r4, 2(r3) /* 80382B30 0037FA90 38 85 00 10 */ addi r4, r5, 0x10 /* 80382B34 0037FA94 57 46 08 3C */ slwi r6, r26, 1 /* 80382B38 0037FA98 38 00 00 03 */ li r0, 3 /* 80382B3C 0037FA9C A0 A5 00 10 */ lhz r5, 0x10(r5) /* 80382B40 0037FAA0 7C 03 30 30 */ slw r3, r0, r6 /* 80382B44 0037FAA4 7F E0 30 30 */ slw r0, r31, r6 /* 80382B48 0037FAA8 7C A5 18 78 */ andc r5, r5, r3 /* 80382B4C 0037FAAC 7C A5 03 78 */ or r5, r5, r0 /* 80382B50 0037FAB0 28 1F 00 03 */ cmplwi r31, 3 /* 80382B54 0037FAB4 B0 A4 00 00 */ sth r5, 0(r4) /* 80382B58 0037FAB8 41 82 00 0C */ beq lbl_80382B64 /* 80382B5C 0037FABC 7F C3 F3 78 */ mr r3, r30 /* 80382B60 0037FAC0 4B FF EF 51 */ bl __OSUnmaskInterrupts lbl_80382B64: /* 80382B64 0037FAC4 7F 83 E3 78 */ mr r3, r28 /* 80382B68 0037FAC8 4B FF EB 21 */ bl OSRestoreInterrupts lbl_80382B6C: /* 80382B6C 0037FACC BB 41 00 18 */ lmw r26, 0x18(r1) /* 80382B70 0037FAD0 80 01 00 34 */ lwz r0, 0x34(r1) /* 80382B74 0037FAD4 38 21 00 30 */ addi r1, r1, 0x30 /* 80382B78 0037FAD8 7C 08 03 A6 */ mtlr r0 /* 80382B7C 0037FADC 4E 80 00 20 */ blr .global Config24MB Config24MB: /* 80382B80 0037FAE0 38 E0 00 00 */ li r7, 0 /* 80382B84 0037FAE4 3C 80 00 00 */ lis r4, 0x00000002@ha /* 80382B88 0037FAE8 38 84 00 02 */ addi r4, r4, 0x00000002@l /* 80382B8C 0037FAEC 3C 60 80 00 */ lis r3, 0x800001FF@ha /* 80382B90 0037FAF0 38 63 01 FF */ addi r3, r3, 0x800001FF@l /* 80382B94 0037FAF4 3C C0 01 00 */ lis r6, 0x01000002@ha /* 80382B98 0037FAF8 38 C6 00 02 */ addi r6, r6, 0x01000002@l /* 80382B9C 0037FAFC 3C A0 81 00 */ lis r5, 0x810000FF@ha /* 80382BA0 0037FB00 38 A5 00 FF */ addi r5, r5, 0x810000FF@l /* 80382BA4 0037FB04 4C 00 01 2C */ isync /* 80382BA8 0037FB08 7C F8 83 A6 */ mtspr 536, r7 /* 80382BAC 0037FB0C 7C 99 83 A6 */ mtspr 537, r4 /* 80382BB0 0037FB10 7C 78 83 A6 */ mtspr 536, r3 /* 80382BB4 0037FB14 4C 00 01 2C */ isync /* 80382BB8 0037FB18 7C F0 83 A6 */ mtspr 528, r7 /* 80382BBC 0037FB1C 7C 91 83 A6 */ mtspr 529, r4 /* 80382BC0 0037FB20 7C 70 83 A6 */ mtspr 528, r3 /* 80382BC4 0037FB24 4C 00 01 2C */ isync /* 80382BC8 0037FB28 7C FC 83 A6 */ mtspr 540, r7 /* 80382BCC 0037FB2C 7C DD 83 A6 */ mtspr 541, r6 /* 80382BD0 0037FB30 7C BC 83 A6 */ mtspr 540, r5 /* 80382BD4 0037FB34 4C 00 01 2C */ isync /* 80382BD8 0037FB38 7C F4 83 A6 */ mtspr 532, r7 /* 80382BDC 0037FB3C 7C D5 83 A6 */ mtspr 533, r6 /* 80382BE0 0037FB40 7C B4 83 A6 */ mtspr 532, r5 /* 80382BE4 0037FB44 4C 00 01 2C */ isync /* 80382BE8 0037FB48 7C 60 00 A6 */ mfmsr r3 /* 80382BEC 0037FB4C 60 63 00 30 */ ori r3, r3, 0x30 /* 80382BF0 0037FB50 7C 7B 03 A6 */ mtspr 0x1b, r3 /* 80382BF4 0037FB54 7C 68 02 A6 */ mflr r3 /* 80382BF8 0037FB58 7C 7A 03 A6 */ mtspr 0x1a, r3 /* 80382BFC 0037FB5C 4C 00 00 64 */ rfi .global Config48MB Config48MB: /* 80382C00 0037FB60 38 E0 00 00 */ li r7, 0 /* 80382C04 0037FB64 3C 80 00 00 */ lis r4, 0x00000002@ha /* 80382C08 0037FB68 38 84 00 02 */ addi r4, r4, 0x00000002@l /* 80382C0C 0037FB6C 3C 60 80 00 */ lis r3, 0x800003FF@ha /* 80382C10 0037FB70 38 63 03 FF */ addi r3, r3, 0x800003FF@l /* 80382C14 0037FB74 3C C0 02 00 */ lis r6, 0x02000002@ha /* 80382C18 0037FB78 38 C6 00 02 */ addi r6, r6, 0x02000002@l /* 80382C1C 0037FB7C 3C A0 82 00 */ lis r5, 0x820001FF@ha /* 80382C20 0037FB80 38 A5 01 FF */ addi r5, r5, 0x820001FF@l /* 80382C24 0037FB84 4C 00 01 2C */ isync /* 80382C28 0037FB88 7C F8 83 A6 */ mtspr 536, r7 /* 80382C2C 0037FB8C 7C 99 83 A6 */ mtspr 537, r4 /* 80382C30 0037FB90 7C 78 83 A6 */ mtspr 536, r3 /* 80382C34 0037FB94 4C 00 01 2C */ isync /* 80382C38 0037FB98 7C F0 83 A6 */ mtspr 528, r7 /* 80382C3C 0037FB9C 7C 91 83 A6 */ mtspr 529, r4 /* 80382C40 0037FBA0 7C 70 83 A6 */ mtspr 528, r3 /* 80382C44 0037FBA4 4C 00 01 2C */ isync /* 80382C48 0037FBA8 7C FC 83 A6 */ mtspr 540, r7 /* 80382C4C 0037FBAC 7C DD 83 A6 */ mtspr 541, r6 /* 80382C50 0037FBB0 7C BC 83 A6 */ mtspr 540, r5 /* 80382C54 0037FBB4 4C 00 01 2C */ isync /* 80382C58 0037FBB8 7C F4 83 A6 */ mtspr 532, r7 /* 80382C5C 0037FBBC 7C D5 83 A6 */ mtspr 533, r6 /* 80382C60 0037FBC0 7C B4 83 A6 */ mtspr 532, r5 /* 80382C64 0037FBC4 4C 00 01 2C */ isync /* 80382C68 0037FBC8 7C 60 00 A6 */ mfmsr r3 /* 80382C6C 0037FBCC 60 63 00 30 */ ori r3, r3, 0x30 /* 80382C70 0037FBD0 7C 7B 03 A6 */ mtspr 0x1b, r3 /* 80382C74 0037FBD4 7C 68 02 A6 */ mflr r3 /* 80382C78 0037FBD8 7C 7A 03 A6 */ mtspr 0x1a, r3 /* 80382C7C 0037FBDC 4C 00 00 64 */ rfi .global RealMode RealMode: /* 80382C80 0037FBE0 54 63 00 BE */ clrlwi r3, r3, 2 /* 80382C84 0037FBE4 7C 7A 03 A6 */ mtspr 0x1a, r3 /* 80382C88 0037FBE8 7C 60 00 A6 */ mfmsr r3 /* 80382C8C 0037FBEC 54 63 07 32 */ rlwinm r3, r3, 0, 0x1c, 0x19 /* 80382C90 0037FBF0 7C 7B 03 A6 */ mtspr 0x1b, r3 /* 80382C94 0037FBF4 4C 00 00 64 */ rfi .global __OSInitMemoryProtection __OSInitMemoryProtection: /* 80382C98 0037FBF8 7C 08 02 A6 */ mflr r0 /* 80382C9C 0037FBFC 90 01 00 04 */ stw r0, 4(r1) /* 80382CA0 0037FC00 94 21 FF B8 */ stwu r1, -0x48(r1) /* 80382CA4 0037FC04 93 E1 00 44 */ stw r31, 0x44(r1) /* 80382CA8 0037FC08 93 C1 00 40 */ stw r30, 0x40(r1) /* 80382CAC 0037FC0C 93 A1 00 3C */ stw r29, 0x3c(r1) /* 80382CB0 0037FC10 3C 60 80 00 */ lis r3, 0x800000F0@ha /* 80382CB4 0037FC14 83 A3 00 F0 */ lwz r29, 0x800000F0@l(r3) /* 80382CB8 0037FC18 4B FF E9 A9 */ bl OSDisableInterrupts /* 80382CBC 0037FC1C 3C 00 01 80 */ lis r0, 0x180 /* 80382CC0 0037FC20 7C 1D 00 40 */ cmplw r29, r0 /* 80382CC4 0037FC24 7C 7F 1B 78 */ mr r31, r3 /* 80382CC8 0037FC28 41 81 00 14 */ bgt lbl_80382CDC /* 80382CCC 0037FC2C 3C 60 80 38 */ lis r3, Config24MB@ha /* 80382CD0 0037FC30 38 63 2B 80 */ addi r3, r3, Config24MB@l /* 80382CD4 0037FC34 4B FF FF AD */ bl RealMode /* 80382CD8 0037FC38 48 00 00 1C */ b lbl_80382CF4 lbl_80382CDC: /* 80382CDC 0037FC3C 3C 00 03 00 */ lis r0, 0x300 /* 80382CE0 0037FC40 7C 1D 00 40 */ cmplw r29, r0 /* 80382CE4 0037FC44 41 81 00 10 */ bgt lbl_80382CF4 /* 80382CE8 0037FC48 3C 60 80 38 */ lis r3, Config48MB@ha /* 80382CEC 0037FC4C 38 63 2C 00 */ addi r3, r3, Config48MB@l /* 80382CF0 0037FC50 4B FF FF 91 */ bl RealMode lbl_80382CF4: /* 80382CF4 0037FC54 3C 60 CC 00 */ lis r3, 0xCC004000@ha /* 80382CF8 0037FC58 3B A3 40 00 */ addi r29, r3, 0xCC004000@l /* 80382CFC 0037FC5C 38 00 00 00 */ li r0, 0 /* 80382D00 0037FC60 B0 1D 00 20 */ sth r0, 0x20(r29) /* 80382D04 0037FC64 38 00 00 FF */ li r0, 0xff /* 80382D08 0037FC68 3C 60 F0 00 */ lis r3, 0xf000 /* 80382D0C 0037FC6C B0 1D 00 10 */ sth r0, 0x10(r29) /* 80382D10 0037FC70 4B FF ED 19 */ bl __OSMaskInterrupts /* 80382D14 0037FC74 3C 60 80 38 */ lis r3, MEMIntrruptHandler@ha /* 80382D18 0037FC78 3B C3 2A 50 */ addi r30, r3, MEMIntrruptHandler@l /* 80382D1C 0037FC7C 7F C4 F3 78 */ mr r4, r30 /* 80382D20 0037FC80 38 60 00 00 */ li r3, 0 /* 80382D24 0037FC84 4B FF E9 89 */ bl __OSSetInterruptHandler /* 80382D28 0037FC88 7F C4 F3 78 */ mr r4, r30 /* 80382D2C 0037FC8C 38 60 00 01 */ li r3, 1 /* 80382D30 0037FC90 4B FF E9 7D */ bl __OSSetInterruptHandler /* 80382D34 0037FC94 7F C4 F3 78 */ mr r4, r30 /* 80382D38 0037FC98 38 60 00 02 */ li r3, 2 /* 80382D3C 0037FC9C 4B FF E9 71 */ bl __OSSetInterruptHandler /* 80382D40 0037FCA0 7F C4 F3 78 */ mr r4, r30 /* 80382D44 0037FCA4 38 60 00 03 */ li r3, 3 /* 80382D48 0037FCA8 4B FF E9 65 */ bl __OSSetInterruptHandler /* 80382D4C 0037FCAC 7F C4 F3 78 */ mr r4, r30 /* 80382D50 0037FCB0 38 60 00 04 */ li r3, 4 /* 80382D54 0037FCB4 4B FF E9 59 */ bl __OSSetInterruptHandler /* 80382D58 0037FCB8 3C 60 80 3F */ lis r3, lbl_803F22E0@ha /* 80382D5C 0037FCBC 38 63 22 E0 */ addi r3, r3, lbl_803F22E0@l /* 80382D60 0037FCC0 48 00 02 CD */ bl OSRegisterResetFunction /* 80382D64 0037FCC4 3C 60 80 00 */ lis r3, 0x800000F0@ha /* 80382D68 0037FCC8 80 83 00 F0 */ lwz r4, 0x800000F0@l(r3) /* 80382D6C 0037FCCC 80 03 00 28 */ lwz r0, 0x28(r3) /* 80382D70 0037FCD0 7C 04 00 40 */ cmplw r4, r0 /* 80382D74 0037FCD4 40 80 00 18 */ bge lbl_80382D8C /* 80382D78 0037FCD8 3C 04 FE 80 */ addis r0, r4, 0xfe80 /* 80382D7C 0037FCDC 28 00 00 00 */ cmplwi r0, 0 /* 80382D80 0037FCE0 40 82 00 0C */ bne lbl_80382D8C /* 80382D84 0037FCE4 38 00 00 02 */ li r0, 2 /* 80382D88 0037FCE8 B0 1D 00 28 */ sth r0, 0x28(r29) lbl_80382D8C: /* 80382D8C 0037FCEC 3C 60 08 00 */ lis r3, 0x800 /* 80382D90 0037FCF0 4B FF ED 21 */ bl __OSUnmaskInterrupts /* 80382D94 0037FCF4 7F E3 FB 78 */ mr r3, r31 /* 80382D98 0037FCF8 4B FF E8 F1 */ bl OSRestoreInterrupts /* 80382D9C 0037FCFC 80 01 00 4C */ lwz r0, 0x4c(r1) /* 80382DA0 0037FD00 83 E1 00 44 */ lwz r31, 0x44(r1) /* 80382DA4 0037FD04 83 C1 00 40 */ lwz r30, 0x40(r1) /* 80382DA8 0037FD08 83 A1 00 3C */ lwz r29, 0x3c(r1) /* 80382DAC 0037FD0C 38 21 00 48 */ addi r1, r1, 0x48 /* 80382DB0 0037FD10 7C 08 03 A6 */ mtlr r0 /* 80382DB4 0037FD14 4E 80 00 20 */ blr