• Masami Hiramatsu's avatar
    x86: Add pt_regs register and stack access APIs · b1cf540f
    Masami Hiramatsu authored
    Add following APIs for accessing registers and stack entries from
    pt_regs.
    These APIs are required by kprobes-based event tracer on ftrace.
    Some other debugging tools might be able to use it too.
    
    - regs_query_register_offset(const char *name)
       Query the offset of "name" register.
    
    - regs_query_register_name(unsigned int offset)
       Query the name of register by its offset.
    
    - regs_get_register(struct pt_regs *regs, unsigned int offset)
       Get the value of a register by its offset.
    
    - regs_within_kernel_stack(struct pt_regs *regs, unsigned long addr)
       Check the address is in the kernel stack.
    
    - regs_get_kernel_stack_nth(struct pt_regs *reg, unsigned int nth)
       Get Nth entry of the kernel stack. (N >= 0)
    
    - regs_get_argument_nth(struct pt_regs *reg, unsigned int nth)
       Get Nth argument at function call. (N >= 0)
    Signed-off-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
    Cc: linux-arch@vger.kernel.org
    Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
    Cc: Avi Kivity <avi@redhat.com>
    Cc: Andi Kleen <ak@linux.intel.com>
    Cc: Christoph Hellwig <hch@infradead.org>
    Cc: Frank Ch. Eigler <fche@redhat.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Jason Baron <jbaron@redhat.com>
    Cc: Jim Keniston <jkenisto@us.ibm.com>
    Cc: K.Prasad <prasad@linux.vnet.ibm.com>
    Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
    Cc: Li Zefan <lizf@cn.fujitsu.com>
    Cc: Przemysław Pawełczyk <przemyslaw@pawelczyk.it>
    Cc: Roland McGrath <roland@redhat.com>
    Cc: Sam Ravnborg <sam@ravnborg.org>
    Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Tom Zanussi <tzanussi@gmail.com>
    Cc: Vegard Nossum <vegard.nossum@gmail.com>
    LKML-Reference: <20090813203444.31965.26374.stgit@localhost.localdomain>
    Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
    b1cf540f
ptrace.h 7.4 KB