2 * This file contains the s390 specific implementation for the
3 * architecture dependent functions defined in kvm-common.h and
6 * Copyright (C) 2006 Qumranet
7 * Copyright IBM Corp. 2008
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>
20 #include "kvm-common.h"
25 void kvm_show_code(kvm_context_t kvm
, int vcpu
)
27 fprintf(stderr
, "%s: Operation not supported\n", __FUNCTION__
);
30 void kvm_show_regs(kvm_context_t kvm
, int vcpu
)
33 struct kvm_sregs sregs
;
36 if (kvm_get_regs(kvm
, vcpu
, ®s
))
39 if (kvm_get_sregs(kvm
, vcpu
, &sregs
))
42 fprintf(stderr
, "guest vcpu #%d\n", vcpu
);
43 fprintf(stderr
, "PSW:\t%16.16lx %16.16lx\n",
44 kvm
->run
[vcpu
]->s390_sieic
.mask
,
45 kvm
->run
[vcpu
]->s390_sieic
.addr
);
46 fprintf(stderr
,"GPRS:");
48 fprintf(stderr
, "\t%16.16lx %16.16lx %16.16lx %16.16lx\n",
53 fprintf(stderr
,"ACRS:");
55 fprintf(stderr
, "\t%8.8x %8.8x %8.8x %8.8x\n",
61 fprintf(stderr
,"CRS:");
63 fprintf(stderr
, "\t%16.16lx %16.16lx %16.16lx %16.16lx\n",
70 int kvm_arch_create(kvm_context_t kvm
, unsigned long phys_mem_bytes
,
76 int kvm_arch_run(struct kvm_run
*run
, kvm_context_t kvm
, int vcpu
)
80 switch (run
->exit_reason
){
88 int kvm_s390_initial_reset(kvm_context_t kvm
, int slot
)
90 return ioctl(kvm
->vcpu_fd
[slot
], KVM_S390_INITIAL_RESET
, NULL
);
93 int kvm_s390_interrupt(kvm_context_t kvm
, int slot
,
94 struct kvm_s390_interrupt
*kvmint
)
97 return ioctl(kvm
->vcpu_fd
[slot
], KVM_S390_INTERRUPT
, kvmint
);
99 return ioctl(kvm
->vm_fd
, KVM_S390_INTERRUPT
, kvmint
);
102 int kvm_s390_set_initial_psw(kvm_context_t kvm
, int slot
, psw_t psw
)
104 return ioctl(kvm
->vcpu_fd
[slot
], KVM_S390_SET_INITIAL_PSW
, &psw
);
107 int kvm_s390_store_status(kvm_context_t kvm
, int slot
, unsigned long addr
)
109 return ioctl(kvm
->vcpu_fd
[slot
], KVM_S390_STORE_STATUS
, addr
);