diff options
Diffstat (limited to 'drivers/lguest/lg.h')
-rw-r--r-- | drivers/lguest/lg.h | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h index 9c3138265f8e..bc28745d05af 100644 --- a/drivers/lguest/lg.h +++ b/drivers/lguest/lg.h | |||
@@ -16,15 +16,13 @@ | |||
16 | void free_pagetables(void); | 16 | void free_pagetables(void); |
17 | int init_pagetables(struct page **switcher_page, unsigned int pages); | 17 | int init_pagetables(struct page **switcher_page, unsigned int pages); |
18 | 18 | ||
19 | struct pgdir | 19 | struct pgdir { |
20 | { | ||
21 | unsigned long gpgdir; | 20 | unsigned long gpgdir; |
22 | pgd_t *pgdir; | 21 | pgd_t *pgdir; |
23 | }; | 22 | }; |
24 | 23 | ||
25 | /* We have two pages shared with guests, per cpu. */ | 24 | /* We have two pages shared with guests, per cpu. */ |
26 | struct lguest_pages | 25 | struct lguest_pages { |
27 | { | ||
28 | /* This is the stack page mapped rw in guest */ | 26 | /* This is the stack page mapped rw in guest */ |
29 | char spare[PAGE_SIZE - sizeof(struct lguest_regs)]; | 27 | char spare[PAGE_SIZE - sizeof(struct lguest_regs)]; |
30 | struct lguest_regs regs; | 28 | struct lguest_regs regs; |
@@ -38,8 +36,6 @@ struct lguest_pages | |||
38 | #define CHANGED_GDT_TLS 4 /* Actually a subset of CHANGED_GDT */ | 36 | #define CHANGED_GDT_TLS 4 /* Actually a subset of CHANGED_GDT */ |
39 | #define CHANGED_ALL 3 | 37 | #define CHANGED_ALL 3 |
40 | 38 | ||
41 | struct lguest; | ||
42 | |||
43 | struct lg_cpu { | 39 | struct lg_cpu { |
44 | unsigned int id; | 40 | unsigned int id; |
45 | struct lguest *lg; | 41 | struct lguest *lg; |
@@ -56,13 +52,13 @@ struct lg_cpu { | |||
56 | 52 | ||
57 | unsigned long pending_notify; /* pfn from LHCALL_NOTIFY */ | 53 | unsigned long pending_notify; /* pfn from LHCALL_NOTIFY */ |
58 | 54 | ||
59 | /* At end of a page shared mapped over lguest_pages in guest. */ | 55 | /* At end of a page shared mapped over lguest_pages in guest. */ |
60 | unsigned long regs_page; | 56 | unsigned long regs_page; |
61 | struct lguest_regs *regs; | 57 | struct lguest_regs *regs; |
62 | 58 | ||
63 | struct lguest_pages *last_pages; | 59 | struct lguest_pages *last_pages; |
64 | 60 | ||
65 | int cpu_pgd; /* which pgd this cpu is currently using */ | 61 | int cpu_pgd; /* Which pgd this cpu is currently using */ |
66 | 62 | ||
67 | /* If a hypercall was asked for, this points to the arguments. */ | 63 | /* If a hypercall was asked for, this points to the arguments. */ |
68 | struct hcall_args *hcall; | 64 | struct hcall_args *hcall; |
@@ -91,15 +87,17 @@ struct lg_eventfd_map { | |||
91 | }; | 87 | }; |
92 | 88 | ||
93 | /* The private info the thread maintains about the guest. */ | 89 | /* The private info the thread maintains about the guest. */ |
94 | struct lguest | 90 | struct lguest { |
95 | { | ||
96 | struct lguest_data __user *lguest_data; | 91 | struct lguest_data __user *lguest_data; |
97 | struct lg_cpu cpus[NR_CPUS]; | 92 | struct lg_cpu cpus[NR_CPUS]; |
98 | unsigned int nr_cpus; | 93 | unsigned int nr_cpus; |
99 | 94 | ||
100 | u32 pfn_limit; | 95 | u32 pfn_limit; |
101 | /* This provides the offset to the base of guest-physical | 96 | |
102 | * memory in the Launcher. */ | 97 | /* |
98 | * This provides the offset to the base of guest-physical memory in the | ||
99 | * Launcher. | ||
100 | */ | ||
103 | void __user *mem_base; | 101 | void __user *mem_base; |
104 | unsigned long kernel_address; | 102 | unsigned long kernel_address; |
105 | 103 | ||
@@ -124,11 +122,13 @@ bool lguest_address_ok(const struct lguest *lg, | |||
124 | void __lgread(struct lg_cpu *, void *, unsigned long, unsigned); | 122 | void __lgread(struct lg_cpu *, void *, unsigned long, unsigned); |
125 | void __lgwrite(struct lg_cpu *, unsigned long, const void *, unsigned); | 123 | void __lgwrite(struct lg_cpu *, unsigned long, const void *, unsigned); |
126 | 124 | ||
127 | /*H:035 Using memory-copy operations like that is usually inconvient, so we | 125 | /*H:035 |
126 | * Using memory-copy operations like that is usually inconvient, so we | ||
128 | * have the following helper macros which read and write a specific type (often | 127 | * have the following helper macros which read and write a specific type (often |
129 | * an unsigned long). | 128 | * an unsigned long). |
130 | * | 129 | * |
131 | * This reads into a variable of the given type then returns that. */ | 130 | * This reads into a variable of the given type then returns that. |
131 | */ | ||
132 | #define lgread(cpu, addr, type) \ | 132 | #define lgread(cpu, addr, type) \ |
133 | ({ type _v; __lgread((cpu), &_v, (addr), sizeof(_v)); _v; }) | 133 | ({ type _v; __lgread((cpu), &_v, (addr), sizeof(_v)); _v; }) |
134 | 134 | ||
@@ -142,9 +142,11 @@ void __lgwrite(struct lg_cpu *, unsigned long, const void *, unsigned); | |||
142 | 142 | ||
143 | int run_guest(struct lg_cpu *cpu, unsigned long __user *user); | 143 | int run_guest(struct lg_cpu *cpu, unsigned long __user *user); |
144 | 144 | ||
145 | /* Helper macros to obtain the first 12 or the last 20 bits, this is only the | 145 | /* |
146 | * Helper macros to obtain the first 12 or the last 20 bits, this is only the | ||
146 | * first step in the migration to the kernel types. pte_pfn is already defined | 147 | * first step in the migration to the kernel types. pte_pfn is already defined |
147 | * in the kernel. */ | 148 | * in the kernel. |
149 | */ | ||
148 | #define pgd_flags(x) (pgd_val(x) & ~PAGE_MASK) | 150 | #define pgd_flags(x) (pgd_val(x) & ~PAGE_MASK) |
149 | #define pgd_pfn(x) (pgd_val(x) >> PAGE_SHIFT) | 151 | #define pgd_pfn(x) (pgd_val(x) >> PAGE_SHIFT) |
150 | #define pmd_flags(x) (pmd_val(x) & ~PAGE_MASK) | 152 | #define pmd_flags(x) (pmd_val(x) & ~PAGE_MASK) |