Skip to contentSkip to conversation

Alpha updates

PATCH Applied Richard Henderson 2 participants 12 messages Mar 24, 2012 Kbuild

lore
Share & tools
lore
#0 lore raw

v2 cover Alpha updates

Changes v1->v2:
* Formatting fixed during the move to new files. It might have been cleaner to fix it before the move, but it was easier to run the existing patches through checkpatch.pl.

* Add noreturn marker, now that it's available.

r~

Richard Henderson (10):
alpha-linux-user: Initialize fpu to round-to-normal.
target-alpha: Move integer helpers to int_helper.c.
target-alpha: Move exception helpers to helper.c.
target-alpha: Move floating-point helpers to fpu_helper.c.
target-alpha: Move fpcr helpers from op_helper.c to helper.c.
target-alpha: Move integer overflow helpers to int_helper.c.
target-alpha: Move palcode support helpers to sys_helper.c.
target-alpha: Move memory helpers to mem_helper.c.
target-alpha: Make use of fp_status.flush_inputs_to_zero.
target-alpha: Use noreturn marker in helper.h.

 Makefile.target           |    3 +
 configure                 |    2 +-
 target-alpha/cpu.h        |    4 +-
 target-alpha/fpu_helper.c |  822 +++++++++++++++++++++++++++
 target-alpha/helper.c     |   61 ++-
 target-alpha/helper.h     |  143 +++---
 target-alpha/int_helper.c |  320 +++++++++++
 target-alpha/mem_helper.c |  151 +++++
 target-alpha/op_helper.c  | 1379 ---------------------------------------------
 target-alpha/sys_helper.c |   87 +++
 target-alpha/translate.c  |  222 +++++---
 11 files changed, 1643 insertions(+), 1551 deletions(-)
 create mode 100644 target-alpha/fpu_helper.c
 create mode 100644 target-alpha/int_helper.c
 create mode 100644 target-alpha/mem_helper.c
 delete mode 100644 target-alpha/op_helper.c
 create mode 100644 target-alpha/sys_helper.c
Signature · 1 line
1.7.7.6
#1 lore raw

PATCH v2 1/10 alpha-linux-user: Initialize fpu to round-to-normal.

---
 target-alpha/translate.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
target-alpha/translate.c +2 -1
index b51fe5c..2c24619 100644
@@ -3513,7 +3513,8 @@ CPUAlphaState * cpu_alpha_init (const char *cpu_model)
 #if defined (CONFIG_USER_ONLY)
     env->ps = PS_USER_MODE;
     cpu_alpha_store_fpcr(env, (FPCR_INVD | FPCR_DZED | FPCR_OVFD
-                               | FPCR_UNFD | FPCR_INED | FPCR_DNOD));
+                               | FPCR_UNFD | FPCR_INED | FPCR_DNOD
+                               | FPCR_DYN_NORMAL));
 #endif
     env->lock_addr = -1;
     env->fen = 1;
Signature · 1 line
1.7.7.6
#3 lore raw

PATCH v2 3/10 target-alpha: Move exception helpers to helper.c.

In reply to Richard Henderson
---
 target-alpha/cpu.h       |    3 ++
 target-alpha/helper.c    |   39 ++++++++++++++++++++++++
 target-alpha/helper.h    |    2 +-
 target-alpha/op_helper.c |   73 ++++++++++++----------------------------------
 target-alpha/translate.c |    2 +-
 5 files changed, 63 insertions(+), 56 deletions(-)
target-alpha/cpu.h +3 -0
index 48c0fdc..c7787f6 100644
@@ -434,6 +434,9 @@ int cpu_alpha_handle_mmu_fault (CPUAlphaState *env, uint64_t address, int rw,
                                 int mmu_idx);
 #define cpu_handle_mmu_fault cpu_alpha_handle_mmu_fault
 void do_interrupt (CPUAlphaState *env);
+void do_restore_state(CPUAlphaState *, void *retaddr);
+void QEMU_NORETURN dynamic_excp(CPUAlphaState *, void *, int, int);
+void QEMU_NORETURN arith_excp(CPUAlphaState *, void *, int, uint64_t);
 
 uint64_t cpu_alpha_load_fpcr (CPUAlphaState *env);
 void cpu_alpha_store_fpcr (CPUAlphaState *env, uint64_t val);
