[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 18/26] target-alpha: Swap shadow registers moving to
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH 18/26] target-alpha: Swap shadow registers moving to/from PALmode. |
Date: |
Mon, 23 May 2011 13:28:38 -0700 |
Signed-off-by: Richard Henderson <address@hidden>
---
target-alpha/cpu.h | 1 +
target-alpha/helper.c | 37 ++++++++++++++++++++++++++++++++++++-
target-alpha/op_helper.c | 5 ++++-
3 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h
index d1ef04d..c1546f8 100644
--- a/target-alpha/cpu.h
+++ b/target-alpha/cpu.h
@@ -416,6 +416,7 @@ void do_interrupt (CPUState *env);
uint64_t cpu_alpha_load_fpcr (CPUState *env);
void cpu_alpha_store_fpcr (CPUState *env, uint64_t val);
+extern void swap_shadow_regs(CPUState *env);
static inline void cpu_get_tb_cpu_state(CPUState *env, target_ulong *pc,
target_ulong *cs_base, int *flags)
diff --git a/target-alpha/helper.c b/target-alpha/helper.c
index a49f632..4f706f2 100644
--- a/target-alpha/helper.c
+++ b/target-alpha/helper.c
@@ -168,6 +168,38 @@ int cpu_alpha_handle_mmu_fault (CPUState *env,
target_ulong address, int rw,
return 1;
}
#else
+void swap_shadow_regs(CPUState *env)
+{
+ uint64_t i0, i1, i2, i3, i4, i5, i6, i7;
+
+ i0 = env->ir[8];
+ i1 = env->ir[9];
+ i2 = env->ir[10];
+ i3 = env->ir[11];
+ i4 = env->ir[12];
+ i5 = env->ir[13];
+ i6 = env->ir[14];
+ i7 = env->ir[25];
+
+ env->ir[8] = env->shadow[0];
+ env->ir[9] = env->shadow[1];
+ env->ir[10] = env->shadow[2];
+ env->ir[11] = env->shadow[3];
+ env->ir[12] = env->shadow[4];
+ env->ir[13] = env->shadow[5];
+ env->ir[14] = env->shadow[6];
+ env->ir[25] = env->shadow[7];
+
+ env->shadow[0] = i0;
+ env->shadow[1] = i1;
+ env->shadow[2] = i2;
+ env->shadow[3] = i3;
+ env->shadow[4] = i4;
+ env->shadow[5] = i5;
+ env->shadow[6] = i6;
+ env->shadow[7] = i7;
+}
+
target_phys_addr_t cpu_get_phys_page_debug (CPUState *env, target_ulong addr)
{
return -1;
@@ -290,7 +322,10 @@ void do_interrupt (CPUState *env)
env->pc = env->palbr + i;
/* Switch to PALmode. */
- env->pal_mode = 1;
+ if (!env->pal_mode) {
+ env->pal_mode = 1;
+ swap_shadow_regs(env);
+ }
#endif /* !USER_ONLY */
}
diff --git a/target-alpha/op_helper.c b/target-alpha/op_helper.c
index fc5020a..03b5091 100644
--- a/target-alpha/op_helper.c
+++ b/target-alpha/op_helper.c
@@ -1189,9 +1189,12 @@ uint64_t helper_cvtqg (uint64_t a)
void helper_hw_ret (uint64_t a)
{
env->pc = a & ~3;
- env->pal_mode = a & 1;
env->intr_flag = 0;
env->lock_addr = -1;
+ if ((a & 1) == 0) {
+ env->pal_mode = 0;
+ swap_shadow_regs(env);
+ }
}
#endif
--
1.7.4.4
- [Qemu-devel] [PATCH 05/26] target-alpha: Fix translation of PALmode memory insns., (continued)
- [Qemu-devel] [PATCH 05/26] target-alpha: Fix translation of PALmode memory insns., Richard Henderson, 2011/05/23
- [Qemu-devel] [PATCH 09/26] target-alpha: Rationalize internal processor registers., Richard Henderson, 2011/05/23
- [Qemu-devel] [PATCH 12/26] target-alpha: Tidy up arithmetic exceptions., Richard Henderson, 2011/05/23
- [Qemu-devel] [PATCH 13/26] target-alpha: Use do_restore_state for arithmetic exceptions., Richard Henderson, 2011/05/23
- [Qemu-devel] [PATCH 15/26] target-alpha: Use kernel mmu_idx for pal_mode., Richard Henderson, 2011/05/23
- [Qemu-devel] [PATCH 14/26] target-alpha: Add various symbolic constants., Richard Henderson, 2011/05/23
- [Qemu-devel] [PATCH 10/26] target-alpha: Enable the alpha-softmmu target., Richard Henderson, 2011/05/23
- [Qemu-devel] [PATCH 16/26] target-alpha: Add IPRs to be used by the emulation PALcode., Richard Henderson, 2011/05/23
- [Qemu-devel] [PATCH 17/26] target-alpha: Implement do_interrupt for system mode., Richard Henderson, 2011/05/23
- [Qemu-devel] [PATCH 11/26] target-alpha: Tidy exception constants., Richard Henderson, 2011/05/23
- [Qemu-devel] [PATCH 18/26] target-alpha: Swap shadow registers moving to/from PALmode.,
Richard Henderson <=
- [Qemu-devel] [PATCH 20/26] target-alpha: Disable interrupts properly., Richard Henderson, 2011/05/23
- [Qemu-devel] [PATCH 19/26] target-alpha: All ISA checks to use TB->FLAGS., Richard Henderson, 2011/05/23
- [Qemu-devel] [PATCH 21/26] target-alpha: Implement more CALL_PAL values inline., Richard Henderson, 2011/05/23
- [Qemu-devel] [PATCH 22/26] target-alpha: Implement cpu_alpha_handle_mmu_fault for system mode., Richard Henderson, 2011/05/23
- [Qemu-devel] [PATCH 23/26] target-alpha: Remap PIO space for 43-bit KSEG for EV6., Richard Henderson, 2011/05/23
- [Qemu-devel] [PATCH 24/26] target-alpha: Trap for unassigned and unaligned addresses., Richard Henderson, 2011/05/23
- [Qemu-devel] [PATCH 25/26] target-alpha: Use a fixed frequency for the RPCC in system mode., Richard Henderson, 2011/05/23
- [Qemu-devel] [PATCH 26/26] target-alpha: Implement TLB flush primitives., Richard Henderson, 2011/05/23
- Re: [Qemu-devel] [PULL 00/26] Alpha system emulation, v5, Richard Henderson, 2011/05/27