| 1 |
/* |
| 2 |
* include/asm-xtensa/ptrace.h |
| 3 |
* |
| 4 |
* This file is subject to the terms and conditions of the GNU General Public |
| 5 |
* License. See the file "COPYING" in the main directory of this archive |
| 6 |
* for more details. |
| 7 |
* |
| 8 |
* Copyright (C) 2001 - 2005 Tensilica Inc. |
| 9 |
*/ |
| 10 |
#ifndef _XTENSA_PTRACE_H |
| 11 |
#define _XTENSA_PTRACE_H |
| 12 |
|
| 13 |
#include <asm/kmem_layout.h> |
| 14 |
#include <uapi/asm/ptrace.h> |
| 15 |
|
| 16 |
/* |
| 17 |
* Kernel stack |
| 18 |
* |
| 19 |
* +-----------------------+ -------- STACK_SIZE |
| 20 |
* | register file | | |
| 21 |
* +-----------------------+ | |
| 22 |
* | struct pt_regs | | |
| 23 |
* +-----------------------+ | ------ PT_REGS_OFFSET |
| 24 |
* double : 16 bytes spill area : | ^ |
| 25 |
* excetion :- - - - - - - - - - - -: | | |
| 26 |
* frame : struct pt_regs : | | |
| 27 |
* :- - - - - - - - - - - -: | | |
| 28 |
* | | | | |
| 29 |
* | memory stack | | | |
| 30 |
* | | | | |
| 31 |
* ~ ~ ~ ~ |
| 32 |
* ~ ~ ~ ~ |
| 33 |
* | | | | |
| 34 |
* | | | | |
| 35 |
* +-----------------------+ | | --- STACK_BIAS |
| 36 |
* | struct task_struct | | | ^ |
| 37 |
* current --> +-----------------------+ | | | |
| 38 |
* | struct thread_info | | | | |
| 39 |
* +-----------------------+ -------- |
| 40 |
*/ |
| 41 |
|
| 42 |
#define NO_SYSCALL (-1) |
| 43 |
|
| 44 |
#ifndef __ASSEMBLER__ |
| 45 |
|
| 46 |
#include <asm/coprocessor.h> |
| 47 |
#include <asm/core.h> |
| 48 |
|
| 49 |
/* |
| 50 |
* This struct defines the way the registers are stored on the |
| 51 |
* kernel stack during a system call or other kernel entry. |
| 52 |
*/ |
| 53 |
struct pt_regs { |
| 54 |
unsigned long pc; /* 4 */ |
| 55 |
unsigned long ps; /* 8 */ |
| 56 |
unsigned long depc; /* 12 */ |
| 57 |
unsigned long exccause; /* 16 */ |
| 58 |
unsigned long excvaddr; /* 20 */ |
| 59 |
unsigned long debugcause; /* 24 */ |
| 60 |
unsigned long wmask; /* 28 */ |
| 61 |
unsigned long lbeg; /* 32 */ |
| 62 |
unsigned long lend; /* 36 */ |
| 63 |
unsigned long lcount; /* 40 */ |
| 64 |
unsigned long sar; /* 44 */ |
| 65 |
unsigned long windowbase; /* 48 */ |
| 66 |
unsigned long windowstart; /* 52 */ |
| 67 |
unsigned long syscall; /* 56 */ |
| 68 |
unsigned long icountlevel; /* 60 */ |
| 69 |
unsigned long scompare1; /* 64 */ |
| 70 |
unsigned long threadptr; /* 68 */ |
| 71 |
|
| 72 |
/* Additional configurable registers that are used by the compiler. */ |
| 73 |
xtregs_opt_t xtregs_opt; |
| 74 |
|
| 75 |
/* current register frame. |
| 76 |
* Note: The ESF for kernel exceptions ends after 16 registers! |
| 77 |
*/ |
| 78 |
unsigned long areg[XCHAL_NUM_AREGS] __aligned(16); |
| 79 |
}; |
| 80 |
|
| 81 |
# define arch_has_single_step() (1) |
| 82 |
# define task_pt_regs(tsk) ((struct pt_regs*) \ |
| 83 |
(task_stack_page(tsk) + KERNEL_STACK_SIZE) - 1) |
| 84 |
# define user_mode(regs) (((regs)->ps & 0x00000020)!=0) |
| 85 |
# define instruction_pointer(regs) ((regs)->pc) |
| 86 |
# define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \ |
| 87 |
(regs)->pc)) |
| 88 |
|
| 89 |
# ifndef CONFIG_SMP |
| 90 |
# define profile_pc(regs) instruction_pointer(regs) |
| 91 |
# else |
| 92 |
# define profile_pc(regs) \ |
| 93 |
({ \ |
| 94 |
in_lock_functions(instruction_pointer(regs)) ? \ |
| 95 |
return_pointer(regs) : instruction_pointer(regs); \ |
| 96 |
}) |
| 97 |
# endif |
| 98 |
|
| 99 |
#define user_stack_pointer(regs) ((regs)->areg[1]) |
| 100 |
|
| 101 |
static inline unsigned long regs_return_value(struct pt_regs *regs) |
| 102 |
{ |
| 103 |
return regs->areg[2]; |
| 104 |
} |
| 105 |
|
| 106 |
int do_syscall_trace_enter(struct pt_regs *regs); |
| 107 |
void do_syscall_trace_leave(struct pt_regs *regs); |
| 108 |
|
| 109 |
#else /* __ASSEMBLER__ */ |
| 110 |
|
| 111 |
# include <asm/asm-offsets.h> |
| 112 |
#define PT_REGS_OFFSET (KERNEL_STACK_SIZE - PT_USER_SIZE) |
| 113 |
|
| 114 |
#endif /* !__ASSEMBLER__ */ |
| 115 |
|
| 116 |
#endif /* _XTENSA_PTRACE_H */ |