target-alpha/helper.c +39 -0
index 3f2e7c3..584457f 100644
@@ -23,6 +23,7 @@
 
 #include "cpu.h"
 #include "softfloat.h"
+#include "helper.h"
 
 uint64_t cpu_alpha_load_fpcr (CPUAlphaState *env)
 {
@@ -484,3 +485,41 @@ void cpu_dump_state (CPUAlphaState *env, FILE *f, fprintf_function cpu_fprintf,
     }
     cpu_fprintf(f, "\n");
 }
+
+void do_restore_state(CPUAlphaState *env, void *retaddr)
+{
+    uintptr_t pc = (uintptr_t)retaddr;
+    if (pc) {
+        TranslationBlock *tb = tb_find_pc(pc);
+        if (tb) {
+            cpu_restore_state(tb, env, pc);
+        }
+    }
+}
+
+/* This should only be called from translate, via gen_excp.
+   We expect that ENV->PC has already been updated.  */
+void QEMU_NORETURN helper_excp(CPUAlphaState *env, int excp, int error)
+{
+    env->exception_index = excp;
+    env->error_code = error;
+    cpu_loop_exit(env);
+}
+
+/* This may be called from any of the helpers to set up EXCEPTION_INDEX.  */
+void QEMU_NORETURN dynamic_excp(CPUAlphaState *env, void *retaddr,
+                                int excp, int error)
+{
+    env->exception_index = excp;
+    env->error_code = error;
+    do_restore_state(env, retaddr);
+    cpu_loop_exit(env);
+}
+
+void QEMU_NORETURN arith_excp(CPUAlphaState *env, void *retaddr,
+                              int exc, uint64_t mask)
+{
+    env->trap_arg0 = exc;
+    env->trap_arg1 = mask;
+    dynamic_excp(env, retaddr, EXCP_ARITH, 0);
+}
target-alpha/helper.h +1 -1
index b693cee..91a9e39 100644
@@ -1,6 +1,6 @@
 #include "def-helper.h"
 
-DEF_HELPER_2(excp, void, int, int)
+DEF_HELPER_3(excp, void, env, int, int)
 DEF_HELPER_FLAGS_0(load_pcc, TCG_CALL_CONST | TCG_CALL_PURE, i64)
 
 DEF_HELPER_2(addqv, i64, i64, i64)
target-alpha/op_helper.c +19 -54

179 lines not on this page · raw message

target-alpha/translate.c +1 -1
index 2c24619..0c06b55 100644
@@ -149,7 +149,7 @@ static void gen_excp_1(int exception, int error_code)
 
     tmp1 = tcg_const_i32(exception);
     tmp2 = tcg_const_i32(error_code);
-    gen_helper_excp(tmp1, tmp2);
+    gen_helper_excp(cpu_env, tmp1, tmp2);
     tcg_temp_free_i32(tmp2);
     tcg_temp_free_i32(tmp1);
 }
Signature · 1 line
1.7.7.6
#2 lore raw

PATCH v2 2/10 target-alpha: Move integer helpers to int_helper.c.

In reply to Richard Henderson
---
 Makefile.target           |    1 +
 target-alpha/int_helper.c |  257 +++++++++++++++++++++++++++++++++++++++++++++
 target-alpha/op_helper.c  |  233 ----------------------------------------
 3 files changed, 258 insertions(+), 233 deletions(-)
 create mode 100644 target-alpha/int_helper.c
Makefile.target +1 -0
index 63cf769..ddeb7e0 100644
@@ -96,6 +96,7 @@ libobj-y += cpu_init.o
 endif
 libobj-$(TARGET_SPARC) += int32_helper.o
 libobj-$(TARGET_SPARC64) += int64_helper.o
+libobj-$(TARGET_ALPHA) += int_helper.o
 
 libobj-y += disas.o
 libobj-$(CONFIG_TCI_DIS) += tci-dis.o
target-alpha/int_helper.c new file +257 -0

257 lines not on this page · raw message

target-alpha/op_helper.c +0 -233

239 lines not on this page · raw message

Signature · 1 line
1.7.7.6
#5 lore raw

PATCH v2 5/10 target-alpha: Move fpcr helpers from op_helper.c to helper.c.

