blob: 35bcb1cddf40b0b01727ed3688879ac762cb15d5 [file] [log] [blame]
Qiaowei Ren57319d82014-11-14 07:18:27 -08001#ifndef _ASM_X86_MPX_H
2#define _ASM_X86_MPX_H
3
4#include <linux/types.h>
5#include <asm/ptrace.h>
Dave Hansenfcc7ffd2014-11-14 07:18:28 -08006#include <asm/insn.h>
Qiaowei Ren57319d82014-11-14 07:18:27 -08007
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
Dave Hansenfcc7ffd2014-11-14 07:18:28 -080037#ifdef CONFIG_X86_INTEL_MPX
38siginfo_t *mpx_generate_siginfo(struct pt_regs *regs,
39 struct xsave_struct *xsave_buf);
40#else
41static 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
Qiaowei Ren57319d82014-11-14 07:18:27 -080048#endif /* _ASM_X86_MPX_H */