kvm: qemu: work around dhclient brokenness
[kvm-userspace.git] / libkvm / libkvm-s390.c
blobb3e4e92f005cc150a53c7818e0e8a6cd6152c129
1 /*
2 * This file contains the s390 specific implementation for the
3 * architecture dependent functions defined in kvm-common.h and
4 * libkvm.h
6 * Copyright (C) 2006 Qumranet
7 * Copyright IBM Corp. 2008
9 * Authors:
10 * Carsten Otte <cotte@de.ibm.com>
11 * Christian Borntraeger <borntraeger@de.ibm.com>
13 * This work is licensed under the GNU LGPL license, version 2.
16 #include <sys/ioctl.h>
17 #include <asm/ptrace.h>
19 #include "libkvm.h"
20 #include "kvm-common.h"
21 #include <errno.h>
22 #include <stdio.h>
23 #include <inttypes.h>
25 int kvm_alloc_kernel_memory(kvm_context_t kvm, unsigned long memory,
26 void **vm_mem)
28 fprintf(stderr, "%s: Operation not supported\n", __FUNCTION__);
29 return -1;
32 void *kvm_create_kernel_phys_mem(kvm_context_t kvm, unsigned long phys_start,
33 unsigned long len, int log, int writable)
35 fprintf(stderr, "%s: Operation not supported\n", __FUNCTION__);
36 return NULL;
39 void kvm_show_code(kvm_context_t kvm, int vcpu)
41 fprintf(stderr, "%s: Operation not supported\n", __FUNCTION__);
44 void kvm_show_regs(kvm_context_t kvm, int vcpu)
46 struct kvm_regs regs;
47 struct kvm_sregs sregs;
48 int i;
50 if (kvm_get_regs(kvm, vcpu, &regs))
51 return;
53 if (kvm_get_sregs(kvm, vcpu, &sregs))
54 return;
56 fprintf(stderr, "guest vcpu #%d\n", vcpu);
57 fprintf(stderr, "PSW:\t%16.16lx %16.16lx\n",
58 kvm->run[vcpu]->s390_sieic.mask,
59 kvm->run[vcpu]->s390_sieic.addr);
60 fprintf(stderr,"GPRS:");
61 for (i=0; i<15; i+=4)
62 fprintf(stderr, "\t%16.16lx %16.16lx %16.16lx %16.16lx\n",
63 regs.gprs[i],
64 regs.gprs[i+1],
65 regs.gprs[i+2],
66 regs.gprs[i+3]);
67 fprintf(stderr,"ACRS:");
68 for (i=0; i<15; i+=4)
69 fprintf(stderr, "\t%8.8x %8.8x %8.8x %8.8x\n",
70 sregs.acrs[i],
71 sregs.acrs[i+1],
72 sregs.acrs[i+2],
73 sregs.acrs[i+3]);
75 fprintf(stderr,"CRS:");
76 for (i=0; i<15; i+=4)
77 fprintf(stderr, "\t%16.16lx %16.16lx %16.16lx %16.16lx\n",
78 sregs.crs[i],
79 sregs.crs[i+1],
80 sregs.crs[i+2],
81 sregs.crs[i+3]);
84 int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
85 void **vm_mem)
87 return 0;
90 int kvm_arch_create_default_phys_mem(kvm_context_t kvm,
91 unsigned long phys_mem_bytes,
92 void **vm_mem)
94 return 0;
97 int kvm_arch_run(struct kvm_run *run, kvm_context_t kvm, int vcpu)
99 int ret = 0;
101 switch (run->exit_reason){
102 default:
103 ret = 1;
104 break;
106 return ret;
109 int kvm_s390_initial_reset(kvm_context_t kvm, int slot)
111 return ioctl(kvm->vcpu_fd[slot], KVM_S390_INITIAL_RESET, NULL);
114 int kvm_s390_interrupt(kvm_context_t kvm, int slot,
115 struct kvm_s390_interrupt *kvmint)
117 if (slot>=0)
118 return ioctl(kvm->vcpu_fd[slot], KVM_S390_INTERRUPT, kvmint);
119 else
120 return ioctl(kvm->vm_fd, KVM_S390_INTERRUPT, kvmint);
123 int kvm_s390_set_initial_psw(kvm_context_t kvm, int slot, psw_t psw)
125 return ioctl(kvm->vcpu_fd[slot], KVM_S390_SET_INITIAL_PSW, &psw);
128 int kvm_s390_store_status(kvm_context_t kvm, int slot, unsigned long addr)
130 return ioctl(kvm->vcpu_fd[slot], KVM_S390_STORE_STATUS, addr);