1 #ifndef _ASM_X86_LGUEST_H
2 #define _ASM_X86_LGUEST_H
4 #define GDT_ENTRY_LGUEST_CS 10
5 #define GDT_ENTRY_LGUEST_DS 11
6 #define LGUEST_CS (GDT_ENTRY_LGUEST_CS * 8)
7 #define LGUEST_DS (GDT_ENTRY_LGUEST_DS * 8)
14 /* Every guest maps the core switcher code. */
15 #define SHARED_SWITCHER_PAGES \
16 DIV_ROUND_UP(end_switcher_text - start_switcher_text, PAGE_SIZE)
17 /* Pages for switcher itself, then two pages per cpu */
18 #define TOTAL_SWITCHER_PAGES (SHARED_SWITCHER_PAGES + 2 * nr_cpu_ids)
20 /* We map at -4M (-2M for PAE) for ease of mapping (one PTE page). */
22 #define SWITCHER_ADDR 0xFFE00000
24 #define SWITCHER_ADDR 0xFFC00000
27 /* Found in switcher.S */
28 extern unsigned long default_idt_entries
[];
30 /* Declarations for definitions in lguest_guest.S */
31 extern char lguest_noirq_start
[], lguest_noirq_end
[];
32 extern const char lgstart_cli
[], lgend_cli
[];
33 extern const char lgstart_sti
[], lgend_sti
[];
34 extern const char lgstart_popf
[], lgend_popf
[];
35 extern const char lgstart_pushf
[], lgend_pushf
[];
36 extern const char lgstart_iret
[], lgend_iret
[];
38 extern void lguest_iret(void);
39 extern void lguest_init(void);
42 /* Manually saved part. */
43 unsigned long eax
, ebx
, ecx
, edx
;
44 unsigned long esi
, edi
, ebp
;
46 unsigned long fs
, ds
, es
;
47 unsigned long trapnum
, errcode
;
48 /* Trap pushed part */
56 /* This is a guest-specific page (mapped ro) into the guest. */
57 struct lguest_ro_state
{
58 /* Host information we need to restore when we switch back. */
60 struct desc_ptr host_idt_desc
;
61 struct desc_ptr host_gdt_desc
;
64 /* Fields which are used when guest is running. */
65 struct desc_ptr guest_idt_desc
;
66 struct desc_ptr guest_gdt_desc
;
67 struct x86_hw_tss guest_tss
;
68 struct desc_struct guest_idt
[IDT_ENTRIES
];
69 struct desc_struct guest_gdt
[GDT_ENTRIES
];
73 /* The GDT entries copied into lguest_ro_state when running. */
74 struct desc_struct gdt
[GDT_ENTRIES
];
76 /* The IDT entries: some copied into lguest_ro_state when running. */
77 struct desc_struct idt
[IDT_ENTRIES
];
79 /* The address of the last guest-visible pagefault (ie. cr2). */
80 unsigned long last_pagefault
;
83 static inline void lguest_set_ts(void)
92 /* Full 4G segment descriptors, suitable for CS and DS. */
93 #define FULL_EXEC_SEGMENT \
94 ((struct desc_struct)GDT_ENTRY_INIT(0xc09b, 0, 0xfffff))
95 #define FULL_SEGMENT ((struct desc_struct)GDT_ENTRY_INIT(0xc093, 0, 0xfffff))
97 #endif /* __ASSEMBLY__ */
99 #endif /* _ASM_X86_LGUEST_H */