diff options
author | Alexander Graf <agraf@suse.de> | 2012-05-04 08:55:12 -0400 |
---|---|---|
committer | Alexander Graf <agraf@suse.de> | 2012-05-06 10:19:13 -0400 |
commit | 54771e6217ce05a474827d9b23ff03de9d2ef2a0 (patch) | |
tree | 4555f93d29863b6c0bbd4be61c60bfe7b80ce6c9 /arch/powerpc/kvm/booke.h | |
parent | c46dc9a86148bc37c31d67a22a3887144ba7aa81 (diff) |
KVM: PPC: Emulator: clean up SPR reads and writes
When reading and writing SPRs, every SPR emulation piece had to read
or write the respective GPR the value was read from or stored in itself.
This approach is pretty prone to failure. What if we accidentally
implement mfspr emulation where we just do "break" and nothing else?
Suddenly we would get a random value in the return register - which is
always a bad idea.
So let's consolidate the generic code paths and only give the core
specific SPR handling code readily made variables to read/write from/to.
Functionally, this patch doesn't change anything, but it increases the
readability of the code and makes is less prone to bugs.
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm/booke.h')
-rw-r--r-- | arch/powerpc/kvm/booke.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/powerpc/kvm/booke.h b/arch/powerpc/kvm/booke.h index 62c4fe55d19b..ba61974c1e20 100644 --- a/arch/powerpc/kvm/booke.h +++ b/arch/powerpc/kvm/booke.h | |||
@@ -75,8 +75,8 @@ void kvmppc_clr_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits); | |||
75 | 75 | ||
76 | int kvmppc_booke_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, | 76 | int kvmppc_booke_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, |
77 | unsigned int inst, int *advance); | 77 | unsigned int inst, int *advance); |
78 | int kvmppc_booke_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt); | 78 | int kvmppc_booke_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val); |
79 | int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, int rs); | 79 | int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val); |
80 | 80 | ||
81 | /* low-level asm code to transfer guest state */ | 81 | /* low-level asm code to transfer guest state */ |
82 | void kvmppc_load_guest_spe(struct kvm_vcpu *vcpu); | 82 | void kvmppc_load_guest_spe(struct kvm_vcpu *vcpu); |