kvm: qemu: handle SEJ notifications
[kvm-userspace.git] / libkvm / libkvm-powerpc.c
blobe51303ac8f46b2e88a1a8242872b40054c3ae24d
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>
29 int handle_dcr(struct kvm_run *run, kvm_context_t kvm, int vcpu)
31 int ret = 0;
33 if (run->dcr.is_write)
34 ret = kvm->callbacks->powerpc_dcr_write(vcpu,
35 run->dcr.dcrn,
36 run->dcr.data);
37 else
38 ret = kvm->callbacks->powerpc_dcr_read(vcpu,
39 run->dcr.dcrn,
40 &(run->dcr.data));
42 return ret;
45 int kvm_alloc_kernel_memory(kvm_context_t kvm, unsigned long memory,
46 void **vm_mem)
48 fprintf(stderr, "%s: Operation not supported\n", __FUNCTION__);
49 return -1;
52 void *kvm_create_kernel_phys_mem(kvm_context_t kvm, unsigned long phys_start,
53 unsigned long len, int log, int writable)
55 fprintf(stderr, "%s: Operation not supported\n", __FUNCTION__);
56 return NULL;
59 void kvm_show_code(kvm_context_t kvm, int vcpu)
61 fprintf(stderr, "%s: Operation not supported\n", __FUNCTION__);
64 void kvm_show_regs(kvm_context_t kvm, int vcpu)
66 struct kvm_regs regs;
67 int i;
69 if (kvm_get_regs(kvm, vcpu, &regs))
70 return;
72 fprintf(stderr,"guest vcpu #%d\n", vcpu);
73 fprintf(stderr,"pc: %08x msr: %08x\n", regs.pc, regs.msr);
74 fprintf(stderr,"lr: %08x ctr: %08x\n", regs.lr, regs.ctr);
75 fprintf(stderr,"srr0: %08x srr1: %08x\n", regs.srr0, regs.srr1);
76 for (i=0; i<32; i+=4)
78 fprintf(stderr, "gpr%02d: %08x %08x %08x %08x\n", i,
79 regs.gpr[i],
80 regs.gpr[i+1],
81 regs.gpr[i+2],
82 regs.gpr[i+3]);
85 fflush(stdout);
88 int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
89 void **vm_mem)
91 return 0;
94 int kvm_arch_create_default_phys_mem(kvm_context_t kvm,
95 unsigned long phys_mem_bytes,
96 void **vm_mem)
98 return 0;
101 int kvm_arch_run(struct kvm_run *run, kvm_context_t kvm, int vcpu)
103 int ret = 0;
105 switch (run->exit_reason){
106 case KVM_EXIT_DCR:
107 ret = handle_dcr(run, kvm, vcpu);
108 break;
109 default:
110 ret = 1;
111 break;
113 return ret;