All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Duncan Sands <baldrick@free.fr>
Cc: Zachary Amsden <zamsden@gmail.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	KVM list <kvm@vger.kernel.org>,
	Marcelo Tosatti <mtosatti@redhat.com>
Subject: Re: [PATCH x86 kvm] Fix register corruption in pvclock_scale_delta
Date: Tue, 30 Aug 2011 14:39:55 +0300	[thread overview]
Message-ID: <4E5CCC0B.2010900@redhat.com> (raw)
In-Reply-To: <4E5CA62E.8060304@free.fr>

On 08/30/2011 11:58 AM, Duncan Sands wrote:
> Hi Zachary, this patch can cause a compile failure if the compiler 
> chooses to
> use a memory location for mul_frac rather than a register (as allowed 
> by the
> "m" in the constraints):
>
>   pvclock.s:229: Error: no instruction mnemonic suffix given and no 
> register operands; can't size instruction
>
> In this example the assembler is:
>
>         #APP
>         mul -48(%rbp) ; shrd $32, %rdx, %rax
>         #NO_APP
>
> A simple solution is to use mulq, as in the following patch:
>
> Signed-off-by: Duncan Sands <baldrick@free.fr>
>
> --- a/arch/x86/include/asm/pvclock.h
> +++ b/arch/x86/include/asm/pvclock.h
> @@ -44,7 +44,7 @@ static inline u64 pvclock_scale_delta(u64 delta, u32 
> mul_frac, int shift)
>                 : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" 
> (mul_frac) );
>  #elif defined(__x86_64__)
>         __asm__ (
> -               "mul %[mul_frac] ; shrd $32, %[hi], %[lo]"
> +               "mulq %[mul_frac] ; shrd $32, %[hi], %[lo]"
>                 : [lo]"=a"(product),
>                   [hi]"=d"(tmp)
>                 : "0"(delta),

Thanks, applied.

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2011-08-30 11:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-30  8:58 [PATCH x86 kvm] Fix register corruption in pvclock_scale_delta Duncan Sands
2011-08-30 11:39 ` Avi Kivity [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-06-16  3:50 Zachary Amsden
2011-06-19 12:44 ` Avi Kivity
2011-06-22  9:35   ` Ian Campbell
2011-06-22  9:39     ` Avi Kivity
2011-06-22  9:40     ` Avi Kivity
2011-06-22  9:52       ` Ian Campbell

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=4E5CCC0B.2010900@redhat.com \
    --to=avi@redhat.com \
    --cc=baldrick@free.fr \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=zamsden@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.