xref: /linux/arch/x86/um/shared/sysdep/mcontext.h (revision cfc4ca8986bb1f6182da6cd7bb57f228590b4643)
1 /*
2  * Copyright (C) 2000 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3  * Licensed under the GPL
4  */
5 
6 #ifndef __SYS_SIGCONTEXT_X86_H
7 #define __SYS_SIGCONTEXT_X86_H
8 
9 #include <stub-data.h>
10 
11 extern void get_regs_from_mc(struct uml_pt_regs *, mcontext_t *);
12 extern void get_mc_from_regs(struct uml_pt_regs *regs, mcontext_t *mc,
13 			     int single_stepping);
14 
15 extern int get_stub_state(struct uml_pt_regs *regs, struct stub_data *data,
16 			  unsigned long *fp_size_out);
17 extern int set_stub_state(struct uml_pt_regs *regs, struct stub_data *data,
18 			  int single_stepping);
19 
20 #ifdef __i386__
21 
22 #define GET_FAULTINFO_FROM_MC(fi, mc) \
23 	{ \
24 		(fi).cr2 = (mc)->cr2; \
25 		(fi).error_code = (mc)->gregs[REG_ERR]; \
26 		(fi).trap_no = (mc)->gregs[REG_TRAPNO]; \
27 	}
28 
29 #else
30 
31 #define GET_FAULTINFO_FROM_MC(fi, mc) \
32 	{ \
33 		(fi).cr2 = (mc)->gregs[REG_CR2]; \
34 		(fi).error_code = (mc)->gregs[REG_ERR]; \
35 		(fi).trap_no = (mc)->gregs[REG_TRAPNO]; \
36 	}
37 
38 #endif
39 
40 #endif
41