blob: 598e752dcbcd009392230869af2851afd14e4085 [file] [log] [blame]
Chris Zankel9a8fd552005-06-23 22:01:26 -07001/*
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 */
Chris Zankel9a8fd552005-06-23 22:01:26 -070010#ifndef _XTENSA_PTRACE_H
11#define _XTENSA_PTRACE_H
12
David Howells83596722012-10-15 03:55:40 +040013#include <uapi/asm/ptrace.h>
Chris Zankel9a8fd552005-06-23 22:01:26 -070014
Chris Zankelc658eac2008-02-12 13:17:07 -080015
Adrian Bunkf22ab812008-07-25 01:47:34 -070016#ifndef __ASSEMBLY__
17
Chris Zankel4573e392010-05-02 01:05:13 -070018#include <asm/coprocessor.h>
19
Chris Zankel9a8fd552005-06-23 22:01:26 -070020/*
21 * This struct defines the way the registers are stored on the
22 * kernel stack during a system call or other kernel entry.
23 */
24struct pt_regs {
25 unsigned long pc; /* 4 */
26 unsigned long ps; /* 8 */
27 unsigned long depc; /* 12 */
28 unsigned long exccause; /* 16 */
29 unsigned long excvaddr; /* 20 */
30 unsigned long debugcause; /* 24 */
31 unsigned long wmask; /* 28 */
32 unsigned long lbeg; /* 32 */
33 unsigned long lend; /* 36 */
34 unsigned long lcount; /* 40 */
35 unsigned long sar; /* 44 */
36 unsigned long windowbase; /* 48 */
37 unsigned long windowstart; /* 52 */
38 unsigned long syscall; /* 56 */
Chris Zankel29c4dfd2007-05-31 17:49:32 -070039 unsigned long icountlevel; /* 60 */
Max Filippov733536b2012-11-15 06:25:48 +040040 unsigned long scompare1; /* 64 */
Chris Zankelc50842d2013-02-23 19:35:57 -080041 unsigned long threadptr; /* 68 */
Chris Zankel9a8fd552005-06-23 22:01:26 -070042
Chris Zankelc658eac2008-02-12 13:17:07 -080043 /* Additional configurable registers that are used by the compiler. */
44 xtregs_opt_t xtregs_opt;
45
Chris Zankel9a8fd552005-06-23 22:01:26 -070046 /* Make sure the areg field is 16 bytes aligned. */
47 int align[0] __attribute__ ((aligned(16)));
48
49 /* current register frame.
50 * Note: The ESF for kernel exceptions ends after 16 registers!
51 */
Chris Zankelc50842d2013-02-23 19:35:57 -080052 unsigned long areg[16];
Chris Zankel9a8fd552005-06-23 22:01:26 -070053};
54
Chris Zankel367b8112008-11-06 06:40:46 -080055#include <variant/core.h>
Chris Zankelde4f6e52007-05-31 17:47:01 -070056
Christoph Hellwig6d75ca12010-03-10 15:22:57 -080057# define arch_has_single_step() (1)
Al Viro04fe6fa2006-01-12 01:05:50 -080058# define task_pt_regs(tsk) ((struct pt_regs*) \
Chris Zankelc4c45942012-11-28 16:53:51 -080059 (task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1)
Chris Zankel9a8fd552005-06-23 22:01:26 -070060# define user_mode(regs) (((regs)->ps & 0x00000020)!=0)
61# define instruction_pointer(regs) ((regs)->pc)
Max Filippovf6151362013-10-17 02:42:26 +040062# define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \
63 (regs)->areg[1]))
Chris Zankel9a8fd552005-06-23 22:01:26 -070064
65# ifndef CONFIG_SMP
66# define profile_pc(regs) instruction_pointer(regs)
Max Filippovf6151362013-10-17 02:42:26 +040067# else
68# define profile_pc(regs) \
69 ({ \
70 in_lock_functions(instruction_pointer(regs)) ? \
71 return_pointer(regs) : instruction_pointer(regs); \
72 })
Chris Zankel9a8fd552005-06-23 22:01:26 -070073# endif
Chris Zankel9a8fd552005-06-23 22:01:26 -070074
Al Viro5208ba22012-12-14 01:50:19 -050075#define user_stack_pointer(regs) ((regs)->areg[1])
76
Chris Zankel9a8fd552005-06-23 22:01:26 -070077#else /* __ASSEMBLY__ */
78
Sam Ravnborg0013a852005-09-09 20:57:26 +020079# include <asm/asm-offsets.h>
Chris Zankel9a8fd552005-06-23 22:01:26 -070080#define PT_REGS_OFFSET (KERNEL_STACK_SIZE - PT_USER_SIZE)
Chris Zankel9a8fd552005-06-23 22:01:26 -070081
82#endif /* !__ASSEMBLY__ */
Adrian Bunkf22ab812008-07-25 01:47:34 -070083
Chris Zankel9a8fd552005-06-23 22:01:26 -070084#endif /* _XTENSA_PTRACE_H */