public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, drjones@redhat.com,
	pbonzini@redhat.com
Cc: dgibson@redhat.com, lvivier@redhat.com
Subject: [kvm-unit-tests PATCH] powerpc/spapr_hcall: Fix assembler constraints of the h_random h-call
Date: Thu,  3 Mar 2016 12:23:08 +0100	[thread overview]
Message-ID: <1457004188-17186-1-git-send-email-thuth@redhat.com> (raw)

As noted by Laurent Vivier, a register that is marked with "+r" as
input and output is not required to be listed in the set of input
registers anymore.
And as noted by David Gibson, the sPAPR hypercall is also allowed to
clobber a bunch of other registers. According to the LoPAPR spec,
r0 and r3-r12, CTR, XER and CC registers are volatile, so we should
mark them in the clobber list.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 powerpc/spapr_hcall.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/powerpc/spapr_hcall.c b/powerpc/spapr_hcall.c
index 46731e1..dbff630 100644
--- a/powerpc/spapr_hcall.c
+++ b/powerpc/spapr_hcall.c
@@ -96,7 +96,9 @@ static int h_random(uint64_t *val)
 	register uint64_t r3 asm("r3") = H_RANDOM;
 	register uint64_t r4 asm("r4");
 
-	asm volatile (" sc 1 " : "+r"(r3), "=r"(r4) : "r"(r3));
+	asm volatile (" sc 1 "	: "+r"(r3), "=r"(r4) :
+				: "r0", "r5", "r6", "r7", "r8", "r9", "r10",
+				  "r11", "r12", "xer", "ctr", "cc");
 	*val = r4;
 
 	return r3;
-- 
1.8.3.1


             reply	other threads:[~2016-03-03 11:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03 11:23 Thomas Huth [this message]
2016-03-03 12:58 ` [kvm-unit-tests PATCH] powerpc/spapr_hcall: Fix assembler constraints of the h_random h-call 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=1457004188-17186-1-git-send-email-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=dgibson@redhat.com \
    --cc=drjones@redhat.com \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    /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