In reply to Richard Henderson
---
 target-alpha/helper.c    |   14 ++++++++++++--
 target-alpha/helper.h    |    4 ++--
 target-alpha/op_helper.c |   10 ----------
 target-alpha/translate.c |    6 +++---
 4 files changed, 17 insertions(+), 17 deletions(-)
target-alpha/helper.c +12 -2
index 584457f..3333bfa 100644
@@ -159,9 +159,19 @@ void cpu_alpha_store_fpcr (CPUAlphaState *env, uint64_t val)
     env->fpcr_undz = (val & FPCR_UNDZ) != 0;
 }
 
+uint64_t helper_load_fpcr(CPUAlphaState *env)
+{
+    return cpu_alpha_load_fpcr(env);
+}
+
+void helper_store_fpcr(CPUAlphaState *env, uint64_t val)
+{
+    cpu_alpha_store_fpcr(env, val);
+}
+
 #if defined(CONFIG_USER_ONLY)
-int cpu_alpha_handle_mmu_fault (CPUAlphaState *env, target_ulong address, int rw,
-                                int mmu_idx)
+int cpu_alpha_handle_mmu_fault(CPUAlphaState *env, target_ulong address,
+                               int rw, int mmu_idx)
 {
     env->exception_index = EXCP_MMFAULT;
     env->trap_arg0 = address;
target-alpha/helper.h +2 -2
index d36df5f..e193c26 100644
@@ -34,8 +34,8 @@ DEF_HELPER_FLAGS_1(pkwb, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64)
 DEF_HELPER_FLAGS_1(unpkbl, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64)
 DEF_HELPER_FLAGS_1(unpkbw, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64)
 
-DEF_HELPER_FLAGS_0(load_fpcr, TCG_CALL_CONST | TCG_CALL_PURE, i64)
-DEF_HELPER_FLAGS_1(store_fpcr, TCG_CALL_CONST, void, i64)
+DEF_HELPER_FLAGS_1(load_fpcr, TCG_CALL_CONST | TCG_CALL_PURE, i64, env)
+DEF_HELPER_FLAGS_2(store_fpcr, TCG_CALL_CONST, void, env, i64)
 
 DEF_HELPER_FLAGS_1(f_to_memory, TCG_CALL_CONST | TCG_CALL_PURE, i32, i64)
 DEF_HELPER_FLAGS_1(memory_to_f, TCG_CALL_CONST | TCG_CALL_PURE, i64, i32)
target-alpha/op_helper.c +0 -10
index 6711d99..59ee31e 100644
@@ -43,16 +43,6 @@ uint64_t helper_load_pcc (void)
 #endif
 }
 
-uint64_t helper_load_fpcr (void)
-{
-    return cpu_alpha_load_fpcr (env);
-}
-
-void helper_store_fpcr (uint64_t val)
-{
-    cpu_alpha_store_fpcr (env, val);
-}
-
 uint64_t helper_addqv (uint64_t op1, uint64_t op2)
 {
     uint64_t tmp = op1;
target-alpha/translate.c +3 -3
index a9b97a3..6f31b6d 100644
@@ -2678,17 +2678,17 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn)
         case 0x024:
             /* MT_FPCR */
             if (likely(ra != 31))
-                gen_helper_store_fpcr(cpu_fir[ra]);
+                gen_helper_store_fpcr(cpu_env, cpu_fir[ra]);
             else {
                 TCGv tmp = tcg_const_i64(0);
-                gen_helper_store_fpcr(tmp);
+                gen_helper_store_fpcr(cpu_env, tmp);
                 tcg_temp_free(tmp);
             }
             break;
         case 0x025:
             /* MF_FPCR */
             if (likely(ra != 31))
-                gen_helper_load_fpcr(cpu_fir[ra]);
+                gen_helper_load_fpcr(cpu_fir[ra], cpu_env);
             break;
         case 0x02A:
             /* FCMOVEQ */
Signature · 1 line
1.7.7.6
#6 lore raw

PATCH v2 6/10 target-alpha: Move integer overflow helpers to int_helper.c.

In reply to Richard Henderson
---
 target-alpha/helper.h     |   12 ++++----
 target-alpha/int_helper.c |   63 +++++++++++++++++++++++++++++++++++++++++++++
 target-alpha/op_helper.c  |   62 --------------------------------------------
 target-alpha/translate.c  |   45 +++++++++++++++++++++++++++-----
 4 files changed, 107 insertions(+), 75 deletions(-)
