qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: Michael Clark <mjc@sifive.com>,
	Palmer Dabbelt <palmer@sifive.com>,
	Sagar Karandikar <sagark@eecs.berkeley.edu>,
	Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Subject: [Qemu-devel] [PATCH 4/9] target/riscv: Introduce cpu_riscv_get_fcsr
Date: Thu, 10 May 2018 20:52:35 -0700	[thread overview]
Message-ID: <20180511035240.4016-5-richard.henderson@linaro.org> (raw)
In-Reply-To: <20180511035240.4016-1-richard.henderson@linaro.org>

Cc: Michael Clark <mjc@sifive.com>
Cc: Palmer Dabbelt <palmer@sifive.com>
Cc: Sagar Karandikar <sagark@eecs.berkeley.edu>
Cc: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/riscv/cpu.h        | 1 +
 target/riscv/fpu_helper.c | 6 ++++++
 target/riscv/op_helper.c  | 3 +--
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index 34abc383e3..f2bc243b95 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -265,6 +265,7 @@ void QEMU_NORETURN do_raise_exception_err(CPURISCVState *env,
                                           uint32_t exception, uintptr_t pc);
 
 target_ulong cpu_riscv_get_fflags(CPURISCVState *env);
+target_ulong cpu_riscv_get_fcsr(CPURISCVState *env);
 void cpu_riscv_set_fflags(CPURISCVState *env, target_ulong);
 
 #define TB_FLAGS_MMU_MASK  3
diff --git a/target/riscv/fpu_helper.c b/target/riscv/fpu_helper.c
index abbadead5c..41c7352115 100644
--- a/target/riscv/fpu_helper.c
+++ b/target/riscv/fpu_helper.c
@@ -37,6 +37,12 @@ target_ulong cpu_riscv_get_fflags(CPURISCVState *env)
     return hard;
 }
 
+target_ulong cpu_riscv_get_fcsr(CPURISCVState *env)
+{
+    return (cpu_riscv_get_fflags(env) << FSR_AEXC_SHIFT)
+         | (env->frm << FSR_RD_SHIFT);
+}
+
 void cpu_riscv_set_fflags(CPURISCVState *env, target_ulong hard)
 {
     int soft = 0;
diff --git a/target/riscv/op_helper.c b/target/riscv/op_helper.c
index 3abf52453c..fd2d8c0a9d 100644
--- a/target/riscv/op_helper.c
+++ b/target/riscv/op_helper.c
@@ -423,8 +423,7 @@ target_ulong csr_read_helper(CPURISCVState *env, target_ulong csrno)
         return env->frm;
     case CSR_FCSR:
         validate_mstatus_fs(env, GETPC());
-        return (cpu_riscv_get_fflags(env) << FSR_AEXC_SHIFT)
-                | (env->frm << FSR_RD_SHIFT);
+        return cpu_riscv_get_fcsr(env);
     /* rdtime/rdtimeh is trapped and emulated by bbl in system mode */
 #ifdef CONFIG_USER_ONLY
     case CSR_TIME:
-- 
2.17.0

  parent reply	other threads:[~2018-05-11  3:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-11  3:52 [Qemu-devel] [PATCH 0/9] Honor CPU_DUMP_FPU Richard Henderson
2018-05-11  3:52 ` [Qemu-devel] [PATCH 1/9] target/alpha: " Richard Henderson
2018-05-13  0:48   ` Philippe Mathieu-Daudé
2018-05-11  3:52 ` [Qemu-devel] [PATCH 2/9] target/mips: " Richard Henderson
2018-05-13  0:49   ` Philippe Mathieu-Daudé
2018-05-11  3:52 ` [Qemu-devel] [PATCH 3/9] target/ppc: " Richard Henderson
2018-05-13  0:50   ` Philippe Mathieu-Daudé
2018-05-11  3:52 ` Richard Henderson [this message]
2018-05-13  0:51   ` [Qemu-devel] [PATCH 4/9] target/riscv: Introduce cpu_riscv_get_fcsr Philippe Mathieu-Daudé
2018-05-18  2:46   ` Michael Clark
2018-05-18  3:35     ` Richard Henderson
2018-05-11  3:52 ` [Qemu-devel] [PATCH 5/9] target/riscv: Honor CPU_DUMP_FPU Richard Henderson
2018-05-13  0:52   ` Philippe Mathieu-Daudé
2018-05-18  2:16     ` Michael Clark
2018-05-11  3:52 ` [Qemu-devel] [PATCH 6/9] target/s390x: " Richard Henderson
2018-05-11  6:57   ` David Hildenbrand
2018-05-11  3:52 ` [Qemu-devel] [PATCH 7/9] target/sparc: " Richard Henderson
2018-05-13  0:54   ` Philippe Mathieu-Daudé
2018-05-11  3:52 ` [Qemu-devel] [PATCH 8/9] target/unicore32: " Richard Henderson
2018-05-13  0:54   ` Philippe Mathieu-Daudé
2018-05-11  3:52 ` [Qemu-devel] [PATCH 9/9] target/xtensa: " Richard Henderson
2018-05-11  4:46   ` Max Filippov
2018-05-13  0:55   ` Philippe Mathieu-Daudé

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=20180511035240.4016-5-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=kbastian@mail.uni-paderborn.de \
    --cc=mjc@sifive.com \
    --cc=palmer@sifive.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sagark@eecs.berkeley.edu \
    /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).