• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_EXTABLE_FIXUP_TYPES_H
3 #define _ASM_X86_EXTABLE_FIXUP_TYPES_H
4 
5 /*
6  * Our IMM is signed, as such it must live at the top end of the word. Also,
7  * since C99 hex constants are of ambigious type, force cast the mask to 'int'
8  * so that FIELD_GET() will DTRT and sign extend the value when it extracts it.
9  */
10 #define EX_DATA_TYPE_MASK		((int)0x000000FF)
11 #define EX_DATA_REG_MASK		((int)0x00000F00)
12 #define EX_DATA_FLAG_MASK		((int)0x0000F000)
13 #define EX_DATA_IMM_MASK		((int)0xFFFF0000)
14 
15 #define EX_DATA_REG_SHIFT		8
16 #define EX_DATA_FLAG_SHIFT		12
17 #define EX_DATA_IMM_SHIFT		16
18 
19 #define EX_DATA_REG(reg)		((reg) << EX_DATA_REG_SHIFT)
20 #define EX_DATA_FLAG(flag)		((flag) << EX_DATA_FLAG_SHIFT)
21 #define EX_DATA_IMM(imm)		((imm) << EX_DATA_IMM_SHIFT)
22 
23 /* segment regs */
24 #define EX_REG_DS			EX_DATA_REG(8)
25 #define EX_REG_ES			EX_DATA_REG(9)
26 #define EX_REG_FS			EX_DATA_REG(10)
27 #define EX_REG_GS			EX_DATA_REG(11)
28 
29 /* flags */
30 #define EX_FLAG_CLEAR_AX		EX_DATA_FLAG(1)
31 #define EX_FLAG_CLEAR_DX		EX_DATA_FLAG(2)
32 #define EX_FLAG_CLEAR_AX_DX		EX_DATA_FLAG(3)
33 
34 /* types */
35 #define	EX_TYPE_NONE			 0
36 #define	EX_TYPE_DEFAULT			 1
37 #define	EX_TYPE_FAULT			 2
38 #define	EX_TYPE_UACCESS			 3
39 #define	EX_TYPE_COPY			 4
40 #define	EX_TYPE_CLEAR_FS		 5
41 #define	EX_TYPE_FPU_RESTORE		 6
42 #define	EX_TYPE_BPF			 7
43 #define	EX_TYPE_WRMSR			 8
44 #define	EX_TYPE_RDMSR			 9
45 #define	EX_TYPE_WRMSR_SAFE		10 /* reg := -EIO */
46 #define	EX_TYPE_RDMSR_SAFE		11 /* reg := -EIO */
47 #define	EX_TYPE_WRMSR_IN_MCE		12
48 #define	EX_TYPE_RDMSR_IN_MCE		13
49 #define	EX_TYPE_DEFAULT_MCE_SAFE	14
50 #define	EX_TYPE_FAULT_MCE_SAFE		15
51 
52 #define	EX_TYPE_POP_REG			16 /* sp += sizeof(long) */
53 #define EX_TYPE_POP_ZERO		(EX_TYPE_POP_REG | EX_DATA_IMM(0))
54 
55 #define	EX_TYPE_IMM_REG			17 /* reg := (long)imm */
56 #define	EX_TYPE_EFAULT_REG		(EX_TYPE_IMM_REG | EX_DATA_IMM(-EFAULT))
57 
58 #endif
59