qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Tom Musta <tommusta@gmail.com>
To: Alexander Graf <agraf@suse.de>
Cc: PowerPC <qemu-ppc@nongnu.org>, QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH 5/8] target-ppc: Load Quadword
Date: Mon, 27 Jan 2014 13:53:42 -0600	[thread overview]
Message-ID: <52E6B946.1080006@gmail.com> (raw)
In-Reply-To: <F601BB58-7E1E-4AD5-8567-616C3349B166@suse.de>

On 1/27/2014 12:55 PM, Alexander Graf wrote:
> You're mixing two semantically separate things here. legal_in_user_mode doesn't really indicate that le_mode isn't usable. I'm sure if you just make this two if()'s with two separate bools that get assigned the same value gcc will be smart enough to optimize it just as well as this combined branch.
> 

Hmmm ... I'm not sure that I see the problem.  Perhaps the comment should be clearer.
And I guess there is really no need to compute the legal_in_user_mode flag since it
is only used once.

Prior to ISA 2.07, lq was not legal in user mode; attempting to execute lq when MSR[PR]=1
resulted in a privileged instruction exception.  Also, when MSR[PR]=0 and MSR[LE]=1, an
alignment exception was generated irrespective of the computed address.

Starting with ISA 2.07, both of these restrictions are lifted.  So the proposed code is
as follows:

static void gen_lq(DisasContext *ctx)
{
    /* lq is a legal user mode instruction starting in ISA 2.07 */
    int legal_in_user_mode = (ctx->insns_flags2 & PPC2_LSQ_ISA207) != 0;

    if (!legal_in_user_mode) {
#if defined(CONFIG_USER_ONLY)
        gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
        return;
#else
        if (unlikely(ctx->mem_idx == 0)) {
            gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC);
            return;
        }

        if (unlikely(ctx->le_mode)) {
            /* Little-endian mode is not handled */
            gen_exception_err(ctx, POWERPC_EXCP_ALIGN, POWERPC_EXCP_ALIGN_LE);
            return;
        }
#endif
    }

    int ra, rd;
    TCGv EA;
    ... // rest of implementation


P.S.  I think there should be an alignment check after the EA is computed.

  reply	other threads:[~2014-01-27 19:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27 17:54 [Qemu-devel] [PATCH 0/8] target-ppc: Base ISA V2.07 for Power8 Tom Musta
2014-01-27 17:54 ` [Qemu-devel] [PATCH 1/8] target-ppc: Add Flag for bctar Tom Musta
2014-01-27 17:54 ` [Qemu-devel] [PATCH 2/8] target-ppc: Add Target Address SPR (TAR) to Power8 Tom Musta
2014-01-27 17:54 ` [Qemu-devel] [PATCH 3/8] target-ppc: Add bctar Instruction Tom Musta
2014-01-27 18:46   ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2014-01-27 19:34     ` Tom Musta
2014-01-27 21:44       ` Alexander Graf
2014-01-27 17:54 ` [Qemu-devel] [PATCH 4/8] target-ppc: Add Flag for ISA 2.07 Load/Store Quadword Instructions Tom Musta
2014-01-27 17:54 ` [Qemu-devel] [PATCH 5/8] target-ppc: Load Quadword Tom Musta
2014-01-27 18:55   ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2014-01-27 19:53     ` Tom Musta [this message]
2014-01-27 21:43       ` Alexander Graf
2014-01-27 17:54 ` [Qemu-devel] [PATCH 6/8] target-ppc: Store Quadword Tom Musta
2014-01-27 17:54 ` [Qemu-devel] [PATCH 7/8] target-ppc: Add Load Quadword and Reserve Tom Musta
2014-01-27 18:59   ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2014-01-27 20:01     ` Tom Musta
2014-01-27 17:54 ` [Qemu-devel] [PATCH 8/8] target-ppc: Add Store Quadword Conditional Tom Musta

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=52E6B946.1080006@gmail.com \
    --to=tommusta@gmail.com \
    --cc=agraf@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).