opt.c (1c5ba67d2277ac2faf37c61076e8b5fa312be492) | opt.c (3c88c692c28746473791276f8b42d2c989d6cbe6) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * Kernel Probes Jump Optimization (Optprobes) 4 * 5 * Copyright (C) IBM Corporation, 2002, 2004 6 * Copyright (C) Hitachi Ltd., 2012 7 */ 8#include <linux/kprobes.h> --- 88 unchanged lines hidden (view full) --- 97 ".global optprobe_template_val\n" 98 "optprobe_template_val:\n" 99 ASM_NOP5 100 ASM_NOP5 101 ".global optprobe_template_call\n" 102 "optprobe_template_call:\n" 103 ASM_NOP5 104 /* Move flags to rsp */ | 1// SPDX-License-Identifier: GPL-2.0-or-later 2/* 3 * Kernel Probes Jump Optimization (Optprobes) 4 * 5 * Copyright (C) IBM Corporation, 2002, 2004 6 * Copyright (C) Hitachi Ltd., 2012 7 */ 8#include <linux/kprobes.h> --- 88 unchanged lines hidden (view full) --- 97 ".global optprobe_template_val\n" 98 "optprobe_template_val:\n" 99 ASM_NOP5 100 ASM_NOP5 101 ".global optprobe_template_call\n" 102 "optprobe_template_call:\n" 103 ASM_NOP5 104 /* Move flags to rsp */ |
105 " movq 144(%rsp), %rdx\n" 106 " movq %rdx, 152(%rsp)\n" | 105 " movq 18*8(%rsp), %rdx\n" 106 " movq %rdx, 19*8(%rsp)\n" |
107 RESTORE_REGS_STRING 108 /* Skip flags entry */ 109 " addq $8, %rsp\n" 110 " popfq\n" 111#else /* CONFIG_X86_32 */ | 107 RESTORE_REGS_STRING 108 /* Skip flags entry */ 109 " addq $8, %rsp\n" 110 " popfq\n" 111#else /* CONFIG_X86_32 */ |
112 " pushf\n" | 112 " pushl %esp\n" 113 " pushfl\n" |
113 SAVE_REGS_STRING 114 " movl %esp, %edx\n" 115 ".global optprobe_template_val\n" 116 "optprobe_template_val:\n" 117 ASM_NOP5 118 ".global optprobe_template_call\n" 119 "optprobe_template_call:\n" 120 ASM_NOP5 | 114 SAVE_REGS_STRING 115 " movl %esp, %edx\n" 116 ".global optprobe_template_val\n" 117 "optprobe_template_val:\n" 118 ASM_NOP5 119 ".global optprobe_template_call\n" 120 "optprobe_template_call:\n" 121 ASM_NOP5 |
122 /* Move flags into esp */ 123 " movl 14*4(%esp), %edx\n" 124 " movl %edx, 15*4(%esp)\n" |
|
121 RESTORE_REGS_STRING | 125 RESTORE_REGS_STRING |
122 " addl $4, %esp\n" /* skip cs */ 123 " popf\n" | 126 /* Skip flags entry */ 127 " addl $4, %esp\n" 128 " popfl\n" |
124#endif 125 ".global optprobe_template_end\n" 126 "optprobe_template_end:\n" 127 ".popsection\n"); 128 129void optprobe_template_func(void); 130STACK_FRAME_NON_STANDARD(optprobe_template_func); 131 --- 15 unchanged lines hidden (view full) --- 147 return; 148 149 preempt_disable(); 150 if (kprobe_running()) { 151 kprobes_inc_nmissed_count(&op->kp); 152 } else { 153 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 154 /* Save skipped registers */ | 129#endif 130 ".global optprobe_template_end\n" 131 "optprobe_template_end:\n" 132 ".popsection\n"); 133 134void optprobe_template_func(void); 135STACK_FRAME_NON_STANDARD(optprobe_template_func); 136 --- 15 unchanged lines hidden (view full) --- 152 return; 153 154 preempt_disable(); 155 if (kprobe_running()) { 156 kprobes_inc_nmissed_count(&op->kp); 157 } else { 158 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 159 /* Save skipped registers */ |
155#ifdef CONFIG_X86_64 | |
156 regs->cs = __KERNEL_CS; | 160 regs->cs = __KERNEL_CS; |
157#else 158 regs->cs = __KERNEL_CS | get_kernel_rpl(); | 161#ifdef CONFIG_X86_32 162 regs->cs |= get_kernel_rpl(); |
159 regs->gs = 0; 160#endif 161 regs->ip = (unsigned long)op->kp.addr + INT3_SIZE; 162 regs->orig_ax = ~0UL; 163 164 __this_cpu_write(current_kprobe, &op->kp); 165 kcb->kprobe_status = KPROBE_HIT_ACTIVE; 166 opt_pre_handler(&op->kp, regs); --- 319 unchanged lines hidden --- | 163 regs->gs = 0; 164#endif 165 regs->ip = (unsigned long)op->kp.addr + INT3_SIZE; 166 regs->orig_ax = ~0UL; 167 168 __this_cpu_write(current_kprobe, &op->kp); 169 kcb->kprobe_status = KPROBE_HIT_ACTIVE; 170 opt_pre_handler(&op->kp, regs); --- 319 unchanged lines hidden --- |