Commit b4cd605c authored by David A. Long's avatar David A. Long

ARM: Make arch_specific_insn a define for new arch_probes_insn structure

Because the common underlying code for ARM kprobes and uprobes needs
to share a common architecrure-specific context structure, and because
the generic kprobes include file insists on defining this to a dummy
structure when kprobes is not configured, a new common structure is
required which can exist when uprobes is configured without kprobes.
In this case kprobes will define a dummy structure, but without the
define aliasing the two structure tags it will not affect uprobes and
the shared probes code.
Signed-off-by: default avatarDavid A. Long <dave.long@linaro.org>
Acked-by: default avatarJon Medhurst <tixy@linaro.org>
parent 602cd260
......@@ -31,6 +31,8 @@ typedef u32 kprobe_opcode_t;
struct kprobe;
#include <asm/probes.h>
#define arch_specific_insn arch_probes_insn
struct prev_kprobe {
struct kprobe *kp;
unsigned int status;
......
......@@ -21,18 +21,18 @@
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;
......
......@@ -74,7 +74,7 @@
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;
......@@ -103,7 +103,7 @@ emulate_ldrdstrd(probes_opcode_t insn,
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;
......@@ -133,7 +133,7 @@ emulate_ldr(probes_opcode_t insn,
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;
......@@ -160,7 +160,7 @@ emulate_str(probes_opcode_t insn,
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;
......@@ -195,7 +195,7 @@ emulate_rd12rn16rm0rs8_rwflags(probes_opcode_t insn,
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;
......@@ -222,7 +222,7 @@ emulate_rd12rn16rm0_rwflags_nopc(probes_opcode_t insn,
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;
......@@ -252,7 +252,7 @@ emulate_rd16rn12rm0rs8_rwflags_nopc(probes_opcode_t insn,
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;
......@@ -272,7 +272,7 @@ emulate_rd12rm0_noflags_nopc(probes_opcode_t insn,
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;
......
......@@ -18,7 +18,7 @@
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;
......@@ -60,7 +60,7 @@ static void __kprobes simulate_ldm1stm1(probes_opcode_t insn,
}
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;
......@@ -71,7 +71,7 @@ static void __kprobes simulate_stm1_pc(probes_opcode_t insn,
}
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);
......@@ -80,7 +80,7 @@ static void __kprobes simulate_ldm1_pc(probes_opcode_t insn,
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;
......@@ -108,7 +108,7 @@ emulate_generic_r0_12_noflags(probes_opcode_t insn,
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));
......@@ -116,7 +116,7 @@ emulate_generic_r2_14_noflags(probes_opcode_t insn,
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));
......@@ -124,7 +124,7 @@ emulate_ldm_r3_15(probes_opcode_t insn,
}
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;
......
This diff is collapsed.
......@@ -30,11 +30,11 @@
#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 *);
......
......@@ -58,7 +58,7 @@
*/
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);
......@@ -70,7 +70,7 @@ void __kprobes simulate_bbl(probes_opcode_t 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);
......@@ -81,7 +81,7 @@ void __kprobes simulate_blx1(probes_opcode_t 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];
......@@ -96,7 +96,7 @@ void __kprobes simulate_blx2bx(probes_opcode_t insn,
}
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 */
......@@ -104,7 +104,7 @@ void __kprobes simulate_mrs(probes_opcode_t insn,
}
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];
}
......@@ -705,7 +705,7 @@ EXPORT_SYMBOL_GPL(probes_decode_arm_table);
#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);
......@@ -724,7 +724,7 @@ static void __kprobes arm_singlestep(probes_opcode_t insn,
* 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;
......
......@@ -54,20 +54,20 @@ enum probes_arm_action {
};
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
......@@ -844,7 +844,7 @@ static unsigned long __kprobes thumb_check_cc(unsigned long cpsr)
}
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;
......@@ -853,7 +853,7 @@ static void __kprobes thumb16_singlestep(probes_opcode_t opcode,
}
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;
......@@ -862,7 +862,7 @@ static void __kprobes thumb32_singlestep(probes_opcode_t opcode,
}
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;
......@@ -872,7 +872,7 @@ thumb16_probes_decode_insn(probes_opcode_t insn, struct arch_specific_insn *asi,
}
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;
......
......@@ -88,10 +88,10 @@ extern const union decode_item probes_decode_thumb32_table[];
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
......@@ -176,13 +176,13 @@ probes_check_cc * const probes_condition_checks[16] = {
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();
......@@ -196,7 +196,7 @@ void __kprobes probes_emulate_none(probes_opcode_t opcode,
* 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
......@@ -221,7 +221,7 @@ prepare_emulated_insn(probes_opcode_t insn, struct arch_specific_insn *asi,
* 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
......@@ -385,7 +385,7 @@ static const int decode_struct_sizes[NUM_DECODE_TYPES] = {
*
*/
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)
{
......
......@@ -306,7 +306,7 @@ union decode_item {
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 {
......@@ -400,7 +400,7 @@ probes_insn_handler_t probes_simulate_nop;
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment