*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+
#include <linux/kconfig.h>
#ifdef CONFIG_SWAP_KERNEL_IMMUTABLE
flush_icache_range(addr, addr + size);
}
+static int (*fn_aarch64_insn_patch_text)(void *addrs[], u32 insns[], int cnt);
+
static void write_u32(u32 *addr, u32 val)
{
- *addr = val;
- flush_icache((unsigned long)addr, sizeof(val));
+ void *addrs[1] = { (void *)addr };
+ u32 insns[1] = { (u32)val };
+
+ BUG_ON(fn_aarch64_insn_patch_text(addrs, insns, 1));
}
void arch_kp_core_arm(struct kp_core *p)
*/
int arch_init_module_deps(void)
{
+ const char *sym = "aarch64_insn_patch_text";
+
+ fn_aarch64_insn_patch_text = (void *)swap_ksyms(sym);
+ if (!fn_aarch64_insn_patch_text) {
+ pr_err("Symbol '%s' not found\n", sym);
+ return -ESRCH;
+ }
+
return 0;
}