aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/events/uprobes.c
diff options
context:
space:
mode:
authorSrikar Dronamraju <srikar@linux.vnet.ibm.com>2012-03-12 05:25:45 -0400
committerIngo Molnar <mingo@elte.hu>2012-03-13 01:22:21 -0400
commit5cb4ac3a583d4ee18c8682ab857e093c4a0d0895 (patch)
treef11a73e9fe8d2666008f799433fde243cddd1757 /kernel/events/uprobes.c
parente3343e6a2819ff5d0dfc4bb5c9fb7f9a4d04da73 (diff)
uprobes/core: Rename bkpt to swbp
bkpt doesnt seem to be a correct abbrevation for breakpoint. Choice was between bp and breakpoint. Since bp can refer to things other than breakpoint, use swbp to refer to breakpoints. This is pure cleanup, no functional change intended. Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com> Cc: Jim Keniston <jkenisto@linux.vnet.ibm.com> Cc: Linux-mm <linux-mm@kvack.org> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Christoph Hellwig <hch@infradead.org> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Arnaldo Carvalho de Melo <acme@infradead.org> Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20120312092545.5379.91251.sendpatchset@srdronam.in.ibm.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/events/uprobes.c')
-rw-r--r--kernel/events/uprobes.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 9c5ddff1c8da..e56e56aa7535 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -170,14 +170,14 @@ out:
170} 170}
171 171
172/** 172/**
173 * is_bkpt_insn - check if instruction is breakpoint instruction. 173 * is_swbp_insn - check if instruction is breakpoint instruction.
174 * @insn: instruction to be checked. 174 * @insn: instruction to be checked.
175 * Default implementation of is_bkpt_insn 175 * Default implementation of is_swbp_insn
176 * Returns true if @insn is a breakpoint instruction. 176 * Returns true if @insn is a breakpoint instruction.
177 */ 177 */
178bool __weak is_bkpt_insn(uprobe_opcode_t *insn) 178bool __weak is_swbp_insn(uprobe_opcode_t *insn)
179{ 179{
180 return *insn == UPROBE_BKPT_INSN; 180 return *insn == UPROBE_SWBP_INSN;
181} 181}
182 182
183/* 183/*
@@ -227,7 +227,7 @@ static int write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm,
227 * adding probes in write mapped pages since the breakpoints 227 * adding probes in write mapped pages since the breakpoints
228 * might end up in the file copy. 228 * might end up in the file copy.
229 */ 229 */
230 if (!valid_vma(vma, is_bkpt_insn(&opcode))) 230 if (!valid_vma(vma, is_swbp_insn(&opcode)))
231 goto put_out; 231 goto put_out;
232 232
233 uprobe = container_of(auprobe, struct uprobe, arch); 233 uprobe = container_of(auprobe, struct uprobe, arch);
@@ -259,8 +259,8 @@ static int write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm,
259 259
260 /* poke the new insn in, ASSUMES we don't cross page boundary */ 260 /* poke the new insn in, ASSUMES we don't cross page boundary */
261 vaddr &= ~PAGE_MASK; 261 vaddr &= ~PAGE_MASK;
262 BUG_ON(vaddr + UPROBE_BKPT_INSN_SIZE > PAGE_SIZE); 262 BUG_ON(vaddr + UPROBE_SWBP_INSN_SIZE > PAGE_SIZE);
263 memcpy(vaddr_new + vaddr, &opcode, UPROBE_BKPT_INSN_SIZE); 263 memcpy(vaddr_new + vaddr, &opcode, UPROBE_SWBP_INSN_SIZE);
264 264
265 kunmap_atomic(vaddr_new); 265 kunmap_atomic(vaddr_new);
266 kunmap_atomic(vaddr_old); 266 kunmap_atomic(vaddr_old);
@@ -308,7 +308,7 @@ static int read_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_
308 lock_page(page); 308 lock_page(page);
309 vaddr_new = kmap_atomic(page); 309 vaddr_new = kmap_atomic(page);
310 vaddr &= ~PAGE_MASK; 310 vaddr &= ~PAGE_MASK;
311 memcpy(opcode, vaddr_new + vaddr, UPROBE_BKPT_INSN_SIZE); 311 memcpy(opcode, vaddr_new + vaddr, UPROBE_SWBP_INSN_SIZE);
312 kunmap_atomic(vaddr_new); 312 kunmap_atomic(vaddr_new);
313 unlock_page(page); 313 unlock_page(page);
314 314
@@ -317,7 +317,7 @@ static int read_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_
317 return 0; 317 return 0;
318} 318}
319 319
320static int is_bkpt_at_addr(struct mm_struct *mm, unsigned long vaddr) 320static int is_swbp_at_addr(struct mm_struct *mm, unsigned long vaddr)
321{ 321{
322 uprobe_opcode_t opcode; 322 uprobe_opcode_t opcode;
323 int result; 323 int result;
@@ -326,14 +326,14 @@ static int is_bkpt_at_addr(struct mm_struct *mm, unsigned long vaddr)
326 if (result) 326 if (result)
327 return result; 327 return result;
328 328
329 if (is_bkpt_insn(&opcode)) 329 if (is_swbp_insn(&opcode))
330 return 1; 330 return 1;
331 331
332 return 0; 332 return 0;
333} 333}
334 334
335/** 335/**
336 * set_bkpt - store breakpoint at a given address. 336 * set_swbp - store breakpoint at a given address.
337 * @auprobe: arch specific probepoint information. 337 * @auprobe: arch specific probepoint information.
338 * @mm: the probed process address space. 338 * @mm: the probed process address space.
339 * @vaddr: the virtual address to insert the opcode. 339 * @vaddr: the virtual address to insert the opcode.
@@ -341,18 +341,18 @@ static int is_bkpt_at_addr(struct mm_struct *mm, unsigned long vaddr)
341 * For mm @mm, store the breakpoint instruction at @vaddr. 341 * For mm @mm, store the breakpoint instruction at @vaddr.
342 * Return 0 (success) or a negative errno. 342 * Return 0 (success) or a negative errno.
343 */ 343 */
344int __weak set_bkpt(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned long vaddr) 344int __weak set_swbp(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned long vaddr)
345{ 345{
346 int result; 346 int result;
347 347
348 result = is_bkpt_at_addr(mm, vaddr); 348 result = is_swbp_at_addr(mm, vaddr);
349 if (result == 1) 349 if (result == 1)
350 return -EEXIST; 350 return -EEXIST;
351 351
352 if (result) 352 if (result)
353 return result; 353 return result;
354 354
355 return write_opcode(auprobe, mm, vaddr, UPROBE_BKPT_INSN); 355 return write_opcode(auprobe, mm, vaddr, UPROBE_SWBP_INSN);
356} 356}
357 357
358/** 358/**
@@ -371,7 +371,7 @@ set_orig_insn(struct arch_uprobe *auprobe, struct mm_struct *mm, unsigned long v
371 if (verify) { 371 if (verify) {
372 int result; 372 int result;
373 373
374 result = is_bkpt_at_addr(mm, vaddr); 374 result = is_swbp_at_addr(mm, vaddr);
375 if (!result) 375 if (!result)
376 return -EINVAL; 376 return -EINVAL;
377 377
@@ -642,7 +642,7 @@ install_breakpoint(struct uprobe *uprobe, struct mm_struct *mm,
642 if (ret) 642 if (ret)
643 return ret; 643 return ret;
644 644
645 if (is_bkpt_insn((uprobe_opcode_t *)uprobe->arch.insn)) 645 if (is_swbp_insn((uprobe_opcode_t *)uprobe->arch.insn))
646 return -EEXIST; 646 return -EEXIST;
647 647
648 ret = arch_uprobes_analyze_insn(&uprobe->arch, mm); 648 ret = arch_uprobes_analyze_insn(&uprobe->arch, mm);
@@ -651,7 +651,7 @@ install_breakpoint(struct uprobe *uprobe, struct mm_struct *mm,
651 651
652 uprobe->flags |= UPROBE_COPY_INSN; 652 uprobe->flags |= UPROBE_COPY_INSN;
653 } 653 }
654 ret = set_bkpt(&uprobe->arch, mm, addr); 654 ret = set_swbp(&uprobe->arch, mm, addr);
655 655
656 return ret; 656 return ret;
657} 657}