/*1* include/asm-xtensa/ptrace.h2*3* This file is subject to the terms and conditions of the GNU General Public4* License. See the file "COPYING" in the main directory of this archive5* for more details.6*7* Copyright (C) 2001 - 2005 Tensilica Inc.8*/9#ifndef _XTENSA_PTRACE_H10#define _XTENSA_PTRACE_H1112#include <asm/kmem_layout.h>13#include <uapi/asm/ptrace.h>1415/*16* Kernel stack17*18* +-----------------------+ -------- STACK_SIZE19* | register file | |20* +-----------------------+ |21* | struct pt_regs | |22* +-----------------------+ | ------ PT_REGS_OFFSET23* double : 16 bytes spill area : | ^24* excetion :- - - - - - - - - - - -: | |25* frame : struct pt_regs : | |26* :- - - - - - - - - - - -: | |27* | | | |28* | memory stack | | |29* | | | |30* ~ ~ ~ ~31* ~ ~ ~ ~32* | | | |33* | | | |34* +-----------------------+ | | --- STACK_BIAS35* | struct task_struct | | | ^36* current --> +-----------------------+ | | |37* | struct thread_info | | | |38* +-----------------------+ --------39*/4041#define NO_SYSCALL (-1)4243#ifndef __ASSEMBLER__4445#include <asm/coprocessor.h>46#include <asm/core.h>4748/*49* This struct defines the way the registers are stored on the50* kernel stack during a system call or other kernel entry.51*/52struct pt_regs {53unsigned long pc; /* 4 */54unsigned long ps; /* 8 */55unsigned long depc; /* 12 */56unsigned long exccause; /* 16 */57unsigned long excvaddr; /* 20 */58unsigned long debugcause; /* 24 */59unsigned long wmask; /* 28 */60unsigned long lbeg; /* 32 */61unsigned long lend; /* 36 */62unsigned long lcount; /* 40 */63unsigned long sar; /* 44 */64unsigned long windowbase; /* 48 */65unsigned long windowstart; /* 52 */66unsigned long syscall; /* 56 */67unsigned long icountlevel; /* 60 */68unsigned long scompare1; /* 64 */69unsigned long threadptr; /* 68 */7071/* Additional configurable registers that are used by the compiler. */72xtregs_opt_t xtregs_opt;7374/* current register frame.75* Note: The ESF for kernel exceptions ends after 16 registers!76*/77unsigned long areg[XCHAL_NUM_AREGS] __aligned(16);78};7980# define arch_has_single_step() (1)81# define task_pt_regs(tsk) ((struct pt_regs*) \82(task_stack_page(tsk) + KERNEL_STACK_SIZE) - 1)83# define user_mode(regs) (((regs)->ps & 0x00000020)!=0)84# define instruction_pointer(regs) ((regs)->pc)85# define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \86(regs)->pc))8788# ifndef CONFIG_SMP89# define profile_pc(regs) instruction_pointer(regs)90# else91# define profile_pc(regs) \92({ \93in_lock_functions(instruction_pointer(regs)) ? \94return_pointer(regs) : instruction_pointer(regs); \95})96# endif9798#define user_stack_pointer(regs) ((regs)->areg[1])99100static inline unsigned long regs_return_value(struct pt_regs *regs)101{102return regs->areg[2];103}104105int do_syscall_trace_enter(struct pt_regs *regs);106void do_syscall_trace_leave(struct pt_regs *regs);107108#else /* __ASSEMBLER__ */109110# include <asm/asm-offsets.h>111#define PT_REGS_OFFSET (KERNEL_STACK_SIZE - PT_USER_SIZE)112113#endif /* !__ASSEMBLER__ */114115#endif /* _XTENSA_PTRACE_H */116117118