Xen Test Framework
symbolic-const.h
Go to the documentation of this file.
1 
6 #ifndef XTF_X86_SYMBOLIC_CONST_H
7 #define XTF_X86_SYMBOLIC_CONST_H
8 
9 #include <xtf/macro_magic.h>
10 
11 #include <arch/desc.h>
12 #include <arch/processor.h>
13 
29 #define TOK_OR0(t) (0)
30 #define TOK_OR1(t, x) (t ## x)
31 #define TOK_OR2(t, x, ...) (t ## x | TOK_OR1(t, ##__VA_ARGS__))
32 #define TOK_OR3(t, x, ...) (t ## x | TOK_OR2(t, ##__VA_ARGS__))
33 #define TOK_OR4(t, x, ...) (t ## x | TOK_OR3(t, ##__VA_ARGS__))
34 #define TOK_OR5(t, x, ...) (t ## x | TOK_OR4(t, ##__VA_ARGS__))
35 #define TOK_OR6(t, x, ...) (t ## x | TOK_OR5(t, ##__VA_ARGS__))
36 #define TOK_OR7(t, x, ...) (t ## x | TOK_OR6(t, ##__VA_ARGS__))
37 #define TOK_OR8(t, x, ...) (t ## x | TOK_OR7(t, ##__VA_ARGS__))
38 #define TOK_OR9(t, x, ...) (t ## x | TOK_OR8(t, ##__VA_ARGS__))
39 #define TOK_OR10(t, x, ...) (t ## x | TOK_OR9(t, ##__VA_ARGS__))
40 #define TOK_OR11(t, x, ...) (t ## x | TOK_OR10(t, ##__VA_ARGS__))
41 
42 #define TOK_OR(t, ...) VAR_MACRO_C1(TOK_OR, t, ##__VA_ARGS__)
43 
58 #define INIT_GDTE_SYM(base, limit, ...) \
59  INIT_GDTE(base, limit, TOK_OR(SEG_ATTR_, ##__VA_ARGS__))
60 
64 #define GDTE_SYM(base, limit, ...) \
65  ((user_desc)INIT_GDTE_SYM(base, limit, __VA_ARGS__))
66 
80 #define SEL_EC_SYM(sel, ...) (sel | TOK_OR(X86_EC_, ##__VA_ARGS__))
81 
96 #define EXC_EC_SYM(exc, ...) \
97  SEL_EC_SYM(((X86_EXC_ ## exc) << 3), IDT, ##__VA_ARGS__)
98 
108 #define PF_SYM(...) TOK_OR(_PAGE_, ##__VA_ARGS__)
109 
119 #define PFEC_SYM(...) TOK_OR(X86_PFEC_, ##__VA_ARGS__)
120 
121 #endif /* XTF_X86_SYMBOLIC_CONST_H */
122 
123 /*
124  * Local variables:
125  * mode: C
126  * c-file-style: "BSD"
127  * c-basic-offset: 4
128  * tab-width: 4
129  * indent-tabs-mode: nil
130  * End:
131  */
Varadic macro helpers - Here be many dragons.
x86 segment descriptor infrastructure.