# HG changeset patch
# User Jerone Young <[EMAIL PROTECTED]>
# Date 1199304626 21600
# Node ID 2eddb4bcae5e444ba12b2d8985e494342e505131
# Parent  8161d444f7c37be9bdbfaac338d58301b00f2961
Add powerpc libkvm support code

This patch adds implimentation code need for powerpc libkvm support.

While the kernel code has not yet made it upstream, after seeing the skeleton
patches making it in over the holiday, I decided to send this since
it's for the most part stable with what we are hacking away with in kernel.

Signed-off-by: Jerone Young <[EMAIL PROTECTED]>

diff --git a/libkvm/libkvm-powerpc.c b/libkvm/libkvm-powerpc.c
--- a/libkvm/libkvm-powerpc.c
+++ b/libkvm/libkvm-powerpc.c
@@ -1,18 +1,75 @@
+/*
+ * This header is for functions & variables that will ONLY be
+ * used inside libkvm for x86.
+ * THESE ARE NOT EXPOSED TO THE USER AND ARE ONLY FOR USE
+ * WITHIN LIBKVM.
+ *
+ * derived from libkvm.c
+ *
+ * Copyright (C) 2006 Qumranet, Inc.
+ *
+ * Authors:
+ *      Avi Kivity   <[EMAIL PROTECTED]>
+ *      Yaniv Kamay  <[EMAIL PROTECTED]>
+ *
+ * Copyright 2007 IBM Corporation.
+ * Added by & Authors: 
+ *     Jerone Young <[EMAIL PROTECTED]>
+ *     Christian Ehrhardt <[EMAIL PROTECTED]>
+ *
+ *
+ * This work is licensed under the GNU LGPL license, version 2.
+ */
+
 #include "libkvm.h"
 #include "kvm-powerpc.h"
 #include <errno.h>
+#include <stdio.h>
 
-int kvm_run_abi10(kvm_context_t kvm, int vcpu)
+int handle_dcr(struct kvm_run *run,  kvm_context_t kvm)
 {
-       return -ENOSYS;
+       int ret = 0;
+       
+       if (run->dcr.is_write)
+               ret = kvm->callbacks->powerpc_dcr_write(kvm,
+                                       run->dcr.dcrn,run->dcr.data); 
+       else
+               ret = kvm->callbacks->powerpc_dcr_read(kvm,
+                                       run->dcr.dcrn, &(run->dcr.data));
+       
+       return ret;
+}
+
+int kvm_alloc_kernel_memory(kvm_context_t kvm, unsigned long memory,
+                               void **vm_mem)
+{
+       fprintf(stderr, "%s: Operation not supported\n", __FUNCTION__);
+       return -1;
 }
 
 void kvm_show_code(kvm_context_t kvm, int vcpu)
 {
+       fprintf(stderr, "%s: Operation not supported\n", __FUNCTION__);
 }
 
 void kvm_show_regs(kvm_context_t kvm, int vcpu)
 {
+       struct kvm_regs regs;
+       int i;
+
+       if (kvm_get_regs(kvm, vcpu, &regs))
+               return;
+
+       for (i=0; i<32; i+=4)
+       {
+               fprintf(stderr, "gpr%02d: %08x %08x %08x %08x\n", i,
+                       regs.gpr[i],
+                       regs.gpr[i+1],
+                       regs.gpr[i+2],
+                       regs.gpr[i+3]);
+       }
+
+       fflush(stdout);
 }
 
 int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
@@ -30,5 +87,15 @@ int kvm_arch_create_default_phys_mem(kvm
 
 int kvm_arch_run(struct kvm_run *run, kvm_context_t kvm, int vcpu)
 {
-       return 0;
+       int ret = 0;
+
+       switch (run->exit_reason){
+       case KVM_EXIT_DCR:
+               ret = handle_dcr(run, kvm);
+               break;
+       default:
+               ret = 1;
+               break;
+       }
+       return ret;
 }

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to