target-alpha/helper.h +6 -6
index e193c26..45e187d 100644
@@ -3,12 +3,12 @@
 DEF_HELPER_3(excp, void, env, int, int)
 DEF_HELPER_FLAGS_0(load_pcc, TCG_CALL_CONST | TCG_CALL_PURE, i64)
 
-DEF_HELPER_2(addqv, i64, i64, i64)
-DEF_HELPER_2(addlv, i64, i64, i64)
-DEF_HELPER_2(subqv, i64, i64, i64)
-DEF_HELPER_2(sublv, i64, i64, i64)
-DEF_HELPER_2(mullv, i64, i64, i64)
-DEF_HELPER_2(mulqv, i64, i64, i64)
+DEF_HELPER_3(addqv, i64, env, i64, i64)
+DEF_HELPER_3(addlv, i64, env, i64, i64)
+DEF_HELPER_3(subqv, i64, env, i64, i64)
+DEF_HELPER_3(sublv, i64, env, i64, i64)
+DEF_HELPER_3(mullv, i64, env, i64, i64)
+DEF_HELPER_3(mulqv, i64, env, i64, i64)
 DEF_HELPER_FLAGS_2(umulh, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64, i64)
 
 DEF_HELPER_FLAGS_1(ctpop, TCG_CALL_CONST | TCG_CALL_PURE, i64, i64)
target-alpha/int_helper.c +63 -0

66 lines not on this page · raw message

target-alpha/op_helper.c +0 -62

68 lines not on this page · raw message

target-alpha/translate.c +38 -7

58 lines not on this page · raw message

Signature · 1 line
1.7.7.6
#7 lore raw

PATCH v2 7/10 target-alpha: Move palcode support helpers to sys_helper.c.

In reply to Richard Henderson
---
 Makefile.target           |    2 +-
 target-alpha/helper.h     |   10 +++---
 target-alpha/op_helper.c  |   65 ---------------------------------
 target-alpha/sys_helper.c |   87 +++++++++++++++++++++++++++++++++++++++++++++
 target-alpha/translate.c  |   14 ++++----
 5 files changed, 100 insertions(+), 78 deletions(-)
 create mode 100644 target-alpha/sys_helper.c
Makefile.target +1 -1
index 256e7b5..254a9fa 100644
@@ -96,7 +96,7 @@ libobj-y += cpu_init.o
 endif
 libobj-$(TARGET_SPARC) += int32_helper.o
 libobj-$(TARGET_SPARC64) += int64_helper.o
-libobj-$(TARGET_ALPHA) += int_helper.o fpu_helper.o
+libobj-$(TARGET_ALPHA) += int_helper.o fpu_helper.o sys_helper.o
 
 libobj-y += disas.o
 libobj-$(CONFIG_TCI_DIS) += tci-dis.o
target-alpha/helper.h +5 -5
index 45e187d..f057ecf 100644
@@ -1,7 +1,7 @@
 #include "def-helper.h"
 
 DEF_HELPER_3(excp, void, env, int, int)
-DEF_HELPER_FLAGS_0(load_pcc, TCG_CALL_CONST | TCG_CALL_PURE, i64)
+DEF_HELPER_FLAGS_1(load_pcc, TCG_CALL_CONST | TCG_CALL_PURE, i64, env)
 
 DEF_HELPER_3(addqv, i64, env, i64, i64)
 DEF_HELPER_3(addlv, i64, env, i64, i64)
@@ -100,7 +100,7 @@ DEF_HELPER_2(ieee_input_cmp, i64, env, i64)
 DEF_HELPER_2(ieee_input_s, i64, env, i64)
 
 #if !defined (CONFIG_USER_ONLY)
-DEF_HELPER_1(hw_ret, void, i64)
+DEF_HELPER_2(hw_ret, void, env, i64)
 
 DEF_HELPER_1(ldl_phys, i64, i64)
 DEF_HELPER_1(ldq_phys, i64, i64)
@@ -111,13 +111,13 @@ DEF_HELPER_2(stq_phys, void, i64, i64)
 DEF_HELPER_2(stl_c_phys, i64, i64, i64)
 DEF_HELPER_2(stq_c_phys, i64, i64, i64)
 
