diff options
author | David Daney <david.daney@cavium.com> | 2013-05-23 12:49:08 -0400 |
---|---|---|
committer | Gleb Natapov <gleb@redhat.com> | 2013-06-03 03:58:53 -0400 |
commit | 8d17dd041a548b016ff401d36be6b2563c940ed5 (patch) | |
tree | 11c612dc66c96e619c141f8f82f41a0b3e637eac /arch | |
parent | bf32ebf66d74e8a196256d7ac2a4f3c6938c614a (diff) |
mips/kvm: Use ARRAY_SIZE() instead of hardcoded constants in kvm_arch_vcpu_ioctl_{s,g}et_regs
Also we cannot set special zero register, so force it to zero.
Signed-off-by: David Daney <david.daney@cavium.com>
Acked-by: Sanjay Lal <sanjayl@kymasys.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/kvm/kvm_mips.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c index 93da7508c6b6..71a1fc191078 100644 --- a/arch/mips/kvm/kvm_mips.c +++ b/arch/mips/kvm/kvm_mips.c | |||
@@ -677,9 +677,9 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) | |||
677 | { | 677 | { |
678 | int i; | 678 | int i; |
679 | 679 | ||
680 | for (i = 0; i < 32; i++) | 680 | for (i = 1; i < ARRAY_SIZE(vcpu->arch.gprs); i++) |
681 | vcpu->arch.gprs[i] = regs->gpr[i]; | 681 | vcpu->arch.gprs[i] = regs->gpr[i]; |
682 | 682 | vcpu->arch.gprs[0] = 0; /* zero is special, and cannot be set. */ | |
683 | vcpu->arch.hi = regs->hi; | 683 | vcpu->arch.hi = regs->hi; |
684 | vcpu->arch.lo = regs->lo; | 684 | vcpu->arch.lo = regs->lo; |
685 | vcpu->arch.pc = regs->pc; | 685 | vcpu->arch.pc = regs->pc; |
@@ -691,7 +691,7 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) | |||
691 | { | 691 | { |
692 | int i; | 692 | int i; |
693 | 693 | ||
694 | for (i = 0; i < 32; i++) | 694 | for (i = 0; i < ARRAY_SIZE(vcpu->arch.gprs); i++) |
695 | regs->gpr[i] = vcpu->arch.gprs[i]; | 695 | regs->gpr[i] = vcpu->arch.gprs[i]; |
696 | 696 | ||
697 | regs->hi = vcpu->arch.hi; | 697 | regs->hi = vcpu->arch.hi; |