From: Nathan Froyd <froydnj@codesourcery.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] target-ppc: add support for reading/writing spefscr
Date: Sat, 13 Dec 2008 20:14:03 -0800 [thread overview]
Message-ID: <20081214041403.GG23471@codesourcery.com> (raw)
As well as reading/writing the CPU's idea of what spefscr is, this patch
also adds support for reading/writing it in user mode.
Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
---
target-ppc/translate.c | 4 ++++
target-ppc/translate_init.c | 21 +++++++++++++++------
2 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index e2d6f42..82f1b9c 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -69,6 +69,7 @@ static TCGv cpu_lr;
static TCGv cpu_xer;
static TCGv cpu_reserve;
static TCGv_i32 cpu_fpscr;
+static TCGv_i32 cpu_spefscr;
static TCGv_i32 cpu_access_type;
#include "gen-icount.h"
@@ -152,6 +153,9 @@ void ppc_translate_init(void)
cpu_fpscr = tcg_global_mem_new_i32(TCG_AREG0,
offsetof(CPUState, fpscr), "fpscr");
+ cpu_spefscr = tcg_global_mem_new_i32(TCG_AREG0,
+ offsetof(CPUState, spe_fscr), "spefscr");
+
cpu_access_type = tcg_global_mem_new_i32(TCG_AREG0,
offsetof(CPUState, access_type), "access_type");
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 0ce81ed..60838aa 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -434,6 +434,17 @@ static void spr_write_pir (void *opaque, int sprn, int gprn)
}
#endif
+/* SPE specific registers */
+static void spr_read_spefscr (void *opaque, int gprn, int sprn)
+{
+ tcg_gen_mov_tl(cpu_gpr[gprn], cpu_spefscr);
+}
+
+static void spr_write_spefscr (void *opaque, int sprn, int gprn)
+{
+ tcg_gen_mov_tl(cpu_spefscr, cpu_gpr[gprn]);
+}
+
#if !defined(CONFIG_USER_ONLY)
/* Callback used to write the exception vector base */
static void spr_write_excp_prefix (void *opaque, int sprn, int gprn)
@@ -3995,10 +4006,9 @@ static void init_proc_e200 (CPUPPCState *env)
/* Time base */
gen_tbl(env);
gen_spr_BookE(env, 0x000000070000FFFFULL);
- /* XXX : not implemented */
spr_register(env, SPR_BOOKE_SPEFSCR, "SPEFSCR",
- SPR_NOACCESS, SPR_NOACCESS,
- &spr_read_generic, &spr_write_generic,
+ &spr_read_spefscr, &spr_write_spefscr,
+ &spr_read_spefscr, &spr_write_spefscr,
0x00000000);
/* Memory management */
gen_spr_BookE_FSL(env, 0x0000005D);
@@ -4165,10 +4175,9 @@ static void init_proc_e500 (CPUPPCState *env)
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_pir,
0x00000000);
- /* XXX : not implemented */
spr_register(env, SPR_BOOKE_SPEFSCR, "SPEFSCR",
- SPR_NOACCESS, SPR_NOACCESS,
- &spr_read_generic, &spr_write_generic,
+ &spr_read_spefscr, &spr_write_spefscr,
+ &spr_read_spefscr, &spr_write_spefscr,
0x00000000);
/* Memory management */
#if !defined(CONFIG_USER_ONLY)
--
1.6.0.5
next reply other threads:[~2008-12-14 4:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-14 4:14 Nathan Froyd [this message]
2008-12-14 10:46 ` [Qemu-devel] [PATCH] target-ppc: add support for reading/writing spefscr Aurelien Jarno
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=20081214041403.GG23471@codesourcery.com \
--to=froydnj@codesourcery.com \
--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).