]>
git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - include/asm-x86/ptrace.h
1 #ifndef _ASM_X86_PTRACE_H
2 #define _ASM_X86_PTRACE_H
4 #include <linux/compiler.h> /* For __user */
5 #include <asm/ptrace-abi.h>
11 /* this struct defines the way the registers are stored on the
12 stack during a system call. */
36 #else /* __KERNEL__ */
59 #include <asm/segment.h>
61 #endif /* __KERNEL__ */
74 /* arguments: non interrupts/non tracing syscalls only save upto here*/
84 unsigned long orig_rax
;
85 /* end of arguments */
86 /* cpu exception frame or undefined */
92 /* top of stack page */
95 #else /* __KERNEL__ */
104 /* arguments: non interrupts/non tracing syscalls only save upto here*/
114 unsigned long orig_ax
;
115 /* end of arguments */
116 /* cpu exception frame or undefined */
122 /* top of stack page */
125 #endif /* __KERNEL__ */
126 #endif /* !__i386__ */
130 /* the DS BTS struct is used for ptrace as well */
135 extern void ptrace_bts_take_timestamp(struct task_struct
*, enum bts_qualifier
);
137 extern unsigned long profile_pc(struct pt_regs
*regs
);
140 convert_ip_to_linear(struct task_struct
*child
, struct pt_regs
*regs
);
143 extern void send_sigtrap(struct task_struct
*tsk
, struct pt_regs
*regs
, int error_code
);
145 void signal_fault(struct pt_regs
*regs
, void __user
*frame
, char *where
);
148 #define regs_return_value(regs) ((regs)->ax)
151 * user_mode_vm(regs) determines whether a register set came from user mode.
152 * This is true if V8086 mode was enabled OR if the register set was from
153 * protected mode with RPL-3 CS value. This tricky test checks that with
154 * one comparison. Many places in the kernel can bypass this full check
155 * if they have already ruled out V8086 mode, so user_mode(regs) can be used.
157 static inline int user_mode(struct pt_regs
*regs
)
160 return (regs
->cs
& SEGMENT_RPL_MASK
) == USER_RPL
;
162 return !!(regs
->cs
& 3);
166 static inline int user_mode_vm(struct pt_regs
*regs
)
169 return ((regs
->cs
& SEGMENT_RPL_MASK
) |
170 (regs
->flags
& VM_MASK
)) >= USER_RPL
;
172 return user_mode(regs
);
176 static inline int v8086_mode(struct pt_regs
*regs
)
179 return (regs
->flags
& VM_MASK
);
181 return 0; /* No V86 mode support in long mode */
186 * X86_32 CPUs don't save ss and esp if the CPU is already in kernel mode
187 * when it traps. So regs will be the current sp.
189 * This is valid only for kernel mode traps.
191 static inline unsigned long kernel_trap_sp(struct pt_regs
*regs
)
194 return (unsigned long)regs
;
200 static inline unsigned long instruction_pointer(struct pt_regs
*regs
)
205 static inline unsigned long frame_pointer(struct pt_regs
*regs
)
211 * These are defined as per linux/ptrace.h, which see.
213 #define arch_has_single_step() (1)
214 extern void user_enable_single_step(struct task_struct
*);
215 extern void user_disable_single_step(struct task_struct
*);
217 extern void user_enable_block_step(struct task_struct
*);
218 #ifdef CONFIG_X86_DEBUGCTLMSR
219 #define arch_has_block_step() (1)
221 #define arch_has_block_step() (boot_cpu_data.x86 >= 6)
225 extern int do_get_thread_area(struct task_struct
*p
, int idx
,
226 struct user_desc __user
*info
);
227 extern int do_set_thread_area(struct task_struct
*p
, int idx
,
228 struct user_desc __user
*info
, int can_allocate
);
230 #endif /* __KERNEL__ */
232 #endif /* !__ASSEMBLY__ */