diff options
author | Jes Sorensen <jes@sgi.com> | 2007-10-21 21:03:28 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2007-10-23 01:49:51 -0400 |
commit | 625efab1cd3d4da4634dfe26df6b4005385397e2 (patch) | |
tree | e08cd714edece430ae8a8aef894adfadbccc064a /drivers/lguest/lg.h | |
parent | 56adbe9ddc935600c64635d6a55c260a63c67e4a (diff) |
Move i386 part of core.c to x86/core.c.
Separate i386 architecture specific from core.c and move it to
x86/core.c and add x86/lguest.h header file to match.
Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'drivers/lguest/lg.h')
-rw-r--r-- | drivers/lguest/lg.h | 63 |
1 files changed, 11 insertions, 52 deletions
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h index c1ca127ddece..203d3100c3b4 100644 --- a/drivers/lguest/lg.h +++ b/drivers/lguest/lg.h | |||
@@ -1,13 +1,6 @@ | |||
1 | #ifndef _LGUEST_H | 1 | #ifndef _LGUEST_H |
2 | #define _LGUEST_H | 2 | #define _LGUEST_H |
3 | 3 | ||
4 | #include <asm/desc.h> | ||
5 | |||
6 | #define GDT_ENTRY_LGUEST_CS 10 | ||
7 | #define GDT_ENTRY_LGUEST_DS 11 | ||
8 | #define LGUEST_CS (GDT_ENTRY_LGUEST_CS * 8) | ||
9 | #define LGUEST_DS (GDT_ENTRY_LGUEST_DS * 8) | ||
10 | |||
11 | #ifndef __ASSEMBLY__ | 4 | #ifndef __ASSEMBLY__ |
12 | #include <linux/types.h> | 5 | #include <linux/types.h> |
13 | #include <linux/init.h> | 6 | #include <linux/init.h> |
@@ -18,34 +11,12 @@ | |||
18 | #include <linux/wait.h> | 11 | #include <linux/wait.h> |
19 | #include <linux/err.h> | 12 | #include <linux/err.h> |
20 | #include <asm/semaphore.h> | 13 | #include <asm/semaphore.h> |
21 | #include "irq_vectors.h" | ||
22 | |||
23 | #define GUEST_PL 1 | ||
24 | 14 | ||
25 | struct lguest_regs | 15 | #include <asm/lguest.h> |
26 | { | ||
27 | /* Manually saved part. */ | ||
28 | unsigned long ebx, ecx, edx; | ||
29 | unsigned long esi, edi, ebp; | ||
30 | unsigned long gs; | ||
31 | unsigned long eax; | ||
32 | unsigned long fs, ds, es; | ||
33 | unsigned long trapnum, errcode; | ||
34 | /* Trap pushed part */ | ||
35 | unsigned long eip; | ||
36 | unsigned long cs; | ||
37 | unsigned long eflags; | ||
38 | unsigned long esp; | ||
39 | unsigned long ss; | ||
40 | }; | ||
41 | 16 | ||
42 | void free_pagetables(void); | 17 | void free_pagetables(void); |
43 | int init_pagetables(struct page **switcher_page, unsigned int pages); | 18 | int init_pagetables(struct page **switcher_page, unsigned int pages); |
44 | 19 | ||
45 | /* Full 4G segment descriptors, suitable for CS and DS. */ | ||
46 | #define FULL_EXEC_SEGMENT ((struct desc_struct){0x0000ffff, 0x00cf9b00}) | ||
47 | #define FULL_SEGMENT ((struct desc_struct){0x0000ffff, 0x00cf9300}) | ||
48 | |||
49 | struct lguest_dma_info | 20 | struct lguest_dma_info |
50 | { | 21 | { |
51 | struct list_head list; | 22 | struct list_head list; |
@@ -98,23 +69,6 @@ struct pgdir | |||
98 | spgd_t *pgdir; | 69 | spgd_t *pgdir; |
99 | }; | 70 | }; |
100 | 71 | ||
101 | /* This is a guest-specific page (mapped ro) into the guest. */ | ||
102 | struct lguest_ro_state | ||
103 | { | ||
104 | /* Host information we need to restore when we switch back. */ | ||
105 | u32 host_cr3; | ||
106 | struct Xgt_desc_struct host_idt_desc; | ||
107 | struct Xgt_desc_struct host_gdt_desc; | ||
108 | u32 host_sp; | ||
109 | |||
110 | /* Fields which are used when guest is running. */ | ||
111 | struct Xgt_desc_struct guest_idt_desc; | ||
112 | struct Xgt_desc_struct guest_gdt_desc; | ||
113 | struct i386_hw_tss guest_tss; | ||
114 | struct desc_struct guest_idt[IDT_ENTRIES]; | ||
115 | struct desc_struct guest_gdt[GDT_ENTRIES]; | ||
116 | }; | ||
117 | |||
118 | /* We have two pages shared with guests, per cpu. */ | 72 | /* We have two pages shared with guests, per cpu. */ |
119 | struct lguest_pages | 73 | struct lguest_pages |
120 | { | 74 | { |
@@ -180,11 +134,7 @@ struct lguest | |||
180 | /* Dead? */ | 134 | /* Dead? */ |
181 | const char *dead; | 135 | const char *dead; |
182 | 136 | ||
183 | /* The GDT entries copied into lguest_ro_state when running. */ | 137 | struct lguest_arch arch; |
184 | struct desc_struct gdt[GDT_ENTRIES]; | ||
185 | |||
186 | /* The IDT entries: some copied into lguest_ro_state when running. */ | ||
187 | struct desc_struct idt[IDT_ENTRIES]; | ||
188 | 138 | ||
189 | /* Virtual clock device */ | 139 | /* Virtual clock device */ |
190 | struct hrtimer hrt; | 140 | struct hrtimer hrt; |
@@ -239,6 +189,15 @@ void map_switcher_in_guest(struct lguest *lg, struct lguest_pages *pages); | |||
239 | int demand_page(struct lguest *info, unsigned long cr2, int errcode); | 189 | int demand_page(struct lguest *info, unsigned long cr2, int errcode); |
240 | void pin_page(struct lguest *lg, unsigned long vaddr); | 190 | void pin_page(struct lguest *lg, unsigned long vaddr); |
241 | 191 | ||
192 | /* <arch>/core.c: */ | ||
193 | void lguest_arch_host_init(void); | ||
194 | void lguest_arch_host_fini(void); | ||
195 | void lguest_arch_run_guest(struct lguest *lg); | ||
196 | void lguest_arch_handle_trap(struct lguest *lg); | ||
197 | |||
198 | /* <arch>/switcher.S: */ | ||
199 | extern char start_switcher_text[], end_switcher_text[], switch_to_guest[]; | ||
200 | |||
242 | /* lguest_user.c: */ | 201 | /* lguest_user.c: */ |
243 | int lguest_device_init(void); | 202 | int lguest_device_init(void); |
244 | void lguest_device_remove(void); | 203 | void lguest_device_remove(void); |