On Mon, 2022-09-26 at 14:49 +0000, Christophe Leroy wrote:
quoted
+ /* Replace indirect branch sequence with direct branch
where possible */
+ if (!create_branch(&direct, jump_seq_addr, addr, 0))
+ if (patch_instruction(jump_seq_addr, direct))
Why not use patch_branch() ?
I didn't think of it at the time. To get the same abort-if-patch-failed
semantics then the following should work
int err;
...
/* Replace indirect branch sequence with direct branch where
* possible
*/
err = patch_branch(&entry->jump[PPC64_STUB_MTCTR_OFFSET], addr, 0);
if (err && err != -ERANGE)
return 0;