cgccportabilityplaystation

how do you intercept the address of an instruction that is writing to a segment of memory?


Imagine we have a usual instruction such as this one

mov [eax], ebx

and eax contains some address that we would like to write to.

The idea is to write a c program that tells you which address contains the instruction, if we already know the address that it's going to be writing to.

The real question: write a c program using the free sony pspsdk that would accomplish the same thing.

The psp uses MIPS III / IV and the instruction would look something like

sw a0 $00(t0)
##which literally spells out store register a0 at offset t0 + 0 bytes. where t0 would
## contain something like 0x08800000

disclaimer: it is still useful to know how to do this on windows, so if somebody only knows how to do this on windows or even osx, That would still be appreciated as it could provide relevant information on similar programming practices to accomplish this particular task.


Solution

  • Intercepting an instruction that writes to a particular address is not a normal activity in programs.

    It is a feature provided by some debuggers. There are at least three ways debuggers may be able to do this:

    I cannot speak to the Sony platform you are using. You would have to check its documentation or ask others regarding the availability of such features. Since this is a feature most often used by debuggers, investigating the documentation regarding debugging could be a way to find out whether the system supports such a feature.