From: James Hogan <james.hogan@imgtec.com>
To: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>
Cc: James Hogan <james.hogan@imgtec.com>,
Leon Alrae <leon.alrae@imgtec.com>,
kvm@vger.kernel.org, Aurelien Jarno <aurelien@aurel32.net>,
qemu-stable@nongnu.org
Subject: [Qemu-devel] [PATCH 1/2] mips/kvm: Fix Big endian 32-bit register access
Date: Fri, 24 Apr 2015 11:26:52 +0100 [thread overview]
Message-ID: <1429871214-23514-2-git-send-email-james.hogan@imgtec.com> (raw)
In-Reply-To: <1429871214-23514-1-git-send-email-james.hogan@imgtec.com>
Fix access to 32-bit registers on big endian targets. The pointer passed
to the kernel must be for the actual 32-bit value, not a temporary
64-bit value, otherwise on big endian systems the kernel will only
interpret the upper half.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Leon Alrae <leon.alrae@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: kvm@vger.kernel.org
Cc: qemu-stable@nongnu.org
---
target-mips/kvm.c | 13 +++----------
1 file changed, 3 insertions(+), 10 deletions(-)
diff --git a/target-mips/kvm.c b/target-mips/kvm.c
index 4d1f7ead8142..1597bbeac17a 100644
--- a/target-mips/kvm.c
+++ b/target-mips/kvm.c
@@ -240,10 +240,9 @@ int kvm_mips_set_ipi_interrupt(MIPSCPU *cpu, int irq, int level)
static inline int kvm_mips_put_one_reg(CPUState *cs, uint64_t reg_id,
int32_t *addr)
{
- uint64_t val64 = *addr;
struct kvm_one_reg cp0reg = {
.id = reg_id,
- .addr = (uintptr_t)&val64
+ .addr = (uintptr_t)addr
};
return kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, &cp0reg);
@@ -275,18 +274,12 @@ static inline int kvm_mips_put_one_reg64(CPUState *cs, uint64_t reg_id,
static inline int kvm_mips_get_one_reg(CPUState *cs, uint64_t reg_id,
int32_t *addr)
{
- int ret;
- uint64_t val64 = 0;
struct kvm_one_reg cp0reg = {
.id = reg_id,
- .addr = (uintptr_t)&val64
+ .addr = (uintptr_t)addr
};
- ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, &cp0reg);
- if (ret >= 0) {
- *addr = val64;
- }
- return ret;
+ return kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, &cp0reg);
}
static inline int kvm_mips_get_one_ulreg(CPUState *cs, uint64 reg_id,
--
2.0.5
next prev parent reply other threads:[~2015-04-24 10:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-24 10:26 [Qemu-devel] [PATCH 0/2] mips/kvm: Fixes for big endian & MIPS64 hosts James Hogan
2015-04-24 10:26 ` James Hogan [this message]
2015-04-24 10:26 ` [Qemu-devel] [PATCH 2/2] mips/kvm: Sign extend registers written to KVM James Hogan
2015-07-08 15:03 ` [Qemu-devel] [PATCH 0/2] mips/kvm: Fixes for big endian & MIPS64 hosts James Hogan
2015-07-08 15:22 ` Paolo Bonzini
2015-07-09 8:13 ` Leon Alrae
2015-07-09 13:49 ` Paolo Bonzini
2015-07-09 13:58 ` Peter Maydell
2015-07-09 14:00 ` Peter Maydell
2015-07-09 14:00 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1429871214-23514-2-git-send-email-james.hogan@imgtec.com \
--to=james.hogan@imgtec.com \
--cc=aurelien@aurel32.net \
--cc=kvm@vger.kernel.org \
--cc=leon.alrae@imgtec.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).