prime/asm/Dolphin/OS/OSMemory.s

419 lines
20 KiB
ArmAsm

.include "macros.inc"
.section .data
lbl_803F22E0:
.4byte OnReset
.4byte 0x7f
.4byte 0
.4byte 0
.section .text, "ax"
.global sub_80382810
sub_80382810:
/* 80382810 0037F770 7C 08 02 A6 */ mflr r0
/* 80382814 0037F774 90 01 00 04 */ stw r0, 4(r1)
/* 80382818 0037F778 94 21 FF D8 */ stwu r1, -0x28(r1)
/* 8038281C 0037F77C 93 E1 00 24 */ stw r31, 0x24(r1)
/* 80382820 0037F780 3B E5 00 00 */ addi r31, r5, 0
/* 80382824 0037F784 93 C1 00 20 */ stw r30, 0x20(r1)
/* 80382828 0037F788 3B C4 00 00 */ addi r30, r4, 0
/* 8038282C 0037F78C 93 A1 00 1C */ stw r29, 0x1c(r1)
/* 80382830 0037F790 3B A3 00 00 */ addi r29, r3, 0
/* 80382834 0037F794 48 00 1D 91 */ bl OSInitThreadQueue
/* 80382838 0037F798 38 7D 00 08 */ addi r3, r29, 8
/* 8038283C 0037F79C 48 00 1D 89 */ bl OSInitThreadQueue
/* 80382840 0037F7A0 93 DD 00 10 */ stw r30, 0x10(r29)
/* 80382844 0037F7A4 38 00 00 00 */ li r0, 0
/* 80382848 0037F7A8 93 FD 00 14 */ stw r31, 0x14(r29)
/* 8038284C 0037F7AC 90 1D 00 18 */ stw r0, 0x18(r29)
/* 80382850 0037F7B0 90 1D 00 1C */ stw r0, 0x1c(r29)
/* 80382854 0037F7B4 80 01 00 2C */ lwz r0, 0x2c(r1)
/* 80382858 0037F7B8 83 E1 00 24 */ lwz r31, 0x24(r1)
/* 8038285C 0037F7BC 83 C1 00 20 */ lwz r30, 0x20(r1)
/* 80382860 0037F7C0 83 A1 00 1C */ lwz r29, 0x1c(r1)
/* 80382864 0037F7C4 38 21 00 28 */ addi r1, r1, 0x28
/* 80382868 0037F7C8 7C 08 03 A6 */ mtlr r0
/* 8038286C 0037F7CC 4E 80 00 20 */ blr
.global sub_80382870
sub_80382870:
/* 80382870 0037F7D0 7C 08 02 A6 */ mflr r0
/* 80382874 0037F7D4 90 01 00 04 */ stw r0, 4(r1)
/* 80382878 0037F7D8 94 21 FF D8 */ stwu r1, -0x28(r1)
/* 8038287C 0037F7DC 93 E1 00 24 */ stw r31, 0x24(r1)
/* 80382880 0037F7E0 3B E5 00 00 */ addi r31, r5, 0
/* 80382884 0037F7E4 93 C1 00 20 */ stw r30, 0x20(r1)
/* 80382888 0037F7E8 93 A1 00 1C */ stw r29, 0x1c(r1)
/* 8038288C 0037F7EC 3B A4 00 00 */ addi r29, r4, 0
/* 80382890 0037F7F0 93 81 00 18 */ stw r28, 0x18(r1)
/* 80382894 0037F7F4 3B 83 00 00 */ addi r28, r3, 0
/* 80382898 0037F7F8 4B FF ED C9 */ bl OSDisableInterrupts
/* 8038289C 0037F7FC 3B C3 00 00 */ addi r30, r3, 0
/* 803828A0 0037F800 57 FF 07 FE */ clrlwi r31, r31, 0x1f
/* 803828A4 0037F804 48 00 00 24 */ b lbl_803828C8
lbl_803828A8:
/* 803828A8 0037F808 2C 1F 00 00 */ cmpwi r31, 0
/* 803828AC 0037F80C 40 82 00 14 */ bne lbl_803828C0
/* 803828B0 0037F810 7F C3 F3 78 */ mr r3, r30
/* 803828B4 0037F814 4B FF ED D5 */ bl OSRestoreInterrupts
/* 803828B8 0037F818 38 60 00 00 */ li r3, 0
/* 803828BC 0037F81C 48 00 00 5C */ b lbl_80382918
lbl_803828C0:
/* 803828C0 0037F820 7F 83 E3 78 */ mr r3, r28
/* 803828C4 0037F824 48 00 28 49 */ bl OSSleepThread
lbl_803828C8:
/* 803828C8 0037F828 80 DC 00 14 */ lwz r6, 0x14(r28)
/* 803828CC 0037F82C 80 9C 00 1C */ lwz r4, 0x1c(r28)
/* 803828D0 0037F830 7C 06 20 00 */ cmpw r6, r4
/* 803828D4 0037F834 40 81 FF D4 */ ble lbl_803828A8
/* 803828D8 0037F838 80 1C 00 18 */ lwz r0, 0x18(r28)
/* 803828DC 0037F83C 38 7C 00 08 */ addi r3, r28, 8
/* 803828E0 0037F840 80 BC 00 10 */ lwz r5, 0x10(r28)
/* 803828E4 0037F844 7C 80 22 14 */ add r4, r0, r4
/* 803828E8 0037F848 7C 04 33 D6 */ divw r0, r4, r6
/* 803828EC 0037F84C 7C 00 31 D6 */ mullw r0, r0, r6
/* 803828F0 0037F850 7C 00 20 50 */ subf r0, r0, r4
/* 803828F4 0037F854 54 00 10 3A */ slwi r0, r0, 2
/* 803828F8 0037F858 7F A5 01 2E */ stwx r29, r5, r0
/* 803828FC 0037F85C 80 9C 00 1C */ lwz r4, 0x1c(r28)
/* 80382900 0037F860 38 04 00 01 */ addi r0, r4, 1
/* 80382904 0037F864 90 1C 00 1C */ stw r0, 0x1c(r28)
/* 80382908 0037F868 48 00 28 F1 */ bl OSWakeupThread
/* 8038290C 0037F86C 7F C3 F3 78 */ mr r3, r30
/* 80382910 0037F870 4B FF ED 79 */ bl OSRestoreInterrupts
/* 80382914 0037F874 38 60 00 01 */ li r3, 1
lbl_80382918:
/* 80382918 0037F878 80 01 00 2C */ lwz r0, 0x2c(r1)
/* 8038291C 0037F87C 83 E1 00 24 */ lwz r31, 0x24(r1)
/* 80382920 0037F880 83 C1 00 20 */ lwz r30, 0x20(r1)
/* 80382924 0037F884 83 A1 00 1C */ lwz r29, 0x1c(r1)
/* 80382928 0037F888 83 81 00 18 */ lwz r28, 0x18(r1)
/* 8038292C 0037F88C 38 21 00 28 */ addi r1, r1, 0x28
/* 80382930 0037F890 7C 08 03 A6 */ mtlr r0
/* 80382934 0037F894 4E 80 00 20 */ blr
.global sub_80382938
sub_80382938:
/* 80382938 0037F898 7C 08 02 A6 */ mflr r0
/* 8038293C 0037F89C 90 01 00 04 */ stw r0, 4(r1)
/* 80382940 0037F8A0 94 21 FF D8 */ stwu r1, -0x28(r1)
/* 80382944 0037F8A4 93 E1 00 24 */ stw r31, 0x24(r1)
/* 80382948 0037F8A8 3B E3 00 00 */ addi r31, r3, 0
/* 8038294C 0037F8AC 93 C1 00 20 */ stw r30, 0x20(r1)
/* 80382950 0037F8B0 3B C5 00 00 */ addi r30, r5, 0
/* 80382954 0037F8B4 93 A1 00 1C */ stw r29, 0x1c(r1)
/* 80382958 0037F8B8 93 81 00 18 */ stw r28, 0x18(r1)
/* 8038295C 0037F8BC 3B 84 00 00 */ addi r28, r4, 0
/* 80382960 0037F8C0 4B FF ED 01 */ bl OSDisableInterrupts
/* 80382964 0037F8C4 3B A3 00 00 */ addi r29, r3, 0
/* 80382968 0037F8C8 57 DE 07 FE */ clrlwi r30, r30, 0x1f
/* 8038296C 0037F8CC 48 00 00 24 */ b lbl_80382990
lbl_80382970:
/* 80382970 0037F8D0 2C 1E 00 00 */ cmpwi r30, 0
/* 80382974 0037F8D4 40 82 00 14 */ bne lbl_80382988
/* 80382978 0037F8D8 7F A3 EB 78 */ mr r3, r29
/* 8038297C 0037F8DC 4B FF ED 0D */ bl OSRestoreInterrupts
/* 80382980 0037F8E0 38 60 00 00 */ li r3, 0
/* 80382984 0037F8E4 48 00 00 70 */ b lbl_803829F4
lbl_80382988:
/* 80382988 0037F8E8 38 7F 00 08 */ addi r3, r31, 8
/* 8038298C 0037F8EC 48 00 27 81 */ bl OSSleepThread
lbl_80382990:
/* 80382990 0037F8F0 80 1F 00 1C */ lwz r0, 0x1c(r31)
/* 80382994 0037F8F4 2C 00 00 00 */ cmpwi r0, 0
/* 80382998 0037F8F8 41 82 FF D8 */ beq lbl_80382970
/* 8038299C 0037F8FC 28 1C 00 00 */ cmplwi r28, 0
/* 803829A0 0037F900 41 82 00 18 */ beq lbl_803829B8
/* 803829A4 0037F904 80 1F 00 18 */ lwz r0, 0x18(r31)
/* 803829A8 0037F908 80 7F 00 10 */ lwz r3, 0x10(r31)
/* 803829AC 0037F90C 54 00 10 3A */ slwi r0, r0, 2
/* 803829B0 0037F910 7C 03 00 2E */ lwzx r0, r3, r0
/* 803829B4 0037F914 90 1C 00 00 */ stw r0, 0(r28)
lbl_803829B8:
/* 803829B8 0037F918 80 BF 00 18 */ lwz r5, 0x18(r31)
/* 803829BC 0037F91C 7F E3 FB 78 */ mr r3, r31
/* 803829C0 0037F920 80 9F 00 14 */ lwz r4, 0x14(r31)
/* 803829C4 0037F924 38 A5 00 01 */ addi r5, r5, 1
/* 803829C8 0037F928 7C 05 23 D6 */ divw r0, r5, r4
/* 803829CC 0037F92C 7C 00 21 D6 */ mullw r0, r0, r4
/* 803829D0 0037F930 7C 00 28 50 */ subf r0, r0, r5
/* 803829D4 0037F934 90 1F 00 18 */ stw r0, 0x18(r31)
/* 803829D8 0037F938 80 9F 00 1C */ lwz r4, 0x1c(r31)
/* 803829DC 0037F93C 38 04 FF FF */ addi r0, r4, -1
/* 803829E0 0037F940 90 1F 00 1C */ stw r0, 0x1c(r31)
/* 803829E4 0037F944 48 00 28 15 */ bl OSWakeupThread
/* 803829E8 0037F948 7F A3 EB 78 */ mr r3, r29
/* 803829EC 0037F94C 4B FF EC 9D */ bl OSRestoreInterrupts
/* 803829F0 0037F950 38 60 00 01 */ li r3, 1
lbl_803829F4:
/* 803829F4 0037F954 80 01 00 2C */ lwz r0, 0x2c(r1)
/* 803829F8 0037F958 83 E1 00 24 */ lwz r31, 0x24(r1)
/* 803829FC 0037F95C 83 C1 00 20 */ lwz r30, 0x20(r1)
/* 80382A00 0037F960 83 A1 00 1C */ lwz r29, 0x1c(r1)
/* 80382A04 0037F964 83 81 00 18 */ lwz r28, 0x18(r1)
/* 80382A08 0037F968 38 21 00 28 */ addi r1, r1, 0x28
/* 80382A0C 0037F96C 7C 08 03 A6 */ mtlr r0
/* 80382A10 0037F970 4E 80 00 20 */ blr
OnReset:
/* 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 lbl_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
lbl_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
.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, lbl_80541250@ha
/* 80382A70 0037F9D0 A0 C8 00 22 */ lhz r6, 0x22(r8)
/* 80382A74 0037F9D4 38 63 12 50 */ addi r3, r3, lbl_80541250@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 */ mtdbatu 0, r7
/* 80382BAC 0037FB0C 7C 99 83 A6 */ mtdbatl 0, r4
/* 80382BB0 0037FB10 7C 78 83 A6 */ mtdbatu 0, r3
/* 80382BB4 0037FB14 4C 00 01 2C */ isync
/* 80382BB8 0037FB18 7C F0 83 A6 */ mtibatu 0, r7
/* 80382BBC 0037FB1C 7C 91 83 A6 */ mtibatl 0, r4
/* 80382BC0 0037FB20 7C 70 83 A6 */ mtibatu 0, r3
/* 80382BC4 0037FB24 4C 00 01 2C */ isync
/* 80382BC8 0037FB28 7C FC 83 A6 */ mtdbatu 2, r7
/* 80382BCC 0037FB2C 7C DD 83 A6 */ mtdbatl 2, r6
/* 80382BD0 0037FB30 7C BC 83 A6 */ mtdbatu 2, r5
/* 80382BD4 0037FB34 4C 00 01 2C */ isync
/* 80382BD8 0037FB38 7C F4 83 A6 */ mtibatu 2, r7
/* 80382BDC 0037FB3C 7C D5 83 A6 */ mtibatl 2, r6
/* 80382BE0 0037FB40 7C B4 83 A6 */ mtibatu 2, 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 */ mtdbatu 0, r7
/* 80382C2C 0037FB8C 7C 99 83 A6 */ mtdbatl 0, r4
/* 80382C30 0037FB90 7C 78 83 A6 */ mtdbatu 0, r3
/* 80382C34 0037FB94 4C 00 01 2C */ isync
/* 80382C38 0037FB98 7C F0 83 A6 */ mtibatu 0, r7
/* 80382C3C 0037FB9C 7C 91 83 A6 */ mtibatl 0, r4
/* 80382C40 0037FBA0 7C 70 83 A6 */ mtibatu 0, r3
/* 80382C44 0037FBA4 4C 00 01 2C */ isync
/* 80382C48 0037FBA8 7C FC 83 A6 */ mtdbatu 2, r7
/* 80382C4C 0037FBAC 7C DD 83 A6 */ mtdbatl 2, r6
/* 80382C50 0037FBB0 7C BC 83 A6 */ mtdbatu 2, r5
/* 80382C54 0037FBB4 4C 00 01 2C */ isync
/* 80382C58 0037FBB8 7C F4 83 A6 */ mtibatu 2, r7
/* 80382C5C 0037FBBC 7C D5 83 A6 */ mtibatl 2, r6
/* 80382C60 0037FBC0 7C B4 83 A6 */ mtibatu 2, 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