2 * SPDX-License-Identifier: CDDL 1.0
4 * Copyright 2022 Christos Margiolis <christos@FreeBSD.org>
5 * Copyright 2022 Mark Johnston <markj@FreeBSD.org>
11 #include <sys/types.h>
13 #define KINST_PATCHVAL 0xcc
16 * Each trampoline is 32 bytes long and contains [instruction, jmp]. Since we
17 * have 2 instructions stored in the trampoline, and each of them can take up
18 * to 16 bytes, 32 bytes is enough to cover even the worst case scenario.
20 #define KINST_TRAMP_SIZE 32
21 #define KINST_TRAMPCHUNK_SIZE PAGE_SIZE
22 #define KINST_TRAMP_FILL_PATTERN ((uint8_t []){KINST_PATCHVAL})
23 #define KINST_TRAMP_FILL_SIZE sizeof(uint8_t)
25 typedef uint8_t kinst_patchval_t;
27 struct kinst_probe_md {
29 int instlen; /* original instr len */
30 int tinstlen; /* trampoline instr len */
31 uint8_t template[16]; /* copied into thread tramps */
32 int dispoff; /* offset of rip displacement */
34 /* operands to "call" instruction branch target */
41 #endif /* _KINST_ISA_H_ */