-DEF_HELPER_FLAGS_0(tbia, TCG_CALL_CONST, void)
-DEF_HELPER_FLAGS_1(tbis, TCG_CALL_CONST, void, i64)
+DEF_HELPER_FLAGS_1(tbia, TCG_CALL_CONST, void, env)
+DEF_HELPER_FLAGS_2(tbis, TCG_CALL_CONST, void, env, i64)
 
 DEF_HELPER_1(halt, void, i64);
 
 DEF_HELPER_FLAGS_0(get_time, TCG_CALL_CONST, i64)
-DEF_HELPER_FLAGS_1(set_alarm, TCG_CALL_CONST, void, i64)
+DEF_HELPER_FLAGS_2(set_alarm, TCG_CALL_CONST, void, env, i64)
 #endif
 
 #include "def-helper.h"
target-alpha/op_helper.c +0 -65

71 lines not on this page · raw message

target-alpha/sys_helper.c new file +87 -0

87 lines not on this page · raw message

target-alpha/translate.c +7 -7
index 551237c..cc87320 100644
@@ -1678,12 +1678,12 @@ static ExitStatus gen_mtpr(DisasContext *ctx, int rb, int regno)
     switch (regno) {
     case 255:
         /* TBIA */
-        gen_helper_tbia();
+        gen_helper_tbia(cpu_env);
         break;
 
     case 254:
         /* TBIS */
-        gen_helper_tbis(tmp);
+        gen_helper_tbis(cpu_env, tmp);
         break;
 
     case 253:
@@ -1699,7 +1699,7 @@ static ExitStatus gen_mtpr(DisasContext *ctx, int rb, int regno)
 
     case 251:
         /* ALARM */
-        gen_helper_set_alarm(tmp);
+        gen_helper_set_alarm(cpu_env, tmp);
         break;
 
     default:
@@ -2793,11 +2793,11 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn)
             if (ra != 31) {
                 if (use_icount) {
                     gen_io_start();
-                    gen_helper_load_pcc(cpu_ir[ra]);
+                    gen_helper_load_pcc(cpu_ir[ra], cpu_env);
                     gen_io_end();
                     ret = EXIT_PC_STALE;
                 } else {
-                    gen_helper_load_pcc(cpu_ir[ra]);
+                    gen_helper_load_pcc(cpu_ir[ra], cpu_env);
                 }
             }
             break;
@@ -3143,10 +3143,10 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn)
                    emulation PALcode, so continue to accept it.  */
                 TCGv tmp = tcg_temp_new();
                 tcg_gen_ld_i64(tmp, cpu_env, offsetof(CPUAlphaState, exc_addr));
-                gen_helper_hw_ret(tmp);
+                gen_helper_hw_ret(cpu_env, tmp);
                 tcg_temp_free(tmp);
             } else {
-                gen_helper_hw_ret(cpu_ir[rb]);
+                gen_helper_hw_ret(cpu_env, cpu_ir[rb]);
             }
             ret = EXIT_PC_UPDATED;
             break;
Signature · 1 line
1.7.7.6
#9 lore raw

PATCH v2 9/10 target-alpha: Make use of fp_status.flush_inputs_to_zero.

In reply to Richard Henderson

This softfp feature post-dates the last major update to the Alpha fpu translation. We can make use of this to eliminate at least one helper function that was performing this operation by hand.

---
 target-alpha/cpu.h        |    1 -
 target-alpha/fpu_helper.c |   44 ++++++++++----------------------------------
 target-alpha/helper.c     |    8 +++-----
 target-alpha/helper.h     |    5 ++---
 target-alpha/translate.c  |   18 +++++++++++-------
 5 files changed, 26 insertions(+), 50 deletions(-)
target-alpha/cpu.h +0 -1
index c7787f6..6c5d28b 100644
@@ -234,7 +234,6 @@ struct CPUAlphaState {
     uint8_t fpcr_exc_mask;
     uint8_t fpcr_dyn_round;
     uint8_t fpcr_flush_to_zero;
-    uint8_t fpcr_dnz;
     uint8_t fpcr_dnod;
     uint8_t fpcr_undz;
 
target-alpha/fpu_helper.c +10 -34

74 lines not on this page · raw message

target-alpha/helper.c +3 -5
index 3333bfa..765e650 100644
@@ -82,7 +82,7 @@ uint64_t cpu_alpha_load_fpcr (CPUAlphaState *env)
         break;
     }
 
