/*1* Jprobe specific operations2*3* This program is free software; you can redistribute it and/or modify4* it under the terms of the GNU General Public License as published by5* the Free Software Foundation; either version 2 of the License, or6* (at your option) any later version.7*8* This program is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11* GNU General Public License for more details.12*13* You should have received a copy of the GNU General Public License14* along with this program; if not, write to the Free Software15* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.16*17* Copyright (C) Intel Corporation, 200518*19* 2005-May Rusty Lynch <[email protected]> and Anil S Keshavamurthy20* <[email protected]> initial implementation21*22* Jprobes (a.k.a. "jump probes" which is built on-top of kprobes) allow a23* probe to be inserted into the beginning of a function call. The fundamental24* difference between a jprobe and a kprobe is the jprobe handler is executed25* in the same context as the target function, while the kprobe handlers26* are executed in interrupt context.27*28* For jprobes we initially gain control by placing a break point in the29* first instruction of the targeted function. When we catch that specific30* break, we:31* * set the return address to our jprobe_inst_return() function32* * jump to the jprobe handler function33*34* Since we fixed up the return address, the jprobe handler will return to our35* jprobe_inst_return() function, giving us control again. At this point we36* are back in the parents frame marker, so we do yet another call to our37* jprobe_break() function to fix up the frame marker as it would normally38* exist in the target function.39*40* Our jprobe_return function then transfers control back to kprobes.c by41* executing a break instruction using one of our reserved numbers. When we42* catch that break in kprobes.c, we continue like we do for a normal kprobe43* by single stepping the emulated instruction, and then returning execution44* to the correct location.45*/46#include <asm/asmmacro.h>47#include <asm/break.h>4849/*50* void jprobe_break(void)51*/52.section .kprobes.text, "ax"53ENTRY(jprobe_break)54break.m __IA64_BREAK_JPROBE55END(jprobe_break)5657/*58* void jprobe_inst_return(void)59*/60GLOBAL_ENTRY(jprobe_inst_return)61br.call.sptk.many b0=jprobe_break62END(jprobe_inst_return)6364GLOBAL_ENTRY(invalidate_stacked_regs)65movl r16=invalidate_restore_cfm66;;67mov b6=r1668;;69br.ret.sptk.many b670;;71invalidate_restore_cfm:72mov r16=ar.rsc73;;74mov ar.rsc=r075;;76loadrs77;;78mov ar.rsc=r1679;;80br.cond.sptk.many rp81END(invalidate_stacked_regs)8283GLOBAL_ENTRY(flush_register_stack)84// flush dirty regs to backing store (must be first in insn group)85flushrs86;;87br.ret.sptk.many rp88END(flush_register_stack)89909192