prime/asm/Dolphin/os/OSResetSW.s

278 lines
13 KiB
ArmAsm

.include "macros.inc"
.section .sbss
.balign 8
.global lbl_805A9900
lbl_805A9900:
.skip 0x4
.global lbl_805A9904
lbl_805A9904:
.skip 0x4
.global lbl_805A9908
lbl_805A9908:
.skip 0x8
.global lbl_805A9910
lbl_805A9910:
.skip 0x4
.global lbl_805A9914
lbl_805A9914:
.skip 0x4
.global lbl_805A9918
lbl_805A9918:
.skip 0x4
.global lbl_805A991C
lbl_805A991C:
.skip 0x4
.section .text, "ax"
.global __OSResetSWInterruptHandler
__OSResetSWInterruptHandler:
/* 8038349C 003803FC 7C 08 02 A6 */ mflr r0
/* 803834A0 00380400 90 01 00 04 */ stw r0, 4(r1)
/* 803834A4 00380404 94 21 FF D8 */ stwu r1, -0x28(r1)
/* 803834A8 00380408 93 E1 00 24 */ stw r31, 0x24(r1)
/* 803834AC 0038040C 93 C1 00 20 */ stw r30, 0x20(r1)
/* 803834B0 00380410 93 A1 00 1C */ stw r29, 0x1c(r1)
/* 803834B4 00380414 48 00 1F 15 */ bl __OSGetSystemTime
/* 803834B8 00380418 3C A0 80 00 */ lis r5, 0x800000F8@ha
/* 803834BC 0038041C 90 8D AD 5C */ stw r4, lbl_805A991C@sda21(r13)
/* 803834C0 00380420 80 05 00 F8 */ lwz r0, 0x800000F8@l(r5)
/* 803834C4 00380424 3C 80 43 1C */ lis r4, 0x431BDE83@ha
/* 803834C8 00380428 38 84 DE 83 */ addi r4, r4, 0x431BDE83@l
/* 803834CC 0038042C 90 6D AD 58 */ stw r3, lbl_805A9918@sda21(r13)
/* 803834D0 00380430 54 00 F0 BE */ srwi r0, r0, 2
/* 803834D4 00380434 7C 04 00 16 */ mulhwu r0, r4, r0
/* 803834D8 00380438 54 00 8B FE */ srwi r0, r0, 0xf
/* 803834DC 0038043C 1C 00 00 64 */ mulli r0, r0, 0x64
/* 803834E0 00380440 54 1D E8 FE */ srwi r29, r0, 3
/* 803834E4 00380444 3B C0 00 00 */ li r30, 0
/* 803834E8 00380448 3F E0 CC 00 */ lis r31, 0xcc00
lbl_803834EC:
/* 803834EC 0038044C 48 00 1E DD */ bl __OSGetSystemTime
/* 803834F0 00380450 80 CD AD 5C */ lwz r6, lbl_805A991C@sda21(r13)
/* 803834F4 00380454 6F C5 80 00 */ xoris r5, r30, 0x8000
/* 803834F8 00380458 80 0D AD 58 */ lwz r0, lbl_805A9918@sda21(r13)
/* 803834FC 0038045C 7C 86 20 10 */ subfc r4, r6, r4
/* 80383500 00380460 7C 00 19 10 */ subfe r0, r0, r3
/* 80383504 00380464 6C 03 80 00 */ xoris r3, r0, 0x8000
/* 80383508 00380468 7C 1D 20 10 */ subfc r0, r29, r4
/* 8038350C 0038046C 7C A5 19 10 */ subfe r5, r5, r3
/* 80383510 00380470 7C A3 19 10 */ subfe r5, r3, r3
/* 80383514 00380474 7C A5 00 D1 */ neg. r5, r5
/* 80383518 00380478 41 82 00 10 */ beq lbl_80383528
/* 8038351C 0038047C 80 1F 30 00 */ lwz r0, 0x3000(r31)
/* 80383520 00380480 54 00 03 DF */ rlwinm. r0, r0, 0, 0xf, 0xf
/* 80383524 00380484 41 82 FF C8 */ beq lbl_803834EC
lbl_80383528:
/* 80383528 00380488 3C 60 CC 00 */ lis r3, 0xCC003000@ha
/* 8038352C 0038048C 80 03 30 00 */ lwz r0, 0xCC003000@l(r3)
/* 80383530 00380490 54 00 03 DF */ rlwinm. r0, r0, 0, 0xf, 0xf
/* 80383534 00380494 40 82 00 34 */ bne lbl_80383568
/* 80383538 00380498 38 00 00 01 */ li r0, 1
/* 8038353C 0038049C 90 0D AD 44 */ stw r0, lbl_805A9904@sda21(r13)
/* 80383540 003804A0 38 60 02 00 */ li r3, 0x200
/* 80383544 003804A4 90 0D AD 48 */ stw r0, lbl_805A9908@sda21(r13)
/* 80383548 003804A8 4B FF E4 E1 */ bl __OSMaskInterrupts
/* 8038354C 003804AC 81 8D AD 40 */ lwz r12, lbl_805A9900@sda21(r13)
/* 80383550 003804B0 28 0C 00 00 */ cmplwi r12, 0
/* 80383554 003804B4 41 82 00 14 */ beq lbl_80383568
/* 80383558 003804B8 38 00 00 00 */ li r0, 0
/* 8038355C 003804BC 7D 88 03 A6 */ mtlr r12
/* 80383560 003804C0 90 0D AD 40 */ stw r0, lbl_805A9900@sda21(r13)
/* 80383564 003804C4 4E 80 00 21 */ blrl
lbl_80383568:
/* 80383568 003804C8 38 00 00 02 */ li r0, 2
/* 8038356C 003804CC 3C 60 CC 00 */ lis r3, 0xCC003000@ha
/* 80383570 003804D0 90 03 30 00 */ stw r0, 0xCC003000@l(r3)
/* 80383574 003804D4 80 01 00 2C */ lwz r0, 0x2c(r1)
/* 80383578 003804D8 83 E1 00 24 */ lwz r31, 0x24(r1)
/* 8038357C 003804DC 83 C1 00 20 */ lwz r30, 0x20(r1)
/* 80383580 003804E0 83 A1 00 1C */ lwz r29, 0x1c(r1)
/* 80383584 003804E4 38 21 00 28 */ addi r1, r1, 0x28
/* 80383588 003804E8 7C 08 03 A6 */ mtlr r0
/* 8038358C 003804EC 4E 80 00 20 */ blr
.global OSGetResetButtonState
OSGetResetButtonState:
/* 80383590 003804F0 7C 08 02 A6 */ mflr r0
/* 80383594 003804F4 90 01 00 04 */ stw r0, 4(r1)
/* 80383598 003804F8 94 21 FF E8 */ stwu r1, -0x18(r1)
/* 8038359C 003804FC 93 E1 00 14 */ stw r31, 0x14(r1)
/* 803835A0 00380500 93 C1 00 10 */ stw r30, 0x10(r1)
/* 803835A4 00380504 93 A1 00 0C */ stw r29, 0xc(r1)
/* 803835A8 00380508 4B FF E0 B9 */ bl OSDisableInterrupts
/* 803835AC 0038050C 7C 7E 1B 78 */ mr r30, r3
/* 803835B0 00380510 48 00 1E 19 */ bl __OSGetSystemTime
/* 803835B4 00380514 3C A0 CC 00 */ lis r5, 0xCC003000@ha
/* 803835B8 00380518 80 05 30 00 */ lwz r0, 0xCC003000@l(r5)
/* 803835BC 0038051C 54 00 03 DF */ rlwinm. r0, r0, 0, 0xf, 0xf
/* 803835C0 00380520 40 82 00 DC */ bne lbl_8038369C
/* 803835C4 00380524 80 0D AD 44 */ lwz r0, lbl_805A9904@sda21(r13)
/* 803835C8 00380528 2C 00 00 00 */ cmpwi r0, 0
/* 803835CC 0038052C 40 82 00 40 */ bne lbl_8038360C
/* 803835D0 00380530 80 0D AD 50 */ lwz r0, lbl_805A9910@sda21(r13)
/* 803835D4 00380534 38 C0 00 00 */ li r6, 0
/* 803835D8 00380538 80 AD AD 54 */ lwz r5, lbl_805A9914@sda21(r13)
/* 803835DC 0038053C 38 E0 00 01 */ li r7, 1
/* 803835E0 00380540 7C 00 32 78 */ xor r0, r0, r6
/* 803835E4 00380544 7C A5 32 78 */ xor r5, r5, r6
/* 803835E8 00380548 90 ED AD 44 */ stw r7, lbl_805A9904@sda21(r13)
/* 803835EC 0038054C 7C A0 03 79 */ or. r0, r5, r0
/* 803835F0 00380550 41 82 00 08 */ beq lbl_803835F8
/* 803835F4 00380554 48 00 00 08 */ b lbl_803835FC
lbl_803835F8:
/* 803835F8 00380558 7C C7 33 78 */ mr r7, r6
lbl_803835FC:
/* 803835FC 0038055C 90 8D AD 5C */ stw r4, lbl_805A991C@sda21(r13)
/* 80383600 00380560 7C FD 3B 78 */ mr r29, r7
/* 80383604 00380564 90 6D AD 58 */ stw r3, lbl_805A9918@sda21(r13)
/* 80383608 00380568 48 00 01 48 */ b lbl_80383750
lbl_8038360C:
/* 8038360C 0038056C 80 0D AD 50 */ lwz r0, lbl_805A9910@sda21(r13)
/* 80383610 00380570 39 20 00 00 */ li r9, 0
/* 80383614 00380574 80 AD AD 54 */ lwz r5, lbl_805A9914@sda21(r13)
/* 80383618 00380578 39 40 00 01 */ li r10, 1
/* 8038361C 0038057C 7C 00 4A 78 */ xor r0, r0, r9
/* 80383620 00380580 7C A5 4A 78 */ xor r5, r5, r9
/* 80383624 00380584 7C A0 03 79 */ or. r0, r5, r0
/* 80383628 00380588 40 82 00 58 */ bne lbl_80383680
/* 8038362C 0038058C 3C C0 80 00 */ lis r6, 0x800000F8@ha
/* 80383630 00380590 80 AD AD 5C */ lwz r5, lbl_805A991C@sda21(r13)
/* 80383634 00380594 80 E6 00 F8 */ lwz r7, 0x800000F8@l(r6)
/* 80383638 00380598 3C C0 43 1C */ lis r6, 0x431BDE83@ha
/* 8038363C 0038059C 39 06 DE 83 */ addi r8, r6, 0x431BDE83@l
/* 80383640 003805A0 80 0D AD 58 */ lwz r0, lbl_805A9918@sda21(r13)
/* 80383644 003805A4 54 E6 F0 BE */ srwi r6, r7, 2
/* 80383648 003805A8 7C C8 30 16 */ mulhwu r6, r8, r6
/* 8038364C 003805AC 54 C6 8B FE */ srwi r6, r6, 0xf
/* 80383650 003805B0 1C C6 00 64 */ mulli r6, r6, 0x64
/* 80383654 003805B4 7C E5 20 10 */ subfc r7, r5, r4
/* 80383658 003805B8 7C 00 19 10 */ subfe r0, r0, r3
/* 8038365C 003805BC 54 C8 E8 FE */ srwi r8, r6, 3
/* 80383660 003805C0 6C 05 80 00 */ xoris r5, r0, 0x8000
/* 80383664 003805C4 6D 26 80 00 */ xoris r6, r9, 0x8000
/* 80383668 003805C8 7C 07 40 10 */ subfc r0, r7, r8
/* 8038366C 003805CC 7C A5 31 10 */ subfe r5, r5, r6
/* 80383670 003805D0 7C A6 31 10 */ subfe r5, r6, r6
/* 80383674 003805D4 7C A5 00 D1 */ neg. r5, r5
/* 80383678 003805D8 40 82 00 08 */ bne lbl_80383680
/* 8038367C 003805DC 7D 2A 4B 78 */ mr r10, r9
lbl_80383680:
/* 80383680 003805E0 2C 0A 00 00 */ cmpwi r10, 0
/* 80383684 003805E4 41 82 00 0C */ beq lbl_80383690
/* 80383688 003805E8 38 00 00 01 */ li r0, 1
/* 8038368C 003805EC 48 00 00 08 */ b lbl_80383694
lbl_80383690:
/* 80383690 003805F0 38 00 00 00 */ li r0, 0
lbl_80383694:
/* 80383694 003805F4 7C 1D 03 78 */ mr r29, r0
/* 80383698 003805F8 48 00 00 B8 */ b lbl_80383750
lbl_8038369C:
/* 8038369C 003805FC 80 0D AD 44 */ lwz r0, lbl_805A9904@sda21(r13)
/* 803836A0 00380600 2C 00 00 00 */ cmpwi r0, 0
/* 803836A4 00380604 41 82 00 34 */ beq lbl_803836D8
/* 803836A8 00380608 80 AD AD 48 */ lwz r5, lbl_805A9908@sda21(r13)
/* 803836AC 0038060C 38 00 00 00 */ li r0, 0
/* 803836B0 00380610 90 0D AD 44 */ stw r0, lbl_805A9904@sda21(r13)
/* 803836B4 00380614 2C 05 00 00 */ cmpwi r5, 0
/* 803836B8 00380618 3B A5 00 00 */ addi r29, r5, 0
/* 803836BC 0038061C 41 82 00 10 */ beq lbl_803836CC
/* 803836C0 00380620 90 8D AD 54 */ stw r4, lbl_805A9914@sda21(r13)
/* 803836C4 00380624 90 6D AD 50 */ stw r3, lbl_805A9910@sda21(r13)
/* 803836C8 00380628 48 00 00 88 */ b lbl_80383750
lbl_803836CC:
/* 803836CC 0038062C 90 0D AD 54 */ stw r0, lbl_805A9914@sda21(r13)
/* 803836D0 00380630 90 0D AD 50 */ stw r0, lbl_805A9910@sda21(r13)
/* 803836D4 00380634 48 00 00 7C */ b lbl_80383750
lbl_803836D8:
/* 803836D8 00380638 80 CD AD 50 */ lwz r6, lbl_805A9910@sda21(r13)
/* 803836DC 0038063C 39 00 00 00 */ li r8, 0
/* 803836E0 00380640 80 ED AD 54 */ lwz r7, lbl_805A9914@sda21(r13)
/* 803836E4 00380644 7C C0 42 78 */ xor r0, r6, r8
/* 803836E8 00380648 7C E5 42 78 */ xor r5, r7, r8
/* 803836EC 0038064C 7C A0 03 79 */ or. r0, r5, r0
/* 803836F0 00380650 41 82 00 50 */ beq lbl_80383740
/* 803836F4 00380654 3C A0 80 00 */ lis r5, 0x800000F8@ha
/* 803836F8 00380658 80 05 00 F8 */ lwz r0, 0x800000F8@l(r5)
/* 803836FC 0038065C 3C A0 10 62 */ lis r5, 0x10624DD3@ha
/* 80383700 00380660 38 A5 4D D3 */ addi r5, r5, 0x10624DD3@l
/* 80383704 00380664 54 00 F0 BE */ srwi r0, r0, 2
/* 80383708 00380668 7C 05 00 16 */ mulhwu r0, r5, r0
/* 8038370C 0038066C 54 00 D1 BE */ srwi r0, r0, 6
/* 80383710 00380670 1C 00 00 28 */ mulli r0, r0, 0x28
/* 80383714 00380674 7C E7 20 10 */ subfc r7, r7, r4
/* 80383718 00380678 7C A6 19 10 */ subfe r5, r6, r3
/* 8038371C 0038067C 6C A6 80 00 */ xoris r6, r5, 0x8000
/* 80383720 00380680 6D 05 80 00 */ xoris r5, r8, 0x8000
/* 80383724 00380684 7C 00 38 10 */ subfc r0, r0, r7
/* 80383728 00380688 7C A5 31 10 */ subfe r5, r5, r6
/* 8038372C 0038068C 7C A6 31 10 */ subfe r5, r6, r6
/* 80383730 00380690 7C A5 00 D1 */ neg. r5, r5
/* 80383734 00380694 41 82 00 0C */ beq lbl_80383740
/* 80383738 00380698 3B A0 00 01 */ li r29, 1
/* 8038373C 0038069C 48 00 00 14 */ b lbl_80383750
lbl_80383740:
/* 80383740 003806A0 38 00 00 00 */ li r0, 0
/* 80383744 003806A4 90 0D AD 54 */ stw r0, lbl_805A9914@sda21(r13)
/* 80383748 003806A8 3B A0 00 00 */ li r29, 0
/* 8038374C 003806AC 90 0D AD 50 */ stw r0, lbl_805A9910@sda21(r13)
lbl_80383750:
/* 80383750 003806B0 3C A0 80 00 */ lis r5, 0x800030E3@ha
/* 80383754 003806B4 93 AD AD 48 */ stw r29, lbl_805A9908@sda21(r13)
/* 80383758 003806B8 88 05 30 E3 */ lbz r0, 0x800030E3@l(r5)
/* 8038375C 003806BC 54 00 06 BF */ clrlwi. r0, r0, 0x1a
/* 80383760 003806C0 41 82 00 A0 */ beq lbl_80383800
/* 80383764 003806C4 1D 40 00 3C */ mulli r10, r0, 0x3c
/* 80383768 003806C8 80 05 00 F8 */ lwz r0, 0xf8(r5)
/* 8038376C 003806CC 81 2D AC EC */ lwz r9, __OSStartTime+4@sda21(r13)
/* 80383770 003806D0 81 0D AC E8 */ lwz r8, __OSStartTime@sda21(r13)
/* 80383774 003806D4 54 06 F0 BE */ srwi r6, r0, 2
/* 80383778 003806D8 7D 40 FE 70 */ srawi r0, r10, 0x1f
/* 8038377C 003806DC 7C E0 31 D6 */ mullw r7, r0, r6
/* 80383780 003806E0 7C 0A 30 16 */ mulhwu r0, r10, r6
/* 80383784 003806E4 7C AA 31 D6 */ mullw r5, r10, r6
/* 80383788 003806E8 7D 29 28 14 */ addc r9, r9, r5
/* 8038378C 003806EC 3B E0 00 00 */ li r31, 0
/* 80383790 003806F0 7C E7 02 14 */ add r7, r7, r0
/* 80383794 003806F4 7C 0A F9 D6 */ mullw r0, r10, r31
/* 80383798 003806F8 7C 07 02 14 */ add r0, r7, r0
/* 8038379C 003806FC 7D 08 01 14 */ adde r8, r8, r0
/* 803837A0 00380700 6D 07 80 00 */ xoris r7, r8, 0x8000
/* 803837A4 00380704 6C 65 80 00 */ xoris r5, r3, 0x8000
/* 803837A8 00380708 7C 04 48 10 */ subfc r0, r4, r9
/* 803837AC 0038070C 7C A5 39 10 */ subfe r5, r5, r7
/* 803837B0 00380710 7C A7 39 10 */ subfe r5, r7, r7
/* 803837B4 00380714 7C A5 00 D1 */ neg. r5, r5
/* 803837B8 00380718 41 82 00 48 */ beq lbl_80383800
/* 803837BC 0038071C 7C 89 20 10 */ subfc r4, r9, r4
/* 803837C0 00380720 7C 68 19 10 */ subfe r3, r8, r3
/* 803837C4 00380724 38 A0 00 00 */ li r5, 0
/* 803837C8 00380728 48 00 64 05 */ bl __div2i
/* 803837CC 0038072C 38 A0 00 00 */ li r5, 0
/* 803837D0 00380730 38 C0 00 02 */ li r6, 2
/* 803837D4 00380734 48 00 63 F9 */ bl __div2i
/* 803837D8 00380738 38 00 00 01 */ li r0, 1
/* 803837DC 0038073C 7C 84 00 38 */ and r4, r4, r0
/* 803837E0 00380740 7C 60 F8 38 */ and r0, r3, r31
/* 803837E4 00380744 7C 83 FA 78 */ xor r3, r4, r31
/* 803837E8 00380748 7C 00 FA 78 */ xor r0, r0, r31
/* 803837EC 0038074C 7C 60 03 79 */ or. r0, r3, r0
/* 803837F0 00380750 40 82 00 0C */ bne lbl_803837FC
/* 803837F4 00380754 3B A0 00 01 */ li r29, 1
/* 803837F8 00380758 48 00 00 08 */ b lbl_80383800
lbl_803837FC:
/* 803837FC 0038075C 3B A0 00 00 */ li r29, 0
lbl_80383800:
/* 80383800 00380760 7F C3 F3 78 */ mr r3, r30
/* 80383804 00380764 4B FF DE 85 */ bl OSRestoreInterrupts
/* 80383808 00380768 7F A3 EB 78 */ mr r3, r29
/* 8038380C 0038076C 80 01 00 1C */ lwz r0, 0x1c(r1)
/* 80383810 00380770 83 E1 00 14 */ lwz r31, 0x14(r1)
/* 80383814 00380774 83 C1 00 10 */ lwz r30, 0x10(r1)
/* 80383818 00380778 83 A1 00 0C */ lwz r29, 0xc(r1)
/* 8038381C 0038077C 38 21 00 18 */ addi r1, r1, 0x18
/* 80383820 00380780 7C 08 03 A6 */ mtlr r0
/* 80383824 00380784 4E 80 00 20 */ blr