forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 ee930fffee469d076998274a2ca55e13dc1efb67
kernel/arch/x86/kernel/kprobes/common.h
....@@ -5,15 +5,10 @@
55 /* Kprobes and Optprobes common header */
66
77 #include <asm/asm.h>
8
-
9
-#ifdef CONFIG_FRAME_POINTER
10
-# define SAVE_RBP_STRING " push %" _ASM_BP "\n" \
11
- " mov %" _ASM_SP ", %" _ASM_BP "\n"
12
-#else
13
-# define SAVE_RBP_STRING " push %" _ASM_BP "\n"
14
-#endif
8
+#include <asm/frame.h>
159
1610 #ifdef CONFIG_X86_64
11
+
1712 #define SAVE_REGS_STRING \
1813 /* Skip cs, ip, orig_ax. */ \
1914 " subq $24, %rsp\n" \
....@@ -27,11 +22,13 @@
2722 " pushq %r10\n" \
2823 " pushq %r11\n" \
2924 " pushq %rbx\n" \
30
- SAVE_RBP_STRING \
25
+ " pushq %rbp\n" \
3126 " pushq %r12\n" \
3227 " pushq %r13\n" \
3328 " pushq %r14\n" \
34
- " pushq %r15\n"
29
+ " pushq %r15\n" \
30
+ ENCODE_FRAME_POINTER
31
+
3532 #define RESTORE_REGS_STRING \
3633 " popq %r15\n" \
3734 " popq %r14\n" \
....@@ -51,19 +48,22 @@
5148 /* Skip orig_ax, ip, cs */ \
5249 " addq $24, %rsp\n"
5350 #else
51
+
5452 #define SAVE_REGS_STRING \
5553 /* Skip cs, ip, orig_ax and gs. */ \
56
- " subl $16, %esp\n" \
54
+ " subl $4*4, %esp\n" \
5755 " pushl %fs\n" \
5856 " pushl %es\n" \
5957 " pushl %ds\n" \
6058 " pushl %eax\n" \
61
- SAVE_RBP_STRING \
59
+ " pushl %ebp\n" \
6260 " pushl %edi\n" \
6361 " pushl %esi\n" \
6462 " pushl %edx\n" \
6563 " pushl %ecx\n" \
66
- " pushl %ebx\n"
64
+ " pushl %ebx\n" \
65
+ ENCODE_FRAME_POINTER
66
+
6767 #define RESTORE_REGS_STRING \
6868 " popl %ebx\n" \
6969 " popl %ecx\n" \
....@@ -72,8 +72,8 @@
7272 " popl %edi\n" \
7373 " popl %ebp\n" \
7474 " popl %eax\n" \
75
- /* Skip ds, es, fs, gs, orig_ax, and ip. Note: don't pop cs here*/\
76
- " addl $24, %esp\n"
75
+ /* Skip ds, es, fs, gs, orig_ax, ip, and cs. */\
76
+ " addl $7*4, %esp\n"
7777 #endif
7878
7979 /* Ensure if the instruction can be boostable */