linux/include/asm-generic/ptrace.h
<<
>>
Prefs
   1/*
   2 * Common low level (register) ptrace helpers
   3 *
   4 * Copyright 2004-2011 Analog Devices Inc.
   5 *
   6 * Licensed under the GPL-2 or later.
   7 */
   8
   9#ifndef __ASM_GENERIC_PTRACE_H__
  10#define __ASM_GENERIC_PTRACE_H__
  11
  12#ifndef __ASSEMBLY__
  13
  14/* Helpers for working with the instruction pointer */
  15#ifndef GET_IP
  16#define GET_IP(regs) ((regs)->pc)
  17#endif
  18#ifndef SET_IP
  19#define SET_IP(regs, val) (GET_IP(regs) = (val))
  20#endif
  21
  22static inline unsigned long instruction_pointer(struct pt_regs *regs)
  23{
  24        return GET_IP(regs);
  25}
  26static inline void instruction_pointer_set(struct pt_regs *regs,
  27                                           unsigned long val)
  28{
  29        SET_IP(regs, val);
  30}
  31
  32#ifndef profile_pc
  33#define profile_pc(regs) instruction_pointer(regs)
  34#endif
  35
  36/* Helpers for working with the user stack pointer */
  37#ifndef GET_USP
  38#define GET_USP(regs) ((regs)->usp)
  39#endif
  40#ifndef SET_USP
  41#define SET_USP(regs, val) (GET_USP(regs) = (val))
  42#endif
  43
  44static inline unsigned long user_stack_pointer(struct pt_regs *regs)
  45{
  46        return GET_USP(regs);
  47}
  48static inline void user_stack_pointer_set(struct pt_regs *regs,
  49                                          unsigned long val)
  50{
  51        SET_USP(regs, val);
  52}
  53
  54/* Helpers for working with the frame pointer */
  55#ifndef GET_FP
  56#define GET_FP(regs) ((regs)->fp)
  57#endif
  58#ifndef SET_FP
  59#define SET_FP(regs, val) (GET_FP(regs) = (val))
  60#endif
  61
  62static inline unsigned long frame_pointer(struct pt_regs *regs)
  63{
  64        return GET_FP(regs);
  65}
  66static inline void frame_pointer_set(struct pt_regs *regs,
  67                                     unsigned long val)
  68{
  69        SET_FP(regs, val);
  70}
  71
  72#endif /* __ASSEMBLY__ */
  73
  74#endif
  75
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.