40 bool avl:1, :1, :1, g:1;
44 bool a:1, r:1, c:1, x:1;
65#define SEG_ATTR_G 0x8000
66#define SEG_ATTR_AVL 0x1000
67#define SEG_ATTR_P 0x0080
68#define SEG_ATTR_S 0x0010
69#define SEG_ATTR_A 0x0001
71#define SEG_ATTR_COMMON 0x8091
73#define SEG_ATTR_DPL0 0x0000
74#define SEG_ATTR_DPL1 0x0020
75#define SEG_ATTR_DPL2 0x0040
76#define SEG_ATTR_DPL3 0x0060
77#define SEG_ATTR_CODE 0x0008
78#define SEG_ATTR_DATA 0x0000
81#define SEG_ATTR_D 0x4000
82#define SEG_ATTR_L 0x2000
83#define SEG_ATTR_C 0x0004
84#define SEG_ATTR_R 0x0002
87#define SEG_ATTR_B 0x4000
90#define SEG_ATTR_E 0x0004
91#define SEG_ATTR_W 0x0002
100#define INIT_GDTE(base, limit, attr) { { { \
101 .lo = (((base) & 0xffff) << 16) | ((limit) & 0xffff), \
102 .hi = ((base) & 0xff000000) | ((limit) & 0xf0000) | \
103 (((attr) & 0xf0ff) << 8) | (((base) & 0xff0000) >> 16) \
109#define GDTE(base, limit, attr) ((user_desc)INIT_GDTE(base, limit, attr))
149#if defined(__x86_64__)
153typedef struct seg_gate64 gate_desc;
156#elif defined(__i386__)
160typedef struct seg_gate32 gate_desc;
164# error Bad architecture for descriptor infrastructure
170#if defined(CONFIG_HVM)
171extern env_gate idt[256];
172extern desc_ptr idt_ptr;
179 unsigned long base = (d->base0 |
180 ((
unsigned long)d->base1) << 16 |
181 ((
unsigned long)d->base2) << 24 );
185 base |= ((
unsigned long)d[1].lo) << 32;
193 unsigned int limit = (d->limit0 |
194 ((
unsigned int)d->limit1) << 16);
196 limit = limit << 12 | 0xfff;
203 unsigned long base = (
unsigned long)t;
205 d[0] =
GDTE(base,
sizeof(*t) - 1, 0x89);
207 d[1] = (user_desc){{{ .lo = base >> 32, .hi = 0 }}};
215 unsigned long base = (
unsigned long)ldt;
217 d[0] =
GDTE(base, limit, 0x82);
219 d[1] = (user_desc){{{ .lo = base >> 32, .hi = 0 }}};
static void pack_tss_desc(user_desc *d, const env_tss *t)
user_desc gdt[NR_GDT_ENTRIES]
static void pack_ldt_desc(user_desc *d, const user_desc *ldt, unsigned int limit)
#define GDTE(base, limit, attr)
As INIT_GDTE(), but creates a user_desc object.
static unsigned long user_desc_base(const user_desc *d)
static unsigned int user_desc_limit(const user_desc *d)
Protected mode lgdt/lidt table pointer.
Long mode lgdt/lidt table pointer.
Protected mode lcall/ljmp memory operand.
Long mode lcall/ljmp memory operand.
8 byte user segment descriptor (GDT/LDT entries with .s = 1)
Common declarations for all tests.
x86 Gate Descriptor infrastructure.
x86 Task State Segment infrastructure.