diff options
author | Treeki <treeki@gmail.com> | 2011-07-23 23:55:14 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-07-23 23:55:14 +0200 |
commit | 803c43cce9a5494d842856dd2e2aeb40666fe48a (patch) | |
tree | 14ced075735b06eb5768302602d92c1f01891b25 /src/heapbar.S | |
parent | 77d7cadea5d8762a0e2a7d9a1a40f314748a6dcf (diff) | |
parent | 693dc221a8af9a90754a3e500f459c4a9517b439 (diff) | |
download | kamek-803c43cce9a5494d842856dd2e2aeb40666fe48a.tar.gz kamek-803c43cce9a5494d842856dd2e2aeb40666fe48a.zip |
merged
Diffstat (limited to '')
-rw-r--r-- | src/heapbar.S | 236 |
1 files changed, 118 insertions, 118 deletions
diff --git a/src/heapbar.S b/src/heapbar.S index 35d45e5..4f86fbe 100644 --- a/src/heapbar.S +++ b/src/heapbar.S @@ -1,118 +1,118 @@ -# memory debugger - fun!
-# GX stuff is implemented in C++, this just gets the lowlevel info
-
-#ifndef __MWERKS__
-.set r0,0; .set r1,1; .set r2,2; .set r3,3; .set r4,4
-.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9
-.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14
-.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19
-.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24
-.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29
-.set r30,30; .set r31,31; .set f0,0; .set f2,2; .set f3,3
-#endif
-
-#define HEAP_EGGRootMEM1 1
-#define HEAP_EGGRootMEM2 2
-
-.extern cppGXStart
-.extern cppGXEnd
-.extern cppProcessHeap
-.extern MEMGetTotalFreeSizeForExpHeap
-.extern GameHeap1
-.extern GameHeap2
-
-.set sp,1
-.set rtoc,2
-.set this,31
-
-.text
-
-.align 4
-
-.global doHeapBar
-
-doHeapBar:
- blr
-
- stwu sp, -0x10(sp)
- mflr r0
- stw r0, 0x14(sp)
-
- stw this, 0xC(sp)
-
- #lis r3, EGGTSystem_Pointer@h
- #ori r3, r3, EGGTSystem_Pointer@l
- #lwz this, 0(r3)
-
- bl cppGXStart
-
- #lwz r3, 0x18(this)
- #lis r3, dSys_c__RootHeapMEM1@h
- #ori r3, r3, dSys_c__RootHeapMEM1@l
- lis r3, GameHeap1@h
- ori r3, r3, GameHeap1@l
- lwz r3, 0(r3)
- li r4, HEAP_EGGRootMEM1
- bl asmProcessHeap
-
- #lwz r3, 0x1C(this)
- #lis r3, dSys_c__RootHeapMEM2@h
- #ori r3, r3, dSys_c__RootHeapMEM2@l
- lis r3, GameHeap2@h
- ori r3, r3, GameHeap2@l
- lwz r3, 0(r3)
- li r4, HEAP_EGGRootMEM2
- bl asmProcessHeap
-
- bl cppGXEnd
-
- lwz this, 0xC(sp)
- lwz r0, 0x14(sp)
- mtlr r0
- addi sp, sp, 0x10
- blr
-
-
-
-asmProcessHeap:
-
- stwu sp, -0x10(sp)
- mflr r0
- stw r0, 0x14(sp)
-
- stw r31, 0xC(sp)
- stw r30, 0x8(sp)
-
- mr r31, r3
- mr r30, r4
-
- # get all the required data from the heap
- # cppProcessHeap(u32 freeSize, u32 heapSize, int heapID, char *name)
-
- # get free size first so the function doesn't destroy our volatile regs
- # because I'm too lazy to save them >.>
- lwz r3, 0x10(r31)
- bl MEMGetTotalFreeSizeForExpHeap
-
- # get name
- lwz r6, 0x34(r31)
-
- # get heapID
- mr r5, r30
-
- # get heap size
- # this was a fucking pain to figure out -_-
- lwz r4, 0x10(r31) # get the MEMiHeapHead*
- lwz r7, 0x18(r4) # get heapStart
- lwz r8, 0x1C(r4) # get heapEnd
- sub r4, r8, r7 # heapSize = heapEnd - heapStart probably
-
- # now do it
- bl cppProcessHeap
-
- lwz r30, 0x8(sp)
- lwz r31, 0xC(sp)
- lwz r0, 0x14(sp)
- mtlr r0
- addi sp, sp, 0x10
- blr
+# memory debugger - fun! +# GX stuff is implemented in C++, this just gets the lowlevel info + +#ifndef __MWERKS__ +.set r0,0; .set r1,1; .set r2,2; .set r3,3; .set r4,4 +.set r5,5; .set r6,6; .set r7,7; .set r8,8; .set r9,9 +.set r10,10; .set r11,11; .set r12,12; .set r13,13; .set r14,14 +.set r15,15; .set r16,16; .set r17,17; .set r18,18; .set r19,19 +.set r20,20; .set r21,21; .set r22,22; .set r23,23; .set r24,24 +.set r25,25; .set r26,26; .set r27,27; .set r28,28; .set r29,29 +.set r30,30; .set r31,31; .set f0,0; .set f2,2; .set f3,3 +#endif + +#define HEAP_EGGRootMEM1 1 +#define HEAP_EGGRootMEM2 2 + +.extern cppGXStart +.extern cppGXEnd +.extern cppProcessHeap +.extern MEMGetTotalFreeSizeForExpHeap +.extern GameHeap1 +.extern GameHeap2 + +.set sp,1 +.set rtoc,2 +.set this,31 + +.text + +.align 4 + +.global doHeapBar + +doHeapBar: + blr + + stwu sp, -0x10(sp) + mflr r0 + stw r0, 0x14(sp) + + stw this, 0xC(sp) + + #lis r3, EGGTSystem_Pointer@h + #ori r3, r3, EGGTSystem_Pointer@l + #lwz this, 0(r3) + + bl cppGXStart + + #lwz r3, 0x18(this) + #lis r3, dSys_c__RootHeapMEM1@h + #ori r3, r3, dSys_c__RootHeapMEM1@l + lis r3, GameHeap1@h + ori r3, r3, GameHeap1@l + lwz r3, 0(r3) + li r4, HEAP_EGGRootMEM1 + bl asmProcessHeap + + #lwz r3, 0x1C(this) + #lis r3, dSys_c__RootHeapMEM2@h + #ori r3, r3, dSys_c__RootHeapMEM2@l + lis r3, GameHeap2@h + ori r3, r3, GameHeap2@l + lwz r3, 0(r3) + li r4, HEAP_EGGRootMEM2 + bl asmProcessHeap + + bl cppGXEnd + + lwz this, 0xC(sp) + lwz r0, 0x14(sp) + mtlr r0 + addi sp, sp, 0x10 + blr + + + +asmProcessHeap: + + stwu sp, -0x10(sp) + mflr r0 + stw r0, 0x14(sp) + + stw r31, 0xC(sp) + stw r30, 0x8(sp) + + mr r31, r3 + mr r30, r4 + + # get all the required data from the heap + # cppProcessHeap(u32 freeSize, u32 heapSize, int heapID, char *name) + + # get free size first so the function doesn't destroy our volatile regs + # because I'm too lazy to save them >.> + lwz r3, 0x10(r31) + bl MEMGetTotalFreeSizeForExpHeap + + # get name + lwz r6, 0x34(r31) + + # get heapID + mr r5, r30 + + # get heap size + # this was a fucking pain to figure out -_- + lwz r4, 0x10(r31) # get the MEMiHeapHead* + lwz r7, 0x18(r4) # get heapStart + lwz r8, 0x1C(r4) # get heapEnd + sub r4, r8, r7 # heapSize = heapEnd - heapStart probably + + # now do it + bl cppProcessHeap + + lwz r30, 0x8(sp) + lwz r31, 0xC(sp) + lwz r0, 0x14(sp) + mtlr r0 + addi sp, sp, 0x10 + blr |