All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Laurent Vivier <lvivier@redhat.com>,
	kvm@vger.kernel.org
Cc: kvm-ppc@vger.kernel.org, drjones@redhat.com
Subject: Re: [kvm-unit-test PATCH v2] powerpc: Add emulator test for the lswi instruction
Date: Tue, 10 May 2016 15:23:15 +0000	[thread overview]
Message-ID: <5731FCE3.6010107@redhat.com> (raw)
In-Reply-To: <5731CE9B.9060904@redhat.com>

On 10.05.2016 14:05, Paolo Bonzini wrote:
> 
> 
> On 20/04/2016 11:24, Thomas Huth wrote:
>>>> +		      ".long 0x7fe154aa\n"       /* lswi r31, r1, 10 */
>>>
>>> Perhaps you can add a comment explaining why you are using a .long
>>> instead of the mnemonic?
>>
>> The compiler is smart enough to detect that r1 is in the range of
>> registers that get clobbered, and thus rejects that mnemonic. You
>> quickly notice that when replacing the .long with the mnemonic, so I'm
>> not sure whether it's worth to add a verbose comment here... Paolo, what
>> do you prefer?
> 
> The assembler does this, not the compiler.

Right, of course.

> Is this a valid operation at all, or is it undefined?  (aka, what
> does it do on real hardware)? O_o

The specification (PowerISA) says "If RA is in the range of registers to
be loaded, including the case in which RA=0, the instruction form is
invalid." ... which sounds like the CPU is supposed to raise an invalid
instruction exception.

However, on real hardware (POWER8), the CPU simply stops before loading
that register and continues with the next instruction. In any case, the
contents of the RA register should not be destroyed, and this is what
we're testing here. (and this is also already mentioned in a comment
later in the patch already, right before the report() line).

 Thomas


WARNING: multiple messages have this Message-ID (diff)
From: Thomas Huth <thuth@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Laurent Vivier <lvivier@redhat.com>,
	kvm@vger.kernel.org
Cc: kvm-ppc@vger.kernel.org, drjones@redhat.com
Subject: Re: [kvm-unit-test PATCH v2] powerpc: Add emulator test for the lswi instruction
Date: Tue, 10 May 2016 17:23:15 +0200	[thread overview]
Message-ID: <5731FCE3.6010107@redhat.com> (raw)
In-Reply-To: <5731CE9B.9060904@redhat.com>

On 10.05.2016 14:05, Paolo Bonzini wrote:
> 
> 
> On 20/04/2016 11:24, Thomas Huth wrote:
>>>> +		      ".long 0x7fe154aa\n"       /* lswi r31, r1, 10 */
>>>
>>> Perhaps you can add a comment explaining why you are using a .long
>>> instead of the mnemonic?
>>
>> The compiler is smart enough to detect that r1 is in the range of
>> registers that get clobbered, and thus rejects that mnemonic. You
>> quickly notice that when replacing the .long with the mnemonic, so I'm
>> not sure whether it's worth to add a verbose comment here... Paolo, what
>> do you prefer?
> 
> The assembler does this, not the compiler.

Right, of course.

> Is this a valid operation at all, or is it undefined?  (aka, what
> does it do on real hardware)? O_o

The specification (PowerISA) says "If RA is in the range of registers to
be loaded, including the case in which RA=0, the instruction form is
invalid." ... which sounds like the CPU is supposed to raise an invalid
instruction exception.

However, on real hardware (POWER8), the CPU simply stops before loading
that register and continues with the next instruction. In any case, the
contents of the RA register should not be destroyed, and this is what
we're testing here. (and this is also already mentioned in a comment
later in the patch already, right before the report() line).

 Thomas


  reply	other threads:[~2016-05-10 15:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-14 14:49 [kvm-unit-test PATCH v2] powerpc: Add emulator test for the lswi instruction Thomas Huth
2016-04-14 14:49 ` Thomas Huth
2016-04-19 12:51 ` Laurent Vivier
2016-04-19 12:51   ` Laurent Vivier
2016-04-20  9:24   ` Thomas Huth
2016-04-20  9:24     ` Thomas Huth
2016-05-10 12:05     ` Paolo Bonzini
2016-05-10 12:05       ` Paolo Bonzini
2016-05-10 15:23       ` Thomas Huth [this message]
2016-05-10 15:23         ` Thomas Huth

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=5731FCE3.6010107@redhat.com \
    --to=thuth@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 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.