Commit | Line | Data |
---|---|---|
867e359b CM |
1 | /* |
2 | * Copyright 2010 Tilera Corporation. All Rights Reserved. | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or | |
5 | * modify it under the terms of the GNU General Public License | |
6 | * as published by the Free Software Foundation, version 2. | |
7 | * | |
8 | * This program is distributed in the hope that it will be useful, but | |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | |
11 | * NON INFRINGEMENT. See the GNU General Public License for | |
12 | * more details. | |
13 | */ | |
867e359b CM |
14 | #ifndef _ASM_TILE_PTRACE_H |
15 | #define _ASM_TILE_PTRACE_H | |
16 | ||
df842f79 | 17 | #include <linux/compiler.h> |
867e359b CM |
18 | |
19 | #ifndef __ASSEMBLY__ | |
867e359b CM |
20 | /* Benefit from consistent use of "long" on all chips. */ |
21 | typedef unsigned long pt_reg_t; | |
867e359b | 22 | #endif |
867e359b | 23 | |
df842f79 | 24 | #include <uapi/asm/ptrace.h> |
867e359b | 25 | |
867e359b | 26 | #define PTRACE_O_MASK_TILE (PTRACE_O_TRACEMIGRATE) |
395e095e | 27 | #define PT_TRACE_MIGRATE PT_EVENT_FLAG(PTRACE_EVENT_MIGRATE) |
867e359b | 28 | |
74fca9da CM |
29 | /* Flag bits in pt_regs.flags */ |
30 | #define PT_FLAGS_DISABLE_IRQ 1 /* on return to kernel, disable irqs */ | |
31 | #define PT_FLAGS_CALLER_SAVES 2 /* caller-save registers are valid */ | |
32 | #define PT_FLAGS_RESTORE_REGS 4 /* restore callee-save regs on return */ | |
33 | ||
867e359b CM |
34 | #ifndef __ASSEMBLY__ |
35 | ||
3fa17c39 | 36 | #define regs_return_value(regs) ((regs)->regs[0]) |
867e359b CM |
37 | #define instruction_pointer(regs) ((regs)->pc) |
38 | #define profile_pc(regs) instruction_pointer(regs) | |
5208ba24 | 39 | #define user_stack_pointer(regs) ((regs)->sp) |
867e359b CM |
40 | |
41 | /* Does the process account for user or for system time? */ | |
42 | #define user_mode(regs) (EX1_PL((regs)->ex1) == USER_PL) | |
43 | ||
44 | /* Fill in a struct pt_regs with the current kernel registers. */ | |
45 | struct pt_regs *get_pt_regs(struct pt_regs *); | |
46 | ||
0707ad30 | 47 | /* Trace the current syscall. */ |
ef182724 SM |
48 | extern int do_syscall_trace_enter(struct pt_regs *regs); |
49 | extern void do_syscall_trace_exit(struct pt_regs *regs); | |
0707ad30 | 50 | |
867e359b CM |
51 | #define arch_has_single_step() (1) |
52 | ||
53 | /* | |
54 | * A structure for all single-stepper state. | |
55 | * | |
56 | * Also update defines in assembler section if it changes | |
57 | */ | |
58 | struct single_step_state { | |
59 | /* the page to which we will write hacked-up bundles */ | |
0707ad30 | 60 | void __user *buffer; |
867e359b CM |
61 | |
62 | union { | |
63 | int flags; | |
64 | struct { | |
65 | unsigned long is_enabled:1, update:1, update_reg:6; | |
66 | }; | |
67 | }; | |
68 | ||
69 | unsigned long orig_pc; /* the original PC */ | |
70 | unsigned long next_pc; /* return PC if no branch (PC + 1) */ | |
71 | unsigned long branch_next_pc; /* return PC if we did branch/jump */ | |
72 | unsigned long update_value; /* value to restore to update_target */ | |
73 | }; | |
74 | ||
75 | /* Single-step the instruction at regs->pc */ | |
76 | extern void single_step_once(struct pt_regs *regs); | |
77 | ||
04f7a3f1 CM |
78 | /* Clean up after execve(). */ |
79 | extern void single_step_execve(void); | |
80 | ||
867e359b CM |
81 | struct task_struct; |
82 | ||
2f9ac29e | 83 | extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs); |
867e359b CM |
84 | |
85 | #ifdef __tilegx__ | |
86 | /* We need this since sigval_t has a user pointer in it, for GETSIGINFO etc. */ | |
87 | #define __ARCH_WANT_COMPAT_SYS_PTRACE | |
88 | #endif | |
89 | ||
90 | #endif /* !__ASSEMBLY__ */ | |
91 | ||
92 | #define SINGLESTEP_STATE_MASK_IS_ENABLED 0x1 | |
93 | #define SINGLESTEP_STATE_MASK_UPDATE 0x2 | |
94 | #define SINGLESTEP_STATE_TARGET_LB 2 | |
95 | #define SINGLESTEP_STATE_TARGET_UB 7 | |
96 | ||
867e359b | 97 | #endif /* _ASM_TILE_PTRACE_H */ |