From: Thomas Huth <thuth@redhat.com>
To: Laurent Vivier <lvivier@redhat.com>,
kvm@vger.kernel.org, kvm-ppc@vger.kernel.org
Cc: drjones@redhat.com, dgibson@redhat.com, pbonzini@redhat.com
Subject: Re: [kvm-unit-tests PATCH 5/5] powerpc: Check lswx in little-endian mode.
Date: Fri, 18 Mar 2016 09:54:58 +0000 [thread overview]
Message-ID: <56EBD072.6000301@redhat.com> (raw)
In-Reply-To: <1458141183-27207-6-git-send-email-lvivier@redhat.com>
On 16.03.2016 16:13, Laurent Vivier wrote:
> For lswx in little-endian mode, an alignment interrupt occurs.
>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
> powerpc/emulator.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/powerpc/emulator.c b/powerpc/emulator.c
> index dfe5859..3a8f17e 100644
> --- a/powerpc/emulator.c
> +++ b/powerpc/emulator.c
> @@ -6,6 +6,7 @@
> #include <asm/processor.h>
>
> static int volatile is_invalid;
> +static int volatile alignment;
>
> static void program_check_handler(struct pt_regs *regs, void *opaque)
> {
> @@ -19,6 +20,18 @@ static void program_check_handler(struct pt_regs *regs, void *opaque)
> regs->nip += 4;
> }
>
> +static void alignment_handler(struct pt_regs *regs, void *opaque)
> +{
> + int *data = opaque;
> +
> + printf("Detected alignment exception 0x%016lx: %08x\n",
> + regs->nip, *(uint32_t*)regs->nip);
> +
> + *data = 1;
> +
> + regs->nip += 4;
> +}
> +
> static void test_illegal(void)
> {
> report_prefix_push("invalid");
> @@ -62,6 +75,8 @@ static void test_64bit(void)
> * - RT <= RA or RB < RT + (n + 4) is invalid or result is undefined
> * - RT = RA = 0 is invalid
> *
> + * For lswx in little-endian mode, an alignment interrupt always occurs.
> + *
> */
>
> #define SPR_XER 1
> @@ -81,6 +96,7 @@ static void test_lswx(void)
>
> /* check incomplete register filling */
>
> + alignment = 0;
> asm volatile ("mtspr %[XER], %[len];"
> "li r12,-1;"
> "mr r11, r12;"
> @@ -98,7 +114,12 @@ static void test_lswx(void)
> */
> "xer", "r11", "r12");
>
> +#if __BYTE_ORDER__ = __ORDER_LITTLE_ENDIAN__
> + report("alignment", alignment);
> + return;
> +#else
> report("partial", regs[0] = 0x01020300 && regs[1] = (uint64_t)-1);
> +#endif
>
> /* check an old know bug: the number of bytes is used as
> * the number of registers, so try 32 bytes.
> @@ -195,6 +216,7 @@ static void test_lswx(void)
> int main(void)
> {
> handle_exception(0x700, program_check_handler, (void *)&is_invalid);
> + handle_exception(0x600, alignment_handler, (void *)&alignment);
>
> report_prefix_push("emulator");
>
Reviewed-by: Thomas Huth <thuth@redhat.com>
prev parent reply other threads:[~2016-03-18 9:54 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-16 15:12 [kvm-unit-tests PATCH 0/5] Check emulation Laurent Vivier
2016-03-16 15:12 ` [kvm-unit-tests PATCH 1/5] powerpc: add exception handler Laurent Vivier
2016-03-18 3:59 ` David Gibson
2016-03-18 8:53 ` Laurent Vivier
2016-03-18 9:42 ` Thomas Huth
2016-03-16 15:13 ` [kvm-unit-tests PATCH 2/5] powerpc: add test to check invalid instruction trap Laurent Vivier
2016-03-18 9:51 ` Thomas Huth
2016-03-18 10:08 ` Laurent Vivier
2016-03-18 10:12 ` Thomas Huth
2016-03-16 15:13 ` [kvm-unit-tests PATCH 3/5] powerpc: check 64bit mode Laurent Vivier
2016-03-18 8:28 ` Thomas Huth
2016-03-18 8:38 ` Paul Mackerras
2016-03-18 8:41 ` Thomas Huth
2016-03-16 15:13 ` [kvm-unit-tests PATCH 4/5] powerpc: check lswx Laurent Vivier
2016-03-18 9:09 ` Thomas Huth
2016-03-18 10:01 ` Laurent Vivier
2016-03-18 10:06 ` Thomas Huth
2016-03-18 10:18 ` Laurent Vivier
2016-03-18 10:34 ` Thomas Huth
2016-03-16 15:13 ` [kvm-unit-tests PATCH 5/5] powerpc: Check lswx in little-endian mode Laurent Vivier
2016-03-18 9:54 ` Thomas Huth [this message]
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=56EBD072.6000301@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