Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
[sfrench/cifs-2.6.git] / drivers / lguest / hypercalls.c
index 0f2cb4fd7c6980448e01770476e262d6ea708d70..c29ffa19cb74410e5b37ddc74bf19d4a45c5d9e7 100644 (file)
@@ -29,7 +29,7 @@
 #include "lg.h"
 
 /*H:120 This is the core hypercall routine: where the Guest gets what it wants.
- * Or gets killed.  Or, in the case of LHCALL_CRASH, both. */
+ * Or gets killed.  Or, in the case of LHCALL_SHUTDOWN, both. */
 static void do_hcall(struct lg_cpu *cpu, struct hcall_args *args)
 {
        switch (args->arg0) {
@@ -37,6 +37,10 @@ static void do_hcall(struct lg_cpu *cpu, struct hcall_args *args)
                /* This call does nothing, except by breaking out of the Guest
                 * it makes us process all the asynchronous hypercalls. */
                break;
+       case LHCALL_SEND_INTERRUPTS:
+               /* This call does nothing too, but by breaking out of the Guest
+                * it makes us process any pending interrupts. */
+               break;
        case LHCALL_LGUEST_INIT:
                /* You can't get here unless you're already initialized.  Don't
                 * do that. */
@@ -73,11 +77,21 @@ static void do_hcall(struct lg_cpu *cpu, struct hcall_args *args)
                guest_set_stack(cpu, args->arg1, args->arg2, args->arg3);
                break;
        case LHCALL_SET_PTE:
+#ifdef CONFIG_X86_PAE
+               guest_set_pte(cpu, args->arg1, args->arg2,
+                               __pte(args->arg3 | (u64)args->arg4 << 32));
+#else
                guest_set_pte(cpu, args->arg1, args->arg2, __pte(args->arg3));
+#endif
+               break;
+       case LHCALL_SET_PGD:
+               guest_set_pgd(cpu->lg, args->arg1, args->arg2);
                break;
+#ifdef CONFIG_X86_PAE
        case LHCALL_SET_PMD:
                guest_set_pmd(cpu->lg, args->arg1, args->arg2);
                break;
+#endif
        case LHCALL_SET_CLOCKEVENT:
                guest_set_clockevent(cpu, args->arg1);
                break;
@@ -190,6 +204,13 @@ static void initialize(struct lg_cpu *cpu)
         * pagetable. */
        guest_pagetable_clear_all(cpu);
 }
+/*:*/
+
+/*M:013 If a Guest reads from a page (so creates a mapping) that it has never
+ * written to, and then the Launcher writes to it (ie. the output of a virtual
+ * device), the Guest will still see the old page.  In practice, this never
+ * happens: why would the Guest read a page which it has never written to?  But
+ * a similar scenario might one day bite us, so it's worth mentioning. :*/
 
 /*H:100
  * Hypercalls
@@ -227,7 +248,7 @@ void do_hypercalls(struct lg_cpu *cpu)
                 * However, if we are signalled or the Guest sends I/O to the
                 * Launcher, the run_guest() loop will exit without running the
                 * Guest.  When it comes back it would try to re-run the
-                * hypercall. */
+                * hypercall.  Finding that bug sucked. */
                cpu->hcall = NULL;
        }
 }