aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest/lg.h
diff options
context:
space:
mode:
authorJes Sorensen <jes@sgi.com>2007-10-21 21:03:28 -0400
committerRusty Russell <rusty@rustcorp.com.au>2007-10-23 01:49:51 -0400
commit625efab1cd3d4da4634dfe26df6b4005385397e2 (patch)
treee08cd714edece430ae8a8aef894adfadbccc064a /drivers/lguest/lg.h
parent56adbe9ddc935600c64635d6a55c260a63c67e4a (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.h63
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
25struct 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
42void free_pagetables(void); 17void free_pagetables(void);
43int init_pagetables(struct page **switcher_page, unsigned int pages); 18int 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
49struct lguest_dma_info 20struct 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. */
102struct 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. */
119struct lguest_pages 73struct 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);
239int demand_page(struct lguest *info, unsigned long cr2, int errcode); 189int demand_page(struct lguest *info, unsigned long cr2, int errcode);
240void pin_page(struct lguest *lg, unsigned long vaddr); 190void pin_page(struct lguest *lg, unsigned long vaddr);
241 191
192/* <arch>/core.c: */
193void lguest_arch_host_init(void);
194void lguest_arch_host_fini(void);
195void lguest_arch_run_guest(struct lguest *lg);
196void lguest_arch_handle_trap(struct lguest *lg);
197
198/* <arch>/switcher.S: */
199extern char start_switcher_text[], end_switcher_text[], switch_to_guest[];
200
242/* lguest_user.c: */ 201/* lguest_user.c: */
243int lguest_device_init(void); 202int lguest_device_init(void);
244void lguest_device_remove(void); 203void lguest_device_remove(void);