aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/lguest/segments.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/lguest/segments.c')
-rw-r--r--drivers/lguest/segments.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/lguest/segments.c b/drivers/lguest/segments.c
index 635f54c719ae..ec6aa3f1c36b 100644
--- a/drivers/lguest/segments.c
+++ b/drivers/lguest/segments.c
@@ -148,14 +148,13 @@ void copy_gdt(const struct lg_cpu *cpu, struct desc_struct *gdt)
148 * We copy it from the Guest and tweak the entries. */ 148 * We copy it from the Guest and tweak the entries. */
149void load_guest_gdt(struct lg_cpu *cpu, unsigned long table, u32 num) 149void load_guest_gdt(struct lg_cpu *cpu, unsigned long table, u32 num)
150{ 150{
151 struct lguest *lg = cpu->lg;
152 /* We assume the Guest has the same number of GDT entries as the 151 /* We assume the Guest has the same number of GDT entries as the
153 * Host, otherwise we'd have to dynamically allocate the Guest GDT. */ 152 * Host, otherwise we'd have to dynamically allocate the Guest GDT. */
154 if (num > ARRAY_SIZE(cpu->arch.gdt)) 153 if (num > ARRAY_SIZE(cpu->arch.gdt))
155 kill_guest(lg, "too many gdt entries %i", num); 154 kill_guest(cpu, "too many gdt entries %i", num);
156 155
157 /* We read the whole thing in, then fix it up. */ 156 /* We read the whole thing in, then fix it up. */
158 __lgread(lg, cpu->arch.gdt, table, num * sizeof(cpu->arch.gdt[0])); 157 __lgread(cpu, cpu->arch.gdt, table, num * sizeof(cpu->arch.gdt[0]));
159 fixup_gdt_table(cpu, 0, ARRAY_SIZE(cpu->arch.gdt)); 158 fixup_gdt_table(cpu, 0, ARRAY_SIZE(cpu->arch.gdt));
160 /* Mark that the GDT changed so the core knows it has to copy it again, 159 /* Mark that the GDT changed so the core knows it has to copy it again,
161 * even if the Guest is run on the same CPU. */ 160 * even if the Guest is run on the same CPU. */
@@ -169,9 +168,8 @@ void load_guest_gdt(struct lg_cpu *cpu, unsigned long table, u32 num)
169void guest_load_tls(struct lg_cpu *cpu, unsigned long gtls) 168void guest_load_tls(struct lg_cpu *cpu, unsigned long gtls)
170{ 169{
171 struct desc_struct *tls = &cpu->arch.gdt[GDT_ENTRY_TLS_MIN]; 170 struct desc_struct *tls = &cpu->arch.gdt[GDT_ENTRY_TLS_MIN];
172 struct lguest *lg = cpu->lg;
173 171
174 __lgread(lg, tls, gtls, sizeof(*tls)*GDT_ENTRY_TLS_ENTRIES); 172 __lgread(cpu, tls, gtls, sizeof(*tls)*GDT_ENTRY_TLS_ENTRIES);
175 fixup_gdt_table(cpu, GDT_ENTRY_TLS_MIN, GDT_ENTRY_TLS_MAX+1); 173 fixup_gdt_table(cpu, GDT_ENTRY_TLS_MIN, GDT_ENTRY_TLS_MAX+1);
176 /* Note that just the TLS entries have changed. */ 174 /* Note that just the TLS entries have changed. */
177 cpu->changed |= CHANGED_GDT_TLS; 175 cpu->changed |= CHANGED_GDT_TLS;