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 /* Page for Switcher text itself, then two pages per cpu */
15 #define TOTAL_SWITCHER_PAGES (1 + 2 * nr_cpu_ids)
17 /* Where we map the Switcher, in both Host and Guest. */
18 extern unsigned long switcher_addr
;
20 /* Found in switcher.S */
21 extern unsigned long default_idt_entries
[];
23 /* Declarations for definitions in arch/x86/lguest/head_32.S */
24 extern char lguest_noirq_iret
[];
25 extern const char lgstart_cli
[], lgend_cli
[];
26 extern const char lgstart_pushf
[], lgend_pushf
[];
28 extern void lguest_iret(void);
29 extern void lguest_init(void);
32 /* Manually saved part. */
33 unsigned long eax
, ebx
, ecx
, edx
;
34 unsigned long esi
, edi
, ebp
;
36 unsigned long fs
, ds
, es
;
37 unsigned long trapnum
, errcode
;
38 /* Trap pushed part */
46 /* This is a guest-specific page (mapped ro) into the guest. */
47 struct lguest_ro_state
{
48 /* Host information we need to restore when we switch back. */
50 struct desc_ptr host_idt_desc
;
51 struct desc_ptr host_gdt_desc
;
54 /* Fields which are used when guest is running. */
55 struct desc_ptr guest_idt_desc
;
56 struct desc_ptr guest_gdt_desc
;
57 struct x86_hw_tss guest_tss
;
58 struct desc_struct guest_idt
[IDT_ENTRIES
];
59 struct desc_struct guest_gdt
[GDT_ENTRIES
];
63 /* The GDT entries copied into lguest_ro_state when running. */
64 struct desc_struct gdt
[GDT_ENTRIES
];
66 /* The IDT entries: some copied into lguest_ro_state when running. */
67 struct desc_struct idt
[IDT_ENTRIES
];
69 /* The address of the last guest-visible pagefault (ie. cr2). */
70 unsigned long last_pagefault
;
73 static inline void lguest_set_ts(void)
82 /* Full 4G segment descriptors, suitable for CS and DS. */
83 #define FULL_EXEC_SEGMENT \
84 ((struct desc_struct)GDT_ENTRY_INIT(0xc09b, 0, 0xfffff))
85 #define FULL_SEGMENT ((struct desc_struct)GDT_ENTRY_INIT(0xc093, 0, 0xfffff))
87 #endif /* __ASSEMBLY__ */
89 #endif /* _ASM_X86_LGUEST_H */