]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/lguest/core.c
lguest: per-cpu run guest
[karo-tx-linux.git] / drivers / lguest / core.c
index cb4c67025d52ae5c6c4826a855695ec09dcf29e6..75b38f2c778a752b3d2c4474fd775788afd4306b 100644 (file)
@@ -174,8 +174,10 @@ void __lgwrite(struct lguest *lg, unsigned long addr, const void *b,
 /*H:030 Let's jump straight to the the main loop which runs the Guest.
  * Remember, this is called by the Launcher reading /dev/lguest, and we keep
  * going around and around until something interesting happens. */
-int run_guest(struct lguest *lg, unsigned long __user *user)
+int run_guest(struct lg_cpu *cpu, unsigned long __user *user)
 {
+       struct lguest *lg = cpu->lg;
+
        /* We stop running once the Guest is dead. */
        while (!lg->dead) {
                /* First we run any hypercalls the Guest wants done. */
@@ -226,7 +228,7 @@ int run_guest(struct lguest *lg, unsigned long __user *user)
                local_irq_disable();
 
                /* Actually run the Guest until something happens. */
-               lguest_arch_run_guest(lg);
+               lguest_arch_run_guest(cpu);
 
                /* Now we're ready to be interrupted or moved to other CPUs */
                local_irq_enable();
@@ -235,6 +237,8 @@ int run_guest(struct lguest *lg, unsigned long __user *user)
                lguest_arch_handle_trap(lg);
        }
 
+       if (lg->dead == ERR_PTR(-ERESTART))
+               return -ERESTART;
        /* The Guest is dead => "No such file or directory" */
        return -ENOENT;
 }
@@ -253,7 +257,7 @@ static int __init init(void)
 
        /* Lguest can't run under Xen, VMI or itself.  It does Tricky Stuff. */
        if (paravirt_enabled()) {
-               printk("lguest is afraid of %s\n", pv_info.name);
+               printk("lguest is afraid of being a guest\n");
                return -EPERM;
        }