-    if (env->fpcr_dnz) {
+    if (env->fp_status.flush_inputs_to_zero) {
         r |= FPCR_DNZ;
     }
     if (env->fpcr_dnod) {
@@ -151,12 +151,10 @@ void cpu_alpha_store_fpcr (CPUAlphaState *env, uint64_t val)
     }
     env->fpcr_dyn_round = t;
 
-    env->fpcr_flush_to_zero
-      = (val & (FPCR_UNDZ|FPCR_UNFD)) == (FPCR_UNDZ|FPCR_UNFD);
-
-    env->fpcr_dnz = (val & FPCR_DNZ) != 0;
     env->fpcr_dnod = (val & FPCR_DNOD) != 0;
     env->fpcr_undz = (val & FPCR_UNDZ) != 0;
+    env->fpcr_flush_to_zero = env->fpcr_dnod & env->fpcr_undz;
+    env->fp_status.flush_inputs_to_zero = (val & FPCR_DNZ) != 0;
 }
 
 uint64_t helper_load_fpcr(CPUAlphaState *env)
target-alpha/helper.h +2 -3
index 03cc185..9f97c5d 100644
@@ -95,9 +95,8 @@ DEF_HELPER_FLAGS_1(fp_exc_get, TCG_CALL_CONST | TCG_CALL_PURE, i32, env)
 DEF_HELPER_3(fp_exc_raise, void, env, i32, i32)
 DEF_HELPER_3(fp_exc_raise_s, void, env, i32, i32)
 
-DEF_HELPER_2(ieee_input, i64, env, i64)
-DEF_HELPER_2(ieee_input_cmp, i64, env, i64)
-DEF_HELPER_2(ieee_input_s, i64, env, i64)
+DEF_HELPER_2(ieee_input, void, env, i64)
+DEF_HELPER_2(ieee_input_cmp, void, env, i64)
 
 #if !defined (CONFIG_USER_ONLY)
 DEF_HELPER_2(hw_ret, void, env, i64)
target-alpha/translate.c +11 -7
index dd09ad8..1f4565d 100644
@@ -661,15 +661,19 @@ static void gen_qual_flushzero(DisasContext *ctx, int fn11)
 
 static TCGv gen_ieee_input(int reg, int fn11, int is_cmp)
 {
-    TCGv val = tcg_temp_new();
+    TCGv val;
     if (reg == 31) {
-        tcg_gen_movi_i64(val, 0);
-    } else if (fn11 & QUAL_S) {
-        gen_helper_ieee_input_s(val, cpu_env, cpu_fir[reg]);
-    } else if (is_cmp) {
-        gen_helper_ieee_input_cmp(val, cpu_env, cpu_fir[reg]);
+        val = tcg_const_i64(0);
     } else {
-        gen_helper_ieee_input(val, cpu_env, cpu_fir[reg]);
+        if ((fn11 & QUAL_S) == 0) {
+            if (is_cmp) {
+                gen_helper_ieee_input_cmp(cpu_env, cpu_fir[reg]);
+            } else {
+                gen_helper_ieee_input(cpu_env, cpu_fir[reg]);
+            }
+        }
+        val = tcg_temp_new();
+        tcg_gen_mov_i64(val, cpu_fir[reg]);
     }
     return val;
 }
Signature · 1 line
1.7.7.6
#10 lore raw

PATCH v2 10/10 target-alpha: Use noreturn marker in helper.h.

In reply to Richard Henderson
---
 target-alpha/helper.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
target-alpha/helper.h +1 -1
index 9f97c5d..a184def 100644
@@ -1,6 +1,6 @@
 #include "def-helper.h"
 
-DEF_HELPER_3(excp, void, env, int, int)
+DEF_HELPER_3(excp, noreturn, env, int, int)
 DEF_HELPER_FLAGS_1(load_pcc, TCG_CALL_CONST | TCG_CALL_PURE, i64, env)
 
 DEF_HELPER_3(addqv, i64, env, i64, i64)
Signature · 1 line
1.7.7.6
#8 lore raw

PATCH v2 8/10 target-alpha: Move memory helpers to mem_helper.c.

In reply to Richard Henderson

This completes the transition away from AREG0. This patch must be last because it requires CONFIG_TCG_PASS_AREG0 set too.

