Skip to contentSkip to conversation

mini-os: Switch to newer HYPERVISOR_sched_op() interface

PATCH New Dietmar Hahn 1 participant 1 message Oct 26, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mini-os: Switch to newer HYPERVISOR_sched_op() interface

Hi Gregor,

this patch switches to the newer interface for HYPERVISOR_sched_op().
I changed kernel.c and include/x86/x86_32/hypercall-x86_32.h include/x86/x86_64/hypercall-x86_64.h
I testet it only on x86_32 because I have no x86_64 machine! Please have a look!
Thanks.

Dietmar.

# HG changeset patch
# User [email protected]
# Date 1161855519 -7200
# Node ID 117bcc7e0d162bf08f75a2765d82bfba98387831 # Parent abee5c6b930daae7b97ca2837591b737e939ddf4 Switched to new interfaces HYPERVISOR_sched_op() and HYPERVISOR_sched_op_compat() used in kernel.c.

extras/mini-os/include/x86/x86_32/hypercall-x86_32.h +8 -1
diff -r abee5c6b930d -r 117bcc7e0d16 extras/mini-os/include/x86/x86_32/hypercall-x86_32.h
@@ -166,8 +166,15 @@ HYPERVISOR_fpu_taskswitch(
 }
 
 static inline int
+HYPERVISOR_sched_op_compat(
+	int cmd, unsigned long arg)
+{
+	return _hypercall2(int, sched_op_compat, cmd, arg);
+}
+
+static inline int
 HYPERVISOR_sched_op(
-	int cmd, unsigned long arg)
+	int cmd, void *arg)
 {
 	return _hypercall2(int, sched_op, cmd, arg);
 }
extras/mini-os/include/x86/x86_64/hypercall-x86_64.h +8 -1
diff -r abee5c6b930d -r 117bcc7e0d16 extras/mini-os/include/x86/x86_64/hypercall-x86_64.h
@@ -170,8 +170,15 @@ HYPERVISOR_fpu_taskswitch(
 }
 
 static inline int
+HYPERVISOR_sched_op_compat(
+	int cmd, unsigned long arg)
+{
+	return _hypercall2(int, sched_op_compat, cmd, arg);
+}
+
+static inline int
 HYPERVISOR_sched_op(
-	int cmd, unsigned long arg)
+	int cmd, void *arg)
 {
 	return _hypercall2(int, sched_op, cmd, arg);
 }
extras/mini-os/kernel.c +10 -1
diff -r abee5c6b930d -r 117bcc7e0d16 extras/mini-os/kernel.c
@@ -27,6 +27,7 @@
  */
 
 #include <os.h>
+#include <errno.h>
 #include <hypervisor.h>
 #include <mm.h>
 #include <events.h>
@@ -145,5 +146,13 @@ void do_exit(void)
 void do_exit(void)
 {
     printk("Do_exit called!\n");
-    for ( ;; ) HYPERVISOR_sched_op(SCHEDOP_shutdown, SHUTDOWN_crash);
+    for ( ;; )
+    {
+        struct sched_shutdown sched_shutdown = { .reason = SHUTDOWN_crash };
+        int rc = HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
+        if(rc == -ENOSYS)
+        {
+            HYPERVISOR_sched_op_compat(SCHEDOP_shutdown, SHUTDOWN_crash);
+        }
+    }
 }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel