aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2010-03-24 16:48:27 -0400
committerAvi Kivity <avi@redhat.com>2010-05-17 05:17:06 -0400
commit1c85e73303fa70cd6bc2bf138484acb4ffe30efd (patch)
tree3cea3df0bdc1ed14181f05c4e208bda88f550d75 /arch/powerpc/kvm
parent1bec1677ca5b3406dc1f174b61beaeb832eed715 (diff)
KVM: PPC: Implement emulation for lbzux and lhax
We get MMIOs with the weirdest instructions. But every time we do, we need to improve our emulator to implement them. So let's do that - this time it's lbzux and lhax's round. Signed-off-by: Alexander Graf <agraf@suse.de> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm')
-rw-r--r--arch/powerpc/kvm/emulate.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index 2410ec2a756a..dbb5d6842a51 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -38,10 +38,12 @@
38#define OP_31_XOP_LBZX 87 38#define OP_31_XOP_LBZX 87
39#define OP_31_XOP_STWX 151 39#define OP_31_XOP_STWX 151
40#define OP_31_XOP_STBX 215 40#define OP_31_XOP_STBX 215
41#define OP_31_XOP_LBZUX 119
41#define OP_31_XOP_STBUX 247 42#define OP_31_XOP_STBUX 247
42#define OP_31_XOP_LHZX 279 43#define OP_31_XOP_LHZX 279
43#define OP_31_XOP_LHZUX 311 44#define OP_31_XOP_LHZUX 311
44#define OP_31_XOP_MFSPR 339 45#define OP_31_XOP_MFSPR 339
46#define OP_31_XOP_LHAX 343
45#define OP_31_XOP_STHX 407 47#define OP_31_XOP_STHX 407
46#define OP_31_XOP_STHUX 439 48#define OP_31_XOP_STHUX 439
47#define OP_31_XOP_MTSPR 467 49#define OP_31_XOP_MTSPR 467
@@ -173,6 +175,19 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
173 emulated = kvmppc_handle_load(run, vcpu, rt, 1, 1); 175 emulated = kvmppc_handle_load(run, vcpu, rt, 1, 1);
174 break; 176 break;
175 177
178 case OP_31_XOP_LBZUX:
179 rt = get_rt(inst);
180 ra = get_ra(inst);
181 rb = get_rb(inst);
182
183 ea = kvmppc_get_gpr(vcpu, rb);
184 if (ra)
185 ea += kvmppc_get_gpr(vcpu, ra);
186
187 emulated = kvmppc_handle_load(run, vcpu, rt, 1, 1);
188 kvmppc_set_gpr(vcpu, ra, ea);
189 break;
190
176 case OP_31_XOP_STWX: 191 case OP_31_XOP_STWX:
177 rs = get_rs(inst); 192 rs = get_rs(inst);
178 emulated = kvmppc_handle_store(run, vcpu, 193 emulated = kvmppc_handle_store(run, vcpu,
@@ -202,6 +217,11 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
202 kvmppc_set_gpr(vcpu, rs, ea); 217 kvmppc_set_gpr(vcpu, rs, ea);
203 break; 218 break;
204 219
220 case OP_31_XOP_LHAX:
221 rt = get_rt(inst);
222 emulated = kvmppc_handle_loads(run, vcpu, rt, 2, 1);
223 break;
224
205 case OP_31_XOP_LHZX: 225 case OP_31_XOP_LHZX:
206 rt = get_rt(inst); 226 rt = get_rt(inst);
207 emulated = kvmppc_handle_load(run, vcpu, rt, 2, 1); 227 emulated = kvmppc_handle_load(run, vcpu, rt, 2, 1);