test: Run tests with asid 1
[qemu/qemu-dev-zwu.git] / kvm / libkvm / libkvm-s390.c
blob041c0ce31870d5320b10447ce0092954c3b6f8c4
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 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)
32 struct kvm_regs regs;
33 struct kvm_sregs sregs;
34 int i;
36 if (kvm_get_regs(kvm, vcpu, &regs))
37 return;
39 if (kvm_get_sregs(kvm, vcpu, &sregs))
40 return;
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:");
47 for (i=0; i<15; i+=4)
48 fprintf(stderr, "\t%16.16lx %16.16lx %16.16lx %16.16lx\n",
49 regs.gprs[i],
50 regs.gprs[i+1],
51 regs.gprs[i+2],
52 regs.gprs[i+3]);
53 fprintf(stderr,"ACRS:");
54 for (i=0; i<15; i+=4)
55 fprintf(stderr, "\t%8.8x %8.8x %8.8x %8.8x\n",
56 sregs.acrs[i],
57 sregs.acrs[i+1],
58 sregs.acrs[i+2],
59 sregs.acrs[i+3]);
61 fprintf(stderr,"CRS:");
62 for (i=0; i<15; i+=4)
63 fprintf(stderr, "\t%16.16lx %16.16lx %16.16lx %16.16lx\n",
64 sregs.crs[i],
65 sregs.crs[i+1],
66 sregs.crs[i+2],
67 sregs.crs[i+3]);
70 int kvm_arch_create(kvm_context_t kvm, unsigned long phys_mem_bytes,
71 void **vm_mem)
73 return 0;
76 int kvm_arch_run(struct kvm_run *run, kvm_context_t kvm, int vcpu)
78 int ret = 0;
80 switch (run->exit_reason){
81 default:
82 ret = 1;
83 break;
85 return ret;
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)
96 if (slot>=0)
97 return ioctl(kvm->vcpu_fd[slot], KVM_S390_INTERRUPT, kvmint);
98 else
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);