diff --git a/src/research/heap-record.ld b/src/research/heap-record.ld new file mode 100644 index 0000000..3934695 --- /dev/null +++ b/src/research/heap-record.ld @@ -0,0 +1,3 @@ +$$ = 0; +$C2$.init = 0x34 + TApplication.proc; +$C2$.onHeapAlloc = 0x88 + JKRSolidHeap.alloc; diff --git a/src/research/heap-record.s b/src/research/heap-record.s new file mode 100644 index 0000000..319e313 --- /dev/null +++ b/src/research/heap-record.s @@ -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