I'm trying to dump the value of r5
so that I can see what var_A0
data is. I am trying to dump in PPC since I'm using UART debugging on the XBox 360 console,
EX): I'm trying to figure out what the value of var_A0
is
addi r5, r1, 0x110+var_A0
Code im using is ::
PrintKey:
lis %r29, -0x8000
ori %r29, %r29, 0x100
sldi %r3, %r29, 32
ori %r3, %r3, 0x247C # 0x800001000000247C
li %r4, 0x80
bl printAddress
printAddress:
mr %r30, %r3
mr %r11, %r4 # text size
mtctr %r11
But this only print the physical code in the HV not the Registers Data
There are a few things you'll need to sort out here:
The
printAddress
function looks like it takes an address inr3
, and a size inr4
, then (presumably) prints the contents of memory at that address. We have no way of telling how that printing is done, as the code to do that is missing from your question.Consequently, you probably don't want to use
printAddress
to display the value ofr5
. You could probably adapt the actual printing code (which is missing) to just print the contents of a register, rather than memory.However: the actual thing you want to find out (the value of
var_A0
) is likely to be determined at compile time (or at least during final link - is this binary statically linked?). Check the disassembled code, and/or check for dynamic relocation entries if this is a dynamic executable.Alternatively, you could use
printAddress
to print the contents of the memory containing theaddi
instruction, then manually decode the instruction to determine the immediate value used in theaddi
.