intercept.c (48a3e950f4cee6a345ffbe9baf599f1e9a54c479) intercept.c (f379aae558b8daff0f7a1c5fc225af5d35c741f7)
1/*
2 * in-kernel handling for sie intercepts
3 *
4 * Copyright IBM Corp. 2008, 2009
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2 only)
8 * as published by the Free Software Foundation.

--- 16 unchanged lines hidden (view full) ---

25static int handle_lctlg(struct kvm_vcpu *vcpu)
26{
27 int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4;
28 int reg3 = vcpu->arch.sie_block->ipa & 0x000f;
29 u64 useraddr;
30 int reg, rc;
31
32 vcpu->stat.instruction_lctlg++;
1/*
2 * in-kernel handling for sie intercepts
3 *
4 * Copyright IBM Corp. 2008, 2009
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2 only)
8 * as published by the Free Software Foundation.

--- 16 unchanged lines hidden (view full) ---

25static int handle_lctlg(struct kvm_vcpu *vcpu)
26{
27 int reg1 = (vcpu->arch.sie_block->ipa & 0x00f0) >> 4;
28 int reg3 = vcpu->arch.sie_block->ipa & 0x000f;
29 u64 useraddr;
30 int reg, rc;
31
32 vcpu->stat.instruction_lctlg++;
33 if ((vcpu->arch.sie_block->ipb & 0xff) != 0x2f)
34 return -EOPNOTSUPP;
35
36 useraddr = kvm_s390_get_base_disp_rsy(vcpu);
37
38 if (useraddr & 7)
39 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
40
41 reg = reg1;
42

--- 47 unchanged lines hidden (view full) ---

90 useraddr += 4;
91 if (reg == reg3)
92 break;
93 reg = (reg + 1) % 16;
94 } while (1);
95 return 0;
96}
97
33
34 useraddr = kvm_s390_get_base_disp_rsy(vcpu);
35
36 if (useraddr & 7)
37 return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
38
39 reg = reg1;
40

--- 47 unchanged lines hidden (view full) ---

88 useraddr += 4;
89 if (reg == reg3)
90 break;
91 reg = (reg + 1) % 16;
92 } while (1);
93 return 0;
94}
95
96static const intercept_handler_t eb_handlers[256] = {
97 [0x2f] = handle_lctlg,
98 [0x8a] = kvm_s390_handle_priv_eb,
99};
100
101static int handle_eb(struct kvm_vcpu *vcpu)
102{
103 intercept_handler_t handler;
104
105 handler = eb_handlers[vcpu->arch.sie_block->ipb & 0xff];
106 if (handler)
107 return handler(vcpu);
108 return -EOPNOTSUPP;
109}
110
98static const intercept_handler_t instruction_handlers[256] = {
99 [0x01] = kvm_s390_handle_01,
100 [0x82] = kvm_s390_handle_lpsw,
101 [0x83] = kvm_s390_handle_diag,
102 [0xae] = kvm_s390_handle_sigp,
103 [0xb2] = kvm_s390_handle_b2,
104 [0xb7] = handle_lctl,
105 [0xb9] = kvm_s390_handle_b9,
106 [0xe5] = kvm_s390_handle_e5,
111static const intercept_handler_t instruction_handlers[256] = {
112 [0x01] = kvm_s390_handle_01,
113 [0x82] = kvm_s390_handle_lpsw,
114 [0x83] = kvm_s390_handle_diag,
115 [0xae] = kvm_s390_handle_sigp,
116 [0xb2] = kvm_s390_handle_b2,
117 [0xb7] = handle_lctl,
118 [0xb9] = kvm_s390_handle_b9,
119 [0xe5] = kvm_s390_handle_e5,
107 [0xeb] = handle_lctlg,
120 [0xeb] = handle_eb,
108};
109
110static int handle_noop(struct kvm_vcpu *vcpu)
111{
112 switch (vcpu->arch.sie_block->icptcode) {
113 case 0x0:
114 vcpu->stat.exit_null++;
115 break;

--- 155 unchanged lines hidden ---
121};
122
123static int handle_noop(struct kvm_vcpu *vcpu)
124{
125 switch (vcpu->arch.sie_block->icptcode) {
126 case 0x0:
127 vcpu->stat.exit_null++;
128 break;

--- 155 unchanged lines hidden ---