1
0
Fork 0

add heap-record

This commit is contained in:
sup39 2023-02-19 07:53:28 +09:00
parent 01c12a53ac
commit e1825d1e93
2 changed files with 37 additions and 0 deletions

View file

@ -0,0 +1,3 @@
$$ = 0;
$C2$.init = 0x34 + TApplication.proc;
$C2$.onHeapAlloc = 0x88 + JKRSolidHeap.alloc;

View file

@ -0,0 +1,34 @@
.set rSlot, 12
.set rSp, 11
.set rSize, 30
.set rPtr, 31
.init:
lis rSlot, 0x9000
lis rSp, 0x9400
stw rSp, 0(rSlot)
## orig
li r29, 0
.onHeapAlloc:
## prepare
### r12 = &sp = 9000_0000
lis rSlot, 0x9000
### r11 = sp
lwz rSp, 0(rSlot)
## record (size, ptr)
stwu rSize, -4(rSp)
stwu rPtr, -4(rSp)
## store LR
### r3 = sp of alloc
lwz r3, 0(r1)
### r3 = sp of operator_new
lwz r3, 0(r3)
### r3 = LR of operator_new
lwz r3, 4(r3)
### store
stwu r3, -4(rSp)
## write back sp
stw rSp, 0(rSlot)
## orig
addi r3, r29, 0x18