Commit 5a8b589f authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Martin Schwidefsky

[S390] kprobes: instruction swap

Move the definition of the helper structure ins_replace_args to the
only place where it is used and drop the old member as it is not needed.
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent fc0a1fea
...@@ -64,11 +64,6 @@ struct arch_specific_insn { ...@@ -64,11 +64,6 @@ struct arch_specific_insn {
int reg; int reg;
}; };
struct ins_replace_args {
kprobe_opcode_t *ptr;
kprobe_opcode_t old;
kprobe_opcode_t new;
};
struct prev_kprobe { struct prev_kprobe {
struct kprobe *kp; struct kprobe *kp;
unsigned long status; unsigned long status;
......
...@@ -157,17 +157,21 @@ void __kprobes get_instruction_type(struct arch_specific_insn *ainsn) ...@@ -157,17 +157,21 @@ void __kprobes get_instruction_type(struct arch_specific_insn *ainsn)
} }
} }
struct ins_replace_args {
kprobe_opcode_t *ptr;
kprobe_opcode_t opcode;
};
static int __kprobes swap_instruction(void *aref) static int __kprobes swap_instruction(void *aref)
{ {
struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
unsigned long status = kcb->kprobe_status; unsigned long status = kcb->kprobe_status;
struct ins_replace_args *args = aref; struct ins_replace_args *args = aref;
int rc;
kcb->kprobe_status = KPROBE_SWAP_INST; kcb->kprobe_status = KPROBE_SWAP_INST;
rc = probe_kernel_write(args->ptr, &args->new, sizeof(args->new)); probe_kernel_write(args->ptr, &args->opcode, sizeof(args->opcode));
kcb->kprobe_status = status; kcb->kprobe_status = status;
return rc; return 0;
} }
void __kprobes arch_arm_kprobe(struct kprobe *p) void __kprobes arch_arm_kprobe(struct kprobe *p)
...@@ -175,8 +179,7 @@ void __kprobes arch_arm_kprobe(struct kprobe *p) ...@@ -175,8 +179,7 @@ void __kprobes arch_arm_kprobe(struct kprobe *p)
struct ins_replace_args args; struct ins_replace_args args;
args.ptr = p->addr; args.ptr = p->addr;
args.old = p->opcode; args.opcode = BREAKPOINT_INSTRUCTION;
args.new = BREAKPOINT_INSTRUCTION;
stop_machine(swap_instruction, &args, NULL); stop_machine(swap_instruction, &args, NULL);
} }
...@@ -185,8 +188,7 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p) ...@@ -185,8 +188,7 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
struct ins_replace_args args; struct ins_replace_args args;
args.ptr = p->addr; args.ptr = p->addr;
args.old = BREAKPOINT_INSTRUCTION; args.opcode = p->opcode;
args.new = p->opcode;
stop_machine(swap_instruction, &args, NULL); stop_machine(swap_instruction, &args, NULL);
} }
......
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