struct kprobe;
#include <asm/probes.h>
+#define arch_specific_insn arch_probes_insn
+
struct prev_kprobe {
struct kprobe *kp;
unsigned int status;
typedef u32 probes_opcode_t;
-struct arch_specific_insn;
+struct arch_probes_insn;
typedef void (probes_insn_handler_t)(probes_opcode_t,
- struct arch_specific_insn *,
+ struct arch_probes_insn *,
struct pt_regs *);
typedef unsigned long (probes_check_cc)(unsigned long);
typedef void (probes_insn_singlestep_t)(probes_opcode_t,
- struct arch_specific_insn *,
+ struct arch_probes_insn *,
struct pt_regs *);
typedef void (probes_insn_fn_t)(void);
/* Architecture specific copy of original instruction. */
-struct arch_specific_insn {
+struct arch_probes_insn {
probes_opcode_t *insn;
probes_insn_handler_t *insn_handler;
probes_check_cc *insn_check_cc;
static void __kprobes
emulate_ldrdstrd(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long pc = regs->ARM_pc + 4;
int rt = (insn >> 12) & 0xf;
static void __kprobes
emulate_ldr(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long pc = regs->ARM_pc + 4;
int rt = (insn >> 12) & 0xf;
static void __kprobes
emulate_str(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long rtpc = regs->ARM_pc - 4 + str_pc_offset;
unsigned long rnpc = regs->ARM_pc + 4;
static void __kprobes
emulate_rd12rn16rm0rs8_rwflags(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long pc = regs->ARM_pc + 4;
int rd = (insn >> 12) & 0xf;
static void __kprobes
emulate_rd12rn16rm0_rwflags_nopc(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
int rd = (insn >> 12) & 0xf;
int rn = (insn >> 16) & 0xf;
static void __kprobes
emulate_rd16rn12rm0rs8_rwflags_nopc(probes_opcode_t insn,
- struct arch_specific_insn *asi,
+ struct arch_probes_insn *asi,
struct pt_regs *regs)
{
int rd = (insn >> 16) & 0xf;
static void __kprobes
emulate_rd12rm0_noflags_nopc(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
int rd = (insn >> 12) & 0xf;
int rm = insn & 0xf;
static void __kprobes
emulate_rdlo12rdhi16rn0rm8_rwflags_nopc(probes_opcode_t insn,
- struct arch_specific_insn *asi,
+ struct arch_probes_insn *asi,
struct pt_regs *regs)
{
int rdlo = (insn >> 12) & 0xf;
static void __kprobes simulate_ldm1stm1(probes_opcode_t insn,
- struct arch_specific_insn *asi,
+ struct arch_probes_insn *asi,
struct pt_regs *regs)
{
int rn = (insn >> 16) & 0xf;
}
static void __kprobes simulate_stm1_pc(probes_opcode_t insn,
- struct arch_specific_insn *asi,
+ struct arch_probes_insn *asi,
struct pt_regs *regs)
{
unsigned long addr = regs->ARM_pc - 4;
}
static void __kprobes simulate_ldm1_pc(probes_opcode_t insn,
- struct arch_specific_insn *asi,
+ struct arch_probes_insn *asi,
struct pt_regs *regs)
{
simulate_ldm1stm1(insn, asi, regs);
static void __kprobes
emulate_generic_r0_12_noflags(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
register void *rregs asm("r1") = regs;
register void *rfn asm("lr") = asi->insn_fn;
static void __kprobes
emulate_generic_r2_14_noflags(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
emulate_generic_r0_12_noflags(insn, asi,
(struct pt_regs *)(regs->uregs+2));
static void __kprobes
emulate_ldm_r3_15(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
emulate_generic_r0_12_noflags(insn, asi,
(struct pt_regs *)(regs->uregs+3));
}
enum probes_insn __kprobes
-kprobe_decode_ldmstm(probes_opcode_t insn, struct arch_specific_insn *asi,
+kprobe_decode_ldmstm(probes_opcode_t insn, struct arch_probes_insn *asi,
const struct decode_header *h)
{
probes_insn_handler_t *handler = 0;
static void __kprobes
t32_simulate_table_branch(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long pc = regs->ARM_pc;
int rn = (insn >> 16) & 0xf;
static void __kprobes
t32_simulate_mrs(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
int rd = (insn >> 8) & 0xf;
unsigned long mask = 0xf8ff03df; /* Mask out execution state */
static void __kprobes
t32_simulate_cond_branch(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long pc = regs->ARM_pc;
}
static enum probes_insn __kprobes
-t32_decode_cond_branch(probes_opcode_t insn, struct arch_specific_insn *asi,
+t32_decode_cond_branch(probes_opcode_t insn, struct arch_probes_insn *asi,
const struct decode_header *d)
{
int cc = (insn >> 22) & 0xf;
static void __kprobes
t32_simulate_branch(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long pc = regs->ARM_pc;
static void __kprobes
t32_simulate_ldr_literal(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long addr = regs->ARM_pc & ~3;
int rt = (insn >> 12) & 0xf;
}
static enum probes_insn __kprobes
-t32_decode_ldmstm(probes_opcode_t insn, struct arch_specific_insn *asi,
+t32_decode_ldmstm(probes_opcode_t insn, struct arch_probes_insn *asi,
const struct decode_header *d)
{
enum probes_insn ret = kprobe_decode_ldmstm(insn, asi, d);
static void __kprobes
t32_emulate_ldrdstrd(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long pc = regs->ARM_pc & ~3;
int rt1 = (insn >> 12) & 0xf;
static void __kprobes
t32_emulate_ldrstr(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
int rt = (insn >> 12) & 0xf;
int rn = (insn >> 16) & 0xf;
static void __kprobes
t32_emulate_rd8rn16rm0_rwflags(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
int rd = (insn >> 8) & 0xf;
int rn = (insn >> 16) & 0xf;
static void __kprobes
t32_emulate_rd8pc16_noflags(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long pc = regs->ARM_pc;
int rd = (insn >> 8) & 0xf;
static void __kprobes
t32_emulate_rd8rn16_noflags(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
int rd = (insn >> 8) & 0xf;
int rn = (insn >> 16) & 0xf;
static void __kprobes
t32_emulate_rdlo12rdhi8rn16rm0_noflags(probes_opcode_t insn,
- struct arch_specific_insn *asi,
+ struct arch_probes_insn *asi,
struct pt_regs *regs)
{
int rdlo = (insn >> 12) & 0xf;
static void __kprobes
t16_simulate_bxblx(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long pc = regs->ARM_pc + 2;
int rm = (insn >> 3) & 0xf;
static void __kprobes
t16_simulate_ldr_literal(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long *base = (unsigned long *)((regs->ARM_pc + 2) & ~3);
long index = insn & 0xff;
static void __kprobes
t16_simulate_ldrstr_sp_relative(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long* base = (unsigned long *)regs->ARM_sp;
long index = insn & 0xff;
static void __kprobes
t16_simulate_reladr(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long base = (insn & 0x800) ? regs->ARM_sp
: ((regs->ARM_pc + 2) & ~3);
static void __kprobes
t16_simulate_add_sp_imm(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
long imm = insn & 0x7f;
if (insn & 0x80) /* SUB */
static void __kprobes
t16_simulate_cbz(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
int rn = insn & 0x7;
probes_opcode_t nonzero = regs->uregs[rn] ? insn : ~insn;
static void __kprobes
t16_simulate_it(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
/*
* The 8 IT state bits are split into two parts in CPSR:
static void __kprobes
t16_singlestep_it(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
regs->ARM_pc += 2;
t16_simulate_it(insn, asi, regs);
}
static enum probes_insn __kprobes
-t16_decode_it(probes_opcode_t insn, struct arch_specific_insn *asi,
+t16_decode_it(probes_opcode_t insn, struct arch_probes_insn *asi,
const struct decode_header *d)
{
asi->insn_singlestep = t16_singlestep_it;
static void __kprobes
t16_simulate_cond_branch(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long pc = regs->ARM_pc + 2;
long offset = insn & 0x7f;
}
static enum probes_insn __kprobes
-t16_decode_cond_branch(probes_opcode_t insn, struct arch_specific_insn *asi,
+t16_decode_cond_branch(probes_opcode_t insn, struct arch_probes_insn *asi,
const struct decode_header *d)
{
int cc = (insn >> 8) & 0xf;
static void __kprobes
t16_simulate_branch(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long pc = regs->ARM_pc + 2;
long offset = insn & 0x3ff;
static unsigned long __kprobes
t16_emulate_loregs(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long oldcpsr = regs->ARM_cpsr;
unsigned long newcpsr;
static void __kprobes
t16_emulate_loregs_rwflags(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
regs->ARM_cpsr = t16_emulate_loregs(insn, asi, regs);
}
static void __kprobes
t16_emulate_loregs_noitrwflags(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long cpsr = t16_emulate_loregs(insn, asi, regs);
if (!in_it_block(cpsr))
static void __kprobes
t16_emulate_hiregs(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
unsigned long pc = regs->ARM_pc + 2;
int rdn = (insn & 0x7) | ((insn & 0x80) >> 4);
}
static enum probes_insn __kprobes
-t16_decode_hiregs(probes_opcode_t insn, struct arch_specific_insn *asi,
+t16_decode_hiregs(probes_opcode_t insn, struct arch_probes_insn *asi,
const struct decode_header *d)
{
insn &= ~0x00ff;
static void __kprobes
t16_emulate_push(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
__asm__ __volatile__ (
"ldr r9, [%[regs], #13*4] \n\t"
}
static enum probes_insn __kprobes
-t16_decode_push(probes_opcode_t insn, struct arch_specific_insn *asi,
+t16_decode_push(probes_opcode_t insn, struct arch_probes_insn *asi,
const struct decode_header *d)
{
/*
static void __kprobes
t16_emulate_pop_nopc(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
__asm__ __volatile__ (
"ldr r9, [%[regs], #13*4] \n\t"
static void __kprobes
t16_emulate_pop_pc(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
register unsigned long pc asm("r8");
}
static enum probes_insn __kprobes
-t16_decode_pop(probes_opcode_t insn, struct arch_specific_insn *asi,
+t16_decode_pop(probes_opcode_t insn, struct arch_probes_insn *asi,
const struct decode_header *d)
{
/*
#define KPROBE_THUMB32_BREAKPOINT_INSTRUCTION 0xf7f0a018
enum probes_insn __kprobes
-kprobe_decode_ldmstm(kprobe_opcode_t insn, struct arch_specific_insn *asi,
+kprobe_decode_ldmstm(kprobe_opcode_t insn, struct arch_probes_insn *asi,
const struct decode_header *h);
typedef enum probes_insn (kprobe_decode_insn_t)(probes_opcode_t,
- struct arch_specific_insn *,
+ struct arch_probes_insn *,
bool,
const union decode_action *);
*/
void __kprobes simulate_bbl(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
long iaddr = (long) regs->ARM_pc - 4;
int disp = branch_displacement(insn);
}
void __kprobes simulate_blx1(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
long iaddr = (long) regs->ARM_pc - 4;
int disp = branch_displacement(insn);
}
void __kprobes simulate_blx2bx(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
int rm = insn & 0xf;
long rmv = regs->uregs[rm];
}
void __kprobes simulate_mrs(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
int rd = (insn >> 12) & 0xf;
unsigned long mask = 0xf8ff03df; /* Mask out execution state */
}
void __kprobes simulate_mov_ipsp(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
regs->uregs[12] = regs->uregs[13];
}
#endif
static void __kprobes arm_singlestep(probes_opcode_t insn,
- struct arch_specific_insn *asi, struct pt_regs *regs)
+ struct arch_probes_insn *asi, struct pt_regs *regs)
{
regs->ARM_pc += 4;
asi->insn_handler(insn, asi, regs);
* should also be very rare.
*/
enum probes_insn __kprobes
-arm_probes_decode_insn(probes_opcode_t insn, struct arch_specific_insn *asi,
+arm_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
bool emulate, const union decode_action *actions)
{
asi->insn_singlestep = arm_singlestep;
};
void __kprobes simulate_bbl(probes_opcode_t opcode,
- struct arch_specific_insn *asi, struct pt_regs *regs);
+ struct arch_probes_insn *asi, struct pt_regs *regs);
void __kprobes simulate_blx1(probes_opcode_t opcode,
- struct arch_specific_insn *asi, struct pt_regs *regs);
+ struct arch_probes_insn *asi, struct pt_regs *regs);
void __kprobes simulate_blx2bx(probes_opcode_t opcode,
- struct arch_specific_insn *asi, struct pt_regs *regs);
+ struct arch_probes_insn *asi, struct pt_regs *regs);
void __kprobes simulate_mrs(probes_opcode_t opcode,
- struct arch_specific_insn *asi, struct pt_regs *regs);
+ struct arch_probes_insn *asi, struct pt_regs *regs);
void __kprobes simulate_mov_ipsp(probes_opcode_t opcode,
- struct arch_specific_insn *asi, struct pt_regs *regs);
+ struct arch_probes_insn *asi, struct pt_regs *regs);
extern const union decode_item probes_decode_arm_table[];
enum probes_insn arm_probes_decode_insn(probes_opcode_t,
- struct arch_specific_insn *, bool emulate,
+ struct arch_probes_insn *, bool emulate,
const union decode_action *actions);
#endif
}
static void __kprobes thumb16_singlestep(probes_opcode_t opcode,
- struct arch_specific_insn *asi,
+ struct arch_probes_insn *asi,
struct pt_regs *regs)
{
regs->ARM_pc += 2;
}
static void __kprobes thumb32_singlestep(probes_opcode_t opcode,
- struct arch_specific_insn *asi,
+ struct arch_probes_insn *asi,
struct pt_regs *regs)
{
regs->ARM_pc += 4;
}
enum probes_insn __kprobes
-thumb16_probes_decode_insn(probes_opcode_t insn, struct arch_specific_insn *asi,
+thumb16_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
bool emulate, const union decode_action *actions)
{
asi->insn_singlestep = thumb16_singlestep;
}
enum probes_insn __kprobes
-thumb32_probes_decode_insn(probes_opcode_t insn, struct arch_specific_insn *asi,
+thumb32_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
bool emulate, const union decode_action *actions)
{
asi->insn_singlestep = thumb32_singlestep;
extern const union decode_item probes_decode_thumb16_table[];
enum probes_insn __kprobes
-thumb16_probes_decode_insn(probes_opcode_t insn, struct arch_specific_insn *asi,
+thumb16_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
bool emulate, const union decode_action *actions);
enum probes_insn __kprobes
-thumb32_probes_decode_insn(probes_opcode_t insn, struct arch_specific_insn *asi,
+thumb32_probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
bool emulate, const union decode_action *actions);
#endif
void __kprobes probes_simulate_nop(probes_opcode_t opcode,
- struct arch_specific_insn *asi,
+ struct arch_probes_insn *asi,
struct pt_regs *regs)
{
}
void __kprobes probes_emulate_none(probes_opcode_t opcode,
- struct arch_specific_insn *asi,
+ struct arch_probes_insn *asi,
struct pt_regs *regs)
{
asi->insn_fn();
* emulation handler is called.
*/
static probes_opcode_t __kprobes
-prepare_emulated_insn(probes_opcode_t insn, struct arch_specific_insn *asi,
+prepare_emulated_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
bool thumb)
{
#ifdef CONFIG_THUMB2_KERNEL
* prepare_emulated_insn
*/
static void __kprobes
-set_emulated_insn(probes_opcode_t insn, struct arch_specific_insn *asi,
+set_emulated_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
bool thumb)
{
#ifdef CONFIG_THUMB2_KERNEL
*
*/
int __kprobes
-probes_decode_insn(probes_opcode_t insn, struct arch_specific_insn *asi,
+probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
const union decode_item *table, bool thumb,
bool emulate, const union decode_action *actions)
{
struct decode_header;
typedef enum probes_insn (probes_custom_decode_t)(probes_opcode_t,
- struct arch_specific_insn *,
+ struct arch_probes_insn *,
const struct decode_header *);
union decode_action {
probes_insn_handler_t probes_emulate_none;
int __kprobes
-probes_decode_insn(probes_opcode_t insn, struct arch_specific_insn *asi,
+probes_decode_insn(probes_opcode_t insn, struct arch_probes_insn *asi,
const union decode_item *table, bool thumb, bool emulate,
const union decode_action *actions);