x86, mpx: Decode MPX instruction to get bound violation information
[deliverable/linux.git] / arch / x86 / include / asm / mpx.h
1 #ifndef _ASM_X86_MPX_H
2 #define _ASM_X86_MPX_H
3
4 #include <linux/types.h>
5 #include <asm/ptrace.h>
6 #include <asm/insn.h>
7
8 #ifdef CONFIG_X86_64
9
10 /* upper 28 bits [47:20] of the virtual address in 64-bit used to
11 * index into bounds directory (BD).
12 */
13 #define MPX_BD_ENTRY_OFFSET 28
14 #define MPX_BD_ENTRY_SHIFT 3
15 /* bits [19:3] of the virtual address in 64-bit used to index into
16 * bounds table (BT).
17 */
18 #define MPX_BT_ENTRY_OFFSET 17
19 #define MPX_BT_ENTRY_SHIFT 5
20 #define MPX_IGN_BITS 3
21
22 #else
23
24 #define MPX_BD_ENTRY_OFFSET 20
25 #define MPX_BD_ENTRY_SHIFT 2
26 #define MPX_BT_ENTRY_OFFSET 10
27 #define MPX_BT_ENTRY_SHIFT 4
28 #define MPX_IGN_BITS 2
29
30 #endif
31
32 #define MPX_BD_SIZE_BYTES (1UL<<(MPX_BD_ENTRY_OFFSET+MPX_BD_ENTRY_SHIFT))
33 #define MPX_BT_SIZE_BYTES (1UL<<(MPX_BT_ENTRY_OFFSET+MPX_BT_ENTRY_SHIFT))
34
35 #define MPX_BNDSTA_ERROR_CODE 0x3
36
37 #ifdef CONFIG_X86_INTEL_MPX
38 siginfo_t *mpx_generate_siginfo(struct pt_regs *regs,
39 struct xsave_struct *xsave_buf);
40 #else
41 static inline siginfo_t *mpx_generate_siginfo(struct pt_regs *regs,
42 struct xsave_struct *xsave_buf)
43 {
44 return NULL;
45 }
46 #endif /* CONFIG_X86_INTEL_MPX */
47
48 #endif /* _ASM_X86_MPX_H */
This page took 0.037516 seconds and 5 git commands to generate.