About breakpoints and the JIT cache
|
01-19-2014, 04:55 AM
Post: #1
|
|||
|
|||
About breakpoints and the JIT cache
1. Is the fact that execute breakpoints only work with dynarec enabled a bug or intended?
2. Is there any way to flush the JIT cache manually? I'm writing a patch for a game that involves injecting a lot of code, and to simplify the injection I wrote a big "cheat" code that loads all of the instructions into memory. But using this code causes the entire emulator to crash unless dynarec is disabled, which wouldn't be a problem except I can't use execute breakpoints in interpreter mode. So I either have to test my code without breakpoints or enable dynarec and right click->"assemble opcode" for 100+ instructions. I'm guessing it crashes because the cheat just lays a bunch of instructions into memory without telling the JIT, so is there any way to manually refresh the JIT cache after loading my code? |
|||
01-19-2014, 05:28 AM
(This post was last modified: 01-19-2014 05:30 AM by [Unknown].)
Post: #2
|
|||
|
|||
RE: About breakpoints and the JIT cache
1. Intended. Otherwise, you must build a debug build. Checking for breakpoints is extremely slow in the interpreter (even if there are 0) and not enabled in release mode. Jit only gets slower if you add memory breakpoints, and so they are always enabled.
2. You should be able to call sceKernelIcacheInvalidateRange(). Alternatively, you can write the entire range. As long as you overwrite the first word of each block, it will automatically recompile it during jit. If you modify (e.g. xor, add, etc.) the existing opcodes, you are very likely to cause a crash while in jit. If you are doing this, call sceKernelIcacheInvalidateRange() __BEFORE__ modifying them. Jit actually modifies the opcodes to indicate where the jitted code is in host memory, so when you alter this, it confuses jit. It's a bit of a hack but seems to work with the self-modifying code of all games we've run into. -[Unknown] |
|||
01-21-2014, 08:00 PM
(This post was last modified: 01-21-2014 11:07 PM by mothball.)
Post: #3
|
|||
|
|||
RE: About breakpoints and the JIT cache
edit: ok, you can close the thread. Turns out I was just stupid and you're supposed to jump to the functions when in usermode, not syscall them directly.
|
|||
01-22-2014, 09:36 AM
Post: #4
|
|||
|
|||
RE: About breakpoints and the JIT cache
Closing and moving to the Development subforum.
|
|||
« Next Oldest | Next Newest »
|