---
 Makefile.target           |    4 +-
 configure                 |    2 +-
 target-alpha/helper.h     |    8 +-
 target-alpha/mem_helper.c |  151 +++++++++++++++++++++++++++++++++++++++++
 target-alpha/op_helper.c  |  162 ---------------------------------------------
 target-alpha/translate.c  |   10 ++--
 6 files changed, 164 insertions(+), 173 deletions(-)
 create mode 100644 target-alpha/mem_helper.c
 delete mode 100644 target-alpha/op_helper.c
Makefile.target +3 -1
index 254a9fa..44b2e83 100644
@@ -81,8 +81,10 @@ libobj-y += tcg/tcg.o tcg/optimize.o
 libobj-$(CONFIG_TCG_INTERPRETER) += tci.o
 libobj-y += fpu/softfloat.o
 ifneq ($(TARGET_BASE_ARCH), sparc)
+ifneq ($(TARGET_BASE_ARCH), alpha)
 libobj-y += op_helper.o
 endif
+endif
 libobj-y += helper.o
 ifeq ($(TARGET_BASE_ARCH), i386)
 libobj-y += cpuid.o
@@ -96,7 +98,7 @@ libobj-y += cpu_init.o
 endif
 libobj-$(TARGET_SPARC) += int32_helper.o
 libobj-$(TARGET_SPARC64) += int64_helper.o
-libobj-$(TARGET_ALPHA) += int_helper.o fpu_helper.o sys_helper.o
+libobj-$(TARGET_ALPHA) += int_helper.o fpu_helper.o sys_helper.o mem_helper.o
 
 libobj-y += disas.o
 libobj-$(CONFIG_TCI_DIS) += tci-dis.o
configure +1 -1
index 8b4e3c1..14ef738 100755
@@ -3608,7 +3608,7 @@ case "$target_arch2" in
 esac
 
 case "$target_arch2" in
-  sparc*)
+  alpha | sparc*)
     echo "CONFIG_TCG_PASS_AREG0=y" >> $config_target_mak
   ;;
 esac
target-alpha/helper.h +4 -4
index f057ecf..03cc185 100644
@@ -104,12 +104,12 @@ DEF_HELPER_2(hw_ret, void, env, i64)
 
 DEF_HELPER_1(ldl_phys, i64, i64)
 DEF_HELPER_1(ldq_phys, i64, i64)
-DEF_HELPER_1(ldl_l_phys, i64, i64)
-DEF_HELPER_1(ldq_l_phys, i64, i64)
+DEF_HELPER_2(ldl_l_phys, i64, env, i64)
+DEF_HELPER_2(ldq_l_phys, i64, env, i64)
 DEF_HELPER_2(stl_phys, void, i64, i64)
 DEF_HELPER_2(stq_phys, void, i64, i64)
-DEF_HELPER_2(stl_c_phys, i64, i64, i64)
-DEF_HELPER_2(stq_c_phys, i64, i64, i64)
+DEF_HELPER_3(stl_c_phys, i64, env, i64, i64)
+DEF_HELPER_3(stq_c_phys, i64, env, i64, i64)
 
 DEF_HELPER_FLAGS_1(tbia, TCG_CALL_CONST, void, env)
 DEF_HELPER_FLAGS_2(tbis, TCG_CALL_CONST, void, env, i64)
target-alpha/mem_helper.c new file +151 -0

151 lines not on this page · raw message

target-alpha/op_helper.c deleted +0 -162

162 lines not on this page · raw message

target-alpha/translate.c +5 -5
index cc87320..dd09ad8 100644
@@ -2867,11 +2867,11 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn)
                 break;
             case 0x2:
                 /* Longword physical access with lock (hw_ldl_l/p) */
-                gen_helper_ldl_l_phys(cpu_ir[ra], addr);
+                gen_helper_ldl_l_phys(cpu_ir[ra], cpu_env, addr);
                 break;
             case 0x3:
                 /* Quadword physical access with lock (hw_ldq_l/p) */
-                gen_helper_ldq_l_phys(cpu_ir[ra], addr);
+                gen_helper_ldq_l_phys(cpu_ir[ra], cpu_env, addr);
                 break;
             case 0x4:
                 /* Longword virtual PTE fetch (hw_ldl/v) */
@@ -3180,11 +3180,11 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn)
                 break;
             case 0x2:
                 /* Longword physical access with lock */
