> This seems to be messing up the virtualization somewhere.  Likely
> host-linux.c is not handling the timer interrupt well.  Could
> someone check this out.  Here's a slightly modified user/user.c:
> 
>   ftp://bochs.com/pub/freemware/user-kpl.c
> 
> If you use ./user -g ../guest/cooperative/kernel.elf, it
> bombs with this verion, but is OK with the previous one.
> Probably something simple.  I want to check out some other
> stuff in the mean time.

Oops.  When returning with -EINTR, the kernel module did not write
the current guest_context back to user space.  When the user space
app does the next iteration of its loop, it hence restarts with 
the original guest context :-/

I've fixed that in CVS; you can also apply the following patch:


diff -ur freemware/kernel/host-linux.c fmw-uw/kernel/host-linux.c
--- freemware/kernel/host-linux.c       Sat Jan  1 22:15:43 2000
+++ fmw-uw/kernel/host-linux.c  Fri Jan  7 18:49:13 2000
@@ -61,7 +61,7 @@
 static void unalloc_vm_pages(vm_t *vm);
 static int alloc_vm_pages(vm_t *vm, unsigned nmegs);
 static void retrieve_monitor_pages(void);
-static int run_guest_loop(vm_t *vm, guest_context_t *context);
+static int run_guest_loop(vm_t *vm);
 
 
 
@@ -287,13 +287,14 @@
       if (copy_from_user( &context, (void *)arg, sizeof(context) ))
         return -EFAULT;
 
-      ret = run_guest_loop( vm, &context );
-      if (ret) return ret;
+      set_guest_context( vm, &context );
+      ret = run_guest_loop( vm );
+      get_guest_context( vm, &context );
 
       if (copy_to_user( (void *)arg, &context, sizeof(context) ))
         return -EFAULT;
 
-      return 0;
+      return ret;
       break;
 
     case FMWTEARDOWN: // tear down VM environment
@@ -412,12 +413,10 @@
 /************************************************************************/
 
 static int
-run_guest_loop( vm_t *vm, guest_context_t *context )
+run_guest_loop( vm_t *vm )
 {
     unsigned vector, event;
 
-    set_guest_context( vm, context );
-
     for (;;)
     {
         unsigned long eflags_orig;
@@ -446,7 +445,6 @@
 
         case RET_BECAUSE_EXC:
             restore_flags(eflags_orig);
-            get_guest_context(vm, context);
             return 0;
 
         case RET_BECAUSE_MON_ERROR:
@@ -458,7 +456,6 @@
 
         case RET_BECAUSE_EMERR:
             restore_flags(eflags_orig);
-            get_guest_context(vm, context);
             switch (vm->nexus->debug_msg.msg_code) {
             case EMU_CLI_MSG:
               printk(KERN_WARNING "freemware: emulation of cli without success\n");


Bye,
Ulrich

-- 
  Ulrich Weigand,
  IMMD 1, Universitaet Erlangen-Nuernberg,
  Martensstr. 3, D-91058 Erlangen, Phone: +49 9131 85-7688

Reply via email to