| .. | .. |
|---|
| 5 | 5 | /* Kprobes and Optprobes common header */ |
|---|
| 6 | 6 | |
|---|
| 7 | 7 | #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> |
|---|
| 15 | 9 | |
|---|
| 16 | 10 | #ifdef CONFIG_X86_64 |
|---|
| 11 | + |
|---|
| 17 | 12 | #define SAVE_REGS_STRING \ |
|---|
| 18 | 13 | /* Skip cs, ip, orig_ax. */ \ |
|---|
| 19 | 14 | " subq $24, %rsp\n" \ |
|---|
| .. | .. |
|---|
| 27 | 22 | " pushq %r10\n" \ |
|---|
| 28 | 23 | " pushq %r11\n" \ |
|---|
| 29 | 24 | " pushq %rbx\n" \ |
|---|
| 30 | | - SAVE_RBP_STRING \ |
|---|
| 25 | + " pushq %rbp\n" \ |
|---|
| 31 | 26 | " pushq %r12\n" \ |
|---|
| 32 | 27 | " pushq %r13\n" \ |
|---|
| 33 | 28 | " pushq %r14\n" \ |
|---|
| 34 | | - " pushq %r15\n" |
|---|
| 29 | + " pushq %r15\n" \ |
|---|
| 30 | + ENCODE_FRAME_POINTER |
|---|
| 31 | + |
|---|
| 35 | 32 | #define RESTORE_REGS_STRING \ |
|---|
| 36 | 33 | " popq %r15\n" \ |
|---|
| 37 | 34 | " popq %r14\n" \ |
|---|
| .. | .. |
|---|
| 51 | 48 | /* Skip orig_ax, ip, cs */ \ |
|---|
| 52 | 49 | " addq $24, %rsp\n" |
|---|
| 53 | 50 | #else |
|---|
| 51 | + |
|---|
| 54 | 52 | #define SAVE_REGS_STRING \ |
|---|
| 55 | 53 | /* Skip cs, ip, orig_ax and gs. */ \ |
|---|
| 56 | | - " subl $16, %esp\n" \ |
|---|
| 54 | + " subl $4*4, %esp\n" \ |
|---|
| 57 | 55 | " pushl %fs\n" \ |
|---|
| 58 | 56 | " pushl %es\n" \ |
|---|
| 59 | 57 | " pushl %ds\n" \ |
|---|
| 60 | 58 | " pushl %eax\n" \ |
|---|
| 61 | | - SAVE_RBP_STRING \ |
|---|
| 59 | + " pushl %ebp\n" \ |
|---|
| 62 | 60 | " pushl %edi\n" \ |
|---|
| 63 | 61 | " pushl %esi\n" \ |
|---|
| 64 | 62 | " pushl %edx\n" \ |
|---|
| 65 | 63 | " pushl %ecx\n" \ |
|---|
| 66 | | - " pushl %ebx\n" |
|---|
| 64 | + " pushl %ebx\n" \ |
|---|
| 65 | + ENCODE_FRAME_POINTER |
|---|
| 66 | + |
|---|
| 67 | 67 | #define RESTORE_REGS_STRING \ |
|---|
| 68 | 68 | " popl %ebx\n" \ |
|---|
| 69 | 69 | " popl %ecx\n" \ |
|---|
| .. | .. |
|---|
| 72 | 72 | " popl %edi\n" \ |
|---|
| 73 | 73 | " popl %ebp\n" \ |
|---|
| 74 | 74 | " 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" |
|---|
| 77 | 77 | #endif |
|---|
| 78 | 78 | |
|---|
| 79 | 79 | /* Ensure if the instruction can be boostable */ |
|---|