Skip to contentSkip to conversation

target-xtensa: use global registers for the register window

PATCH In review Max Filippov 2 participants 2 messages Mar 12, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-xtensa: use global registers for the register window

---
 target-xtensa/cpu.c       |  1 +
 target-xtensa/cpu.h       |  5 +++--
 target-xtensa/op_helper.c | 48 ++++++++++++-----------------------------------
 target-xtensa/translate.c |  7 +++++--
 4 files changed, 21 insertions(+), 40 deletions(-)
target-xtensa/cpu.c +1 -0
index d572d56..2b9575f 100644
@@ -69,6 +69,7 @@ static void xtensa_cpu_reset(CPUState *s)
             XTENSA_OPTION_ATOMCTL) ? 0x28 : 0x15;
     env->sregs[CONFIGID0] = env->config->configid[0];
     env->sregs[CONFIGID1] = env->config->configid[1];
+    rotate_window_abs(env, env->sregs[WINDOW_BASE]);
 
     env->pending_irq_level = 0;
     reset_mmu(env);
target-xtensa/cpu.h +3 -2
index d0bd9da..5bace52 100644
@@ -350,11 +350,11 @@ enum {
 
 typedef struct CPUXtensaState {
     const XtensaConfig *config;
-    uint32_t regs[16];
+    uint32_t *regs;
     uint32_t pc;
     uint32_t sregs[256];
     uint32_t uregs[256];
-    uint32_t phys_regs[MAX_NAREG];
+    uint32_t phys_regs[MAX_NAREG + 12];
     union {
         float32 f32[2];
         float64 f64;
@@ -408,6 +408,7 @@ void xtensa_timer_irq(CPUXtensaState *env, uint32_t id, uint32_t active);
 void xtensa_rearm_ccompare_timer(CPUXtensaState *env);
 int cpu_xtensa_signal_handler(int host_signum, void *pinfo, void *puc);
 void xtensa_cpu_list(FILE *f, fprintf_function cpu_fprintf);
+void rotate_window_abs(CPUXtensaState *env, uint32_t position);
 void xtensa_sync_window_from_phys(CPUXtensaState *env);
 void xtensa_sync_phys_from_window(CPUXtensaState *env);
 uint32_t xtensa_tlb_get_addr_mask(const CPUXtensaState *env, bool dtlb, uint32_t way);
target-xtensa/op_helper.c +12 -36

69 lines not on this page · raw message

target-xtensa/translate.c +5 -2
index 9894488..c988511 100644
@@ -75,6 +75,7 @@ typedef struct DisasContext {
 } DisasContext;
 
 static TCGv_env cpu_env;
+static TCGv_ptr cpu_regs;
 static TCGv_i32 cpu_pc;
 static TCGv_i32 cpu_R[16];
 static TCGv_i32 cpu_FR[16];
@@ -218,12 +219,14 @@ void xtensa_translate_init(void)
     int i;
 
     cpu_env = tcg_global_reg_new_ptr(TCG_AREG0, "env");
+    cpu_regs = tcg_global_mem_new_ptr(cpu_env,
+            offsetof(CPUXtensaState, regs), "regs");
     cpu_pc = tcg_global_mem_new_i32(cpu_env,
             offsetof(CPUXtensaState, pc), "pc");
 
     for (i = 0; i < 16; i++) {
-        cpu_R[i] = tcg_global_mem_new_i32(cpu_env,
-                offsetof(CPUXtensaState, regs[i]),
+        cpu_R[i] = tcg_global_mem_new_i32(cpu_regs,
+                i * sizeof(uint32_t),
                 regnames[i]);
     }
 
Signature · 1 line
2.1.4