xref: /DragonOS/kernel/src/process/ptrace.h (revision 1a2eaa402f05f82aaeebe1e03824534a0a425d4d)
1 #ifndef __PTRACE_H__
2 
3 #define __PTRACE_H__
4 
5 /*
6 
7 */
8 
9 struct pt_regs
10 {
11     unsigned long r15;
12     unsigned long r14;
13     unsigned long r13;
14     unsigned long r12;
15     unsigned long r11;
16     unsigned long r10;
17     unsigned long r9;
18     unsigned long r8;
19     unsigned long rbx;
20     unsigned long rcx;
21     unsigned long rdx;
22     unsigned long rsi;
23     unsigned long rdi;
24     unsigned long rbp;
25     unsigned long ds;
26     unsigned long es;
27     unsigned long rax;
28     unsigned long func;
29     unsigned long errcode;
30     unsigned long rip;
31     unsigned long cs;
32     unsigned long rflags;
33     unsigned long rsp;
34     unsigned long ss;
35 };
36 
37 /**
38  * @brief 判断pt_regs是否来自用户态
39  *
40  * @param regs
41  * @return __always_inline
42  */
43 static inline int user_mode(struct pt_regs *regs)
44 {
45     return !!(regs->cs & 3);
46 }
47 
48 #endif
49