kvm: libkvm: remove create_kernel_phys_mem
[qemu-kvm/fedora.git] / kvm / libkvm / libkvm-powerpc.c
blobaaebfef61e5fdd7390001ec8515c7111d3619342
1 /*
2 * This header is for functions & variables that will ONLY be
3 * used inside libkvm for x86.
4 * THESE ARE NOT EXPOSED TO THE USER AND ARE ONLY FOR USE
5 * WITHIN LIBKVM.
7 * derived from libkvm.c
9 * Copyright (C) 2006 Qumranet, Inc.
11 * Authors:
12 * Avi Kivity <avi@qumranet.com>
13 * Yaniv Kamay <yaniv@qumranet.com>
15 * Copyright 2007 IBM Corporation.
16 * Added by & Authors:
17 * Jerone Young <jyoung5@us.ibm.com>
18 * Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
21 * This work is licensed under the GNU LGPL license, version 2.
24 #include "libkvm.h"
25 #include "kvm-powerpc.h"
26 #include <errno.h>
27 #include <stdio.h>
28 #include <inttypes.h>
30 int handle_dcr(struct kvm_run *run, kvm_context_t kvm, int vcpu)
32 int ret = 0;
34 if (run->dcr.is_write)
35 ret = kvm->callbacks->powerpc_dcr_write(vcpu,
36 run->dcr.dcrn,
37 run->dcr.data);
38 else
39 ret = kvm->callbacks->powerpc_dcr_read(vcpu,
40 run->dcr.dcrn,
41 &(run->dcr.data));
43 return ret;
46 void kvm_show_code(kvm_context_t kvm, int vcpu)
48 fprintf(stderr, "%s: Operation not supported\n", __FUNCTION__);
51 void kvm_show_regs(kvm_context_t kvm, int vcpu)
53 struct kvm_regs regs;
54 int i;
56 if (kvm_get_regs(kvm, vcpu, &regs))
57 return;
59 fprintf(stderr,"guest vcpu #%d\n", vcpu);
60 fprintf(stderr,"pc: %016"PRIx64" msr: %016"PRIx64"\n",
61 regs.pc, regs.msr);
62 fprintf(stderr,"lr: %016"PRIx64" ctr: %016"PRIx64"\n",
63 regs.lr, regs.ctr);
64 fprintf(stderr,"srr0: %016"PRIx64" srr1: %016"PRIx64"\n",
65 regs.srr0, regs.srr1);
66 for (i=0; i<32; i+=4)
68 fprintf(stderr, "gpr%02d: %016"PRIx64" %016"PRIx64" %016"PRIx64
69 " %016"PRIx64"\n", i,
70 regs.gpr[i],
71 regs.gpr[i+1],
72 regs.gpr[i+2],
73 regs.gpr[i+3]);
76 fflush(stdout);
79 int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
80 void **vm_mem)
82 int r;
84 r = kvm_init_coalesced_mmio(kvm);
85 if (r < 0)
86 return r;
88 return 0;
91 int kvm_arch_run(struct kvm_run *run, kvm_context_t kvm, int vcpu)
93 int ret = 0;
95 switch (run->exit_reason){
96 case KVM_EXIT_DCR:
97 ret = handle_dcr(run, kvm, vcpu);
98 break;
99 default:
100 ret = 1;
101 break;
103 return ret;