MCPcopy Create free account
hub / github.com/GJDuck/e9patch / patchJumpPrefix

Function patchJumpPrefix

src/e9patch/e9tactics.cpp:307–321  ·  view source on GitHub ↗

* Patch in a (redundant) jmp instruction prefix. */

Source from the content-addressed store, hash-verified

305 * Patch in a (redundant) jmp instruction prefix.
306 */
307static void patchJumpPrefix(Patch *P, unsigned prefix)
308{
309 // TODO: support other prefixes/encodings/NOPs
310 const uint8_t prefixes[] = {0x48, 0x26, 0x36, 0x3E};
311 assert(prefix < P->I->size && prefix <= sizeof(prefixes));
312
313 uint8_t *bytes = P->I->PATCH, *state = P->I->STATE;
314 for (unsigned i = 0; i < prefix; i++)
315 {
316 assert(state[i] == STATE_INSTRUCTION ||
317 state[i] == STATE_FREE);
318 bytes[i] = prefixes[i];
319 state[i] = STATE_PATCHED;
320 }
321}
322
323/*
324 * Patch in a jmpq instruction.

Callers 1

tactic_T1Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected