qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fabien Chouteau <chouteau@adacore.com>
To: Alex Zuepke <azu@sysgo.de>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] sparc: allow CASA with ASI 0xa from user space
Date: Mon, 7 Dec 2015 12:35:52 +0100	[thread overview]
Message-ID: <56656F18.4060605@adacore.com> (raw)
In-Reply-To: <1449241262-3002-1-git-send-email-azu@sysgo.de>

Hello Alex,

Thanks for your patch! I have a couple of comments. 

On 12/04/2015 04:01 PM, Alex Zuepke wrote:
> LEON3 allows the CASA instruction to be used from user space
> if the ASI is set to 0xa (user data).
> 
> Signed-off-by: Alex Zuepke <azu@sysgo.de>
> ---
>  target-sparc/translate.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/target-sparc/translate.c b/target-sparc/translate.c
> index 41a3319..63440dd 100644
> --- a/target-sparc/translate.c
> +++ b/target-sparc/translate.c
> @@ -5097,7 +5097,8 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
>                      if (IS_IMM) {
>                          goto illegal_insn;
>                      }
> -                    if (!supervisor(dc)) {
> +                    /* LEON3 allows CASA from user space with ASI 0xa */

Since this is a LEON3 specific feature, when you check the ASI you
should also check CPU_FEATURE_CASA.

> +                    if ((GET_FIELD(insn, 19, 26) != 0xa) && !supervisor(dc)) {
>                          goto priv_insn;
>                      }

That would give you something like this:

diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 41a3319..b93faea 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -2463,6 +2463,9 @@ static void gen_faligndata(TCGv dst, TCGv gsr, TCGv s1, TCGv s2)
 }
 #endif

+#define IU_FEATURE(dc, FEATURE)                            \
+    (((dc)->def->features & CPU_FEATURE_ ## FEATURE))
+
 #define CHECK_IU_FEATURE(dc, FEATURE)                      \
     if (!((dc)->def->features & CPU_FEATURE_ ## FEATURE))  \
         goto illegal_insn;
@@ -5097,7 +5100,11 @@ static void disas_sparc_insn(DisasContext * dc, unsigned int insn)
                     if (IS_IMM) {
                         goto illegal_insn;
                     }
-                    if (!supervisor(dc)) {
+
+                    /* LEON3 allows CASA from user space with ASI 0xa */
+                    if (!((IU_FEATURE(dc, CASA) &&
+                           (GET_FIELD(insn, 19, 26) == 0xa))
+                          || supervisor(dc))) {
                         goto priv_insn;
                     }
 #endif


to be tested of course ;)

Regards,

  reply	other threads:[~2015-12-07 11:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-04 15:01 [Qemu-devel] [PATCH] sparc: allow CASA with ASI 0xa from user space Alex Zuepke
2015-12-07 11:35 ` Fabien Chouteau [this message]
2015-12-07 12:41   ` "Züpke, Alexander"
2015-12-07 12:56     ` Fabien Chouteau
2015-12-07 13:07       ` "Züpke, Alexander"
2015-12-07 15:03         ` Fabien Chouteau
2015-12-08 19:59 ` [Qemu-devel] [PATCH for-2.5] " Richard Henderson
2015-12-08 21:28   ` Peter Maydell
2015-12-09 23:24     ` Mark Cave-Ayland
2015-12-10 11:43       ` Peter Maydell

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=56656F18.4060605@adacore.com \
    --to=chouteau@adacore.com \
    --cc=azu@sysgo.de \
    --cc=qemu-devel@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).