[FIX] __switch_to instrumentation on x86
authorNikita Kalyazin <n.kalyazin@samsung.com>
Fri, 19 Apr 2013 11:28:21 +0000 (15:28 +0400)
committerNikita Kalyazin <n.kalyazin@samsung.com>
Fri, 19 Apr 2013 11:44:13 +0000 (15:44 +0400)
commitc3aaa2488bd650e0396accc84e75c1f4de913f97
tree12c8b4dcd13b51b559384c84ca58b5c628646b5d
parentd31fb7543225b0891035d5a633ee75887e828da0
[FIX] __switch_to instrumentation on x86

What's been done here:
 - patch next task: value on top of next's stack is patched;
 - for that we need for regs structure (containing sp register);
 - it requires changing API of the following functions:
   - patch_suspended_task(): added regs argument;
   - set_task_trampoline(): task -> patch address;
   - arch_get_patch_addr() added (takes task and regs and returns
 address to patch).

Known issues:
 - x86 __switch_to instrumentation won't work at multi-core systems
   (because there is no code, that removes retprobes on user stop;
   because there is no regs argument passed to
   dbi_unregister_kretprobe());
 - I've left both old arch_get_task_pc()/arch_set_task_pc() and new
   arch_get_patch_addr() APIs.  They do rougly same things.

Tested on:
 - i386 Qemu, Buildroot rootfs, Linux kernel 3.8.2;
 - ARM Qemu, Buildroot rootfs, Linux kernel 3.8.2;
 - U1HD, GT-I8800_c210v30_cluster_20121002_1.
kprobe/arch/asm-arm/dbi_kprobes.c
kprobe/arch/asm-arm/dbi_kprobes.h
kprobe/arch/asm-x86/dbi_kprobes.c
kprobe/arch/asm-x86/dbi_kprobes.h
kprobe/arch/dbi_kprobes.h
kprobe/dbi_kprobes.c