Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 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 | */ |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 10 | #ifndef _XTENSA_PTRACE_H |
| 11 | #define _XTENSA_PTRACE_H |
| 12 | |
David Howells | 8359672 | 2012-10-15 03:55:40 +0400 | [diff] [blame] | 13 | #include <uapi/asm/ptrace.h> |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 14 | |
Chris Zankel | c658eac | 2008-02-12 13:17:07 -0800 | [diff] [blame] | 15 | |
Adrian Bunk | f22ab81 | 2008-07-25 01:47:34 -0700 | [diff] [blame] | 16 | #ifndef __ASSEMBLY__ |
| 17 | |
Chris Zankel | 4573e39 | 2010-05-02 01:05:13 -0700 | [diff] [blame] | 18 | #include <asm/coprocessor.h> |
| 19 | |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 20 | /* |
| 21 | * This struct defines the way the registers are stored on the |
| 22 | * kernel stack during a system call or other kernel entry. |
| 23 | */ |
| 24 | struct 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 Zankel | 29c4dfd | 2007-05-31 17:49:32 -0700 | [diff] [blame] | 39 | unsigned long icountlevel; /* 60 */ |
Max Filippov | 733536b | 2012-11-15 06:25:48 +0400 | [diff] [blame] | 40 | unsigned long scompare1; /* 64 */ |
Chris Zankel | c50842d | 2013-02-23 19:35:57 -0800 | [diff] [blame] | 41 | unsigned long threadptr; /* 68 */ |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 42 | |
Chris Zankel | c658eac | 2008-02-12 13:17:07 -0800 | [diff] [blame] | 43 | /* Additional configurable registers that are used by the compiler. */ |
| 44 | xtregs_opt_t xtregs_opt; |
| 45 | |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 46 | /* 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 Zankel | c50842d | 2013-02-23 19:35:57 -0800 | [diff] [blame] | 52 | unsigned long areg[16]; |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 53 | }; |
| 54 | |
Chris Zankel | 367b811 | 2008-11-06 06:40:46 -0800 | [diff] [blame] | 55 | #include <variant/core.h> |
Chris Zankel | de4f6e5 | 2007-05-31 17:47:01 -0700 | [diff] [blame] | 56 | |
Christoph Hellwig | 6d75ca1 | 2010-03-10 15:22:57 -0800 | [diff] [blame] | 57 | # define arch_has_single_step() (1) |
Al Viro | 04fe6fa | 2006-01-12 01:05:50 -0800 | [diff] [blame] | 58 | # define task_pt_regs(tsk) ((struct pt_regs*) \ |
Chris Zankel | c4c4594 | 2012-11-28 16:53:51 -0800 | [diff] [blame] | 59 | (task_stack_page(tsk) + KERNEL_STACK_SIZE - (XCHAL_NUM_AREGS-16)*4) - 1) |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 60 | # define user_mode(regs) (((regs)->ps & 0x00000020)!=0) |
| 61 | # define instruction_pointer(regs) ((regs)->pc) |
Max Filippov | f615136 | 2013-10-17 02:42:26 +0400 | [diff] [blame] | 62 | # define return_pointer(regs) (MAKE_PC_FROM_RA((regs)->areg[0], \ |
| 63 | (regs)->areg[1])) |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 64 | |
| 65 | # ifndef CONFIG_SMP |
| 66 | # define profile_pc(regs) instruction_pointer(regs) |
Max Filippov | f615136 | 2013-10-17 02:42:26 +0400 | [diff] [blame] | 67 | # else |
| 68 | # define profile_pc(regs) \ |
| 69 | ({ \ |
| 70 | in_lock_functions(instruction_pointer(regs)) ? \ |
| 71 | return_pointer(regs) : instruction_pointer(regs); \ |
| 72 | }) |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 73 | # endif |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 74 | |
Al Viro | 5208ba2 | 2012-12-14 01:50:19 -0500 | [diff] [blame] | 75 | #define user_stack_pointer(regs) ((regs)->areg[1]) |
| 76 | |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 77 | #else /* __ASSEMBLY__ */ |
| 78 | |
Sam Ravnborg | 0013a85 | 2005-09-09 20:57:26 +0200 | [diff] [blame] | 79 | # include <asm/asm-offsets.h> |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 80 | #define PT_REGS_OFFSET (KERNEL_STACK_SIZE - PT_USER_SIZE) |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 81 | |
| 82 | #endif /* !__ASSEMBLY__ */ |
Adrian Bunk | f22ab81 | 2008-07-25 01:47:34 -0700 | [diff] [blame] | 83 | |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 84 | #endif /* _XTENSA_PTRACE_H */ |