summaryrefslogtreecommitdiff
path: root/target-sparc/int64_helper.c
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2011-08-01 09:20:58 +0000
committerBlue Swirl <blauwirbel@gmail.com>2011-10-26 17:18:09 +0000
commit7922703623a989b59ce7f7b57a3c8ebe5c0f6b53 (patch)
tree75d9b2f34c34b1854e3b9f0516f82253bf7a3960 /target-sparc/int64_helper.c
parent063c367558dc4e811e0c10a64f49838acb108c38 (diff)
downloadqemu-7922703623a989b59ce7f7b57a3c8ebe5c0f6b53.tar.gz
Sparc: avoid AREG0 for softint op helpers and Leon cache control
Make softint op helpers and Leon cache irq manager take a parameter for CPUState instead of relying on global env. Move the functions to int{32,64}_helper.c. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'target-sparc/int64_helper.c')
-rw-r--r--target-sparc/int64_helper.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/target-sparc/int64_helper.c b/target-sparc/int64_helper.c
index 2bb1910ed9..c9c5e0e856 100644
--- a/target-sparc/int64_helper.c
+++ b/target-sparc/int64_helper.c
@@ -18,8 +18,17 @@
*/
#include "cpu.h"
+#include "helper.h"
//#define DEBUG_PCALL
+//#define DEBUG_PSTATE
+
+#ifdef DEBUG_PSTATE
+#define DPRINTF_PSTATE(fmt, ...) \
+ do { printf("PSTATE: " fmt , ## __VA_ARGS__); } while (0)
+#else
+#define DPRINTF_PSTATE(fmt, ...) do {} while (0)
+#endif
#ifdef DEBUG_PCALL
static const char * const excp_names[0x80] = {
@@ -162,3 +171,34 @@ trap_state *cpu_tsptr(CPUState* env)
{
return &env->ts[env->tl & MAXTL_MASK];
}
+
+static void do_modify_softint(CPUState *env, const char *operation,
+ uint32_t value)
+{
+ if (env->softint != value) {
+ env->softint = value;
+ DPRINTF_PSTATE(": %s new %08x\n", operation, env->softint);
+#if !defined(CONFIG_USER_ONLY)
+ if (cpu_interrupts_enabled(env)) {
+ cpu_check_irqs(env);
+ }
+#endif
+ }
+}
+
+void helper_set_softint(CPUState *env, uint64_t value)
+{
+ do_modify_softint(env, "helper_set_softint",
+ env->softint | (uint32_t)value);
+}
+
+void helper_clear_softint(CPUState *env, uint64_t value)
+{
+ do_modify_softint(env, "helper_clear_softint",
+ env->softint & (uint32_t)~value);
+}
+
+void helper_write_softint(CPUState *env, uint64_t value)
+{
+ do_modify_softint(env, "helper_write_softint", (uint32_t)value);
+}