Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 80921
b: refs/heads/master
c: ae3749d
h: refs/heads/master
i:
  80919: 9b2fe0d
v: v3
  • Loading branch information
Glauber de Oliveira Costa authored and Rusty Russell committed Jan 30, 2008
1 parent b75e303 commit f6e9b78
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f34f8c5fea079065671163c37d98328cff31980b
refs/heads/master: ae3749dcd8c31dcfbab14ea28c68a944c93f418f
2 changes: 1 addition & 1 deletion trunk/drivers/lguest/interrupts_and_traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ void load_guest_idt_entry(struct lg_cpu *cpu, unsigned int num, u32 lo, u32 hi)

/* Mark the IDT as changed: next time the Guest runs we'll know we have
* to copy this again. */
cpu->lg->changed |= CHANGED_IDT;
cpu->changed |= CHANGED_IDT;

/* Check that the Guest doesn't try to step outside the bounds. */
if (num >= ARRAY_SIZE(cpu->arch.idt))
Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/lguest/lg.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ struct lg_cpu {
u32 esp1;
u8 ss1;

/* Bitmap of what has changed: see CHANGED_* above. */
int changed;

unsigned long pending_notify; /* pfn from LHCALL_NOTIFY */

/* At end of a page shared mapped over lguest_pages in guest. */
Expand Down Expand Up @@ -92,9 +95,6 @@ struct lguest
void __user *mem_base;
unsigned long kernel_address;

/* Bitmap of what has changed: see CHANGED_* above. */
int changed;

struct pgdir pgdirs[4];

unsigned long noirq_start, noirq_end;
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/lguest/segments.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ void load_guest_gdt(struct lg_cpu *cpu, unsigned long table, u32 num)
fixup_gdt_table(cpu, 0, ARRAY_SIZE(cpu->arch.gdt));
/* Mark that the GDT changed so the core knows it has to copy it again,
* even if the Guest is run on the same CPU. */
lg->changed |= CHANGED_GDT;
cpu->changed |= CHANGED_GDT;
}

/* This is the fast-track version for just changing the three TLS entries.
Expand All @@ -174,7 +174,7 @@ void guest_load_tls(struct lg_cpu *cpu, unsigned long gtls)
__lgread(lg, tls, gtls, sizeof(*tls)*GDT_ENTRY_TLS_ENTRIES);
fixup_gdt_table(cpu, GDT_ENTRY_TLS_MIN, GDT_ENTRY_TLS_MAX+1);
/* Note that just the TLS entries have changed. */
lg->changed |= CHANGED_GDT_TLS;
cpu->changed |= CHANGED_GDT_TLS;
}
/*:*/

Expand Down
11 changes: 5 additions & 6 deletions trunk/drivers/lguest/x86/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,14 @@ static DEFINE_PER_CPU(struct lg_cpu *, last_cpu);
*/
static void copy_in_guest_info(struct lg_cpu *cpu, struct lguest_pages *pages)
{
struct lguest *lg = cpu->lg;
/* Copying all this data can be quite expensive. We usually run the
* same Guest we ran last time (and that Guest hasn't run anywhere else
* meanwhile). If that's not the case, we pretend everything in the
* Guest has changed. */
if (__get_cpu_var(last_cpu) != cpu || cpu->last_pages != pages) {
__get_cpu_var(last_cpu) = cpu;
cpu->last_pages = pages;
lg->changed = CHANGED_ALL;
cpu->changed = CHANGED_ALL;
}

/* These copies are pretty cheap, so we do them unconditionally: */
Expand All @@ -99,18 +98,18 @@ static void copy_in_guest_info(struct lg_cpu *cpu, struct lguest_pages *pages)
pages->state.guest_tss.ss1 = cpu->ss1;

/* Copy direct-to-Guest trap entries. */
if (lg->changed & CHANGED_IDT)
if (cpu->changed & CHANGED_IDT)
copy_traps(cpu, pages->state.guest_idt, default_idt_entries);

/* Copy all GDT entries which the Guest can change. */
if (lg->changed & CHANGED_GDT)
if (cpu->changed & CHANGED_GDT)
copy_gdt(cpu, pages->state.guest_gdt);
/* If only the TLS entries have changed, copy them. */
else if (lg->changed & CHANGED_GDT_TLS)
else if (cpu->changed & CHANGED_GDT_TLS)
copy_gdt_tls(cpu, pages->state.guest_gdt);

/* Mark the Guest as unchanged for next time. */
lg->changed = 0;
cpu->changed = 0;
}

/* Finally: the code to actually call into the Switcher to run the Guest. */
Expand Down

0 comments on commit f6e9b78

Please sign in to comment.