-                gen_helper_stl_c_phys(val, addr, val);
+                gen_helper_stl_c_phys(val, cpu_env, addr, val);
                 break;
             case 0x3:
                 /* Quadword physical access with lock */
-                gen_helper_stq_c_phys(val, addr, val);
+                gen_helper_stq_c_phys(val, cpu_env, addr, val);
                 break;
             case 0x4:
                 /* Longword virtual access */
@@ -3420,7 +3420,7 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env,
         }
         if (num_insns + 1 == max_insns && (tb->cflags & CF_LAST_IO))
             gen_io_start();
-        insn = ldl_code(ctx.pc);
+        insn = cpu_ldl_code(env, ctx.pc);
         num_insns++;
 
 	if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_OP))) {
Signature · 1 line
1.7.7.6
#4 lore raw

PATCH v2 4/10 target-alpha: Move floating-point helpers to fpu_helper.c.

In reply to Richard Henderson
---
 Makefile.target           |    2 +-
 target-alpha/fpu_helper.c |  846 +++++++++++++++++++++++++++++++++++++++++++++
 target-alpha/helper.h     |  106 +++---
 target-alpha/op_helper.c  |  812 -------------------------------------------
 target-alpha/translate.c  |  130 ++++----
 5 files changed, 967 insertions(+), 929 deletions(-)
 create mode 100644 target-alpha/fpu_helper.c
Makefile.target +1 -1
index ddeb7e0..256e7b5 100644
@@ -96,7 +96,7 @@ libobj-y += cpu_init.o
 endif
 libobj-$(TARGET_SPARC) += int32_helper.o
 libobj-$(TARGET_SPARC64) += int64_helper.o
-libobj-$(TARGET_ALPHA) += int_helper.o
+libobj-$(TARGET_ALPHA) += int_helper.o fpu_helper.o
 
 libobj-y += disas.o
 libobj-$(CONFIG_TCI_DIS) += tci-dis.o
target-alpha/fpu_helper.c new file +846 -0

846 lines not on this page · raw message

target-alpha/helper.h +53 -53

118 lines not on this page · raw message

target-alpha/op_helper.c +0 -812

824 lines not on this page · raw message

target-alpha/translate.c +67 -63

246 lines not on this page · raw message

Signature · 1 line
1.7.7.6
Applied
#11 lore raw
In reply to Richard Henderson

Thanks, applied all.

Quoted 44 lines · Richard Henderson

Changes v1->v2:
 * Formatting fixed during the move to new files.  It might have been cleaner to fix it before the move, but it was easier to run the existing patches through checkpatch.pl.

 * Add noreturn marker, now that it's available.

r~

Richard Henderson (10):
 alpha-linux-user: Initialize fpu to round-to-normal.
 target-alpha: Move integer helpers to int_helper.c.
 target-alpha: Move exception helpers to helper.c.
 target-alpha: Move floating-point helpers to fpu_helper.c.
 target-alpha: Move fpcr helpers from op_helper.c to helper.c.
 target-alpha: Move integer overflow helpers to int_helper.c.
 target-alpha: Move palcode support helpers to sys_helper.c.
 target-alpha: Move memory helpers to mem_helper.c.
 target-alpha: Make use of fp_status.flush_inputs_to_zero.
 target-alpha: Use noreturn marker in helper.h.

 Makefile.target           |    3 +
 configure                 |    2 +-
 target-alpha/cpu.h        |    4 +-
 target-alpha/fpu_helper.c |  822 +++++++++++++++++++++++++++ target-alpha/helper.c     |   61 ++-
 target-alpha/helper.h     |  143 +++---
 target-alpha/int_helper.c |  320 +++++++++++ target-alpha/mem_helper.c |  151 +++++
 target-alpha/op_helper.c  | 1379 --------------------------------------------- target-alpha/sys_helper.c |   87 +++
 target-alpha/translate.c  |  222 +++++---

 11 files changed, 1643 insertions(+), 1551 deletions(-)

 create mode 100644 target-alpha/fpu_helper.c
 create mode 100644 target-alpha/int_helper.c
 create mode 100644 target-alpha/mem_helper.c
 delete mode 100644 target-alpha/op_helper.c
 create mode 100644 target-alpha/sys_helper.c

--
1.7.7.6