Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) #ifndef __X86_KERNEL_KPROBES_COMMON_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) #define __X86_KERNEL_KPROBES_COMMON_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) /* Kprobes and Optprobes common header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) #include <asm/asm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <asm/frame.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #ifdef CONFIG_X86_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #define SAVE_REGS_STRING			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 	/* Skip cs, ip, orig_ax. */		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 	"	subq $24, %rsp\n"		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 	"	pushq %rdi\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 	"	pushq %rsi\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 	"	pushq %rdx\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 	"	pushq %rcx\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	"	pushq %rax\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	"	pushq %r8\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	"	pushq %r9\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	"	pushq %r10\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	"	pushq %r11\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	"	pushq %rbx\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	"	pushq %rbp\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	"	pushq %r12\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	"	pushq %r13\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 	"	pushq %r14\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 	"	pushq %r15\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	ENCODE_FRAME_POINTER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #define RESTORE_REGS_STRING			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	"	popq %r15\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	"	popq %r14\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	"	popq %r13\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	"	popq %r12\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	"	popq %rbp\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	"	popq %rbx\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	"	popq %r11\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	"	popq %r10\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	"	popq %r9\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	"	popq %r8\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	"	popq %rax\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	"	popq %rcx\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	"	popq %rdx\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	"	popq %rsi\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	"	popq %rdi\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	/* Skip orig_ax, ip, cs */		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	"	addq $24, %rsp\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #define SAVE_REGS_STRING			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	/* Skip cs, ip, orig_ax and gs. */	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	"	subl $4*4, %esp\n"		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	"	pushl %fs\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	"	pushl %es\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	"	pushl %ds\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	"	pushl %eax\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	"	pushl %ebp\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	"	pushl %edi\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	"	pushl %esi\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	"	pushl %edx\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	"	pushl %ecx\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	"	pushl %ebx\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	ENCODE_FRAME_POINTER
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) #define RESTORE_REGS_STRING			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	"	popl %ebx\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	"	popl %ecx\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	"	popl %edx\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	"	popl %esi\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	"	popl %edi\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	"	popl %ebp\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	"	popl %eax\n"			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	/* Skip ds, es, fs, gs, orig_ax, ip, and cs. */\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	"	addl $7*4, %esp\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) /* Ensure if the instruction can be boostable */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) extern int can_boost(struct insn *insn, void *orig_addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) /* Recover instruction if given address is probed */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) extern unsigned long recover_probed_instruction(kprobe_opcode_t *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 					 unsigned long addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85)  * Copy an instruction and adjust the displacement if the instruction
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86)  * uses the %rip-relative addressing mode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) extern int __copy_instruction(u8 *dest, u8 *src, u8 *real, struct insn *insn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) /* Generate a relative-jump/call instruction */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) extern void synthesize_reljump(void *dest, void *from, void *to);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) extern void synthesize_relcall(void *dest, void *from, void *to);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) #ifdef	CONFIG_OPTPROBES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) extern int setup_detour_execution(struct kprobe *p, struct pt_regs *regs, int reenter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) extern unsigned long __recover_optprobed_insn(kprobe_opcode_t *buf, unsigned long addr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) #else	/* !CONFIG_OPTPROBES */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) static inline int setup_detour_execution(struct kprobe *p, struct pt_regs *regs, int reenter)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) static inline unsigned long __recover_optprobed_insn(kprobe_opcode_t *buf, unsigned long addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	return addr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) #endif