aboutsummaryrefslogtreecommitdiff
path: root/target-sparc/cc_helper.c
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2011-07-03 16:01:57 +0000
committerBlue Swirl <blauwirbel@gmail.com>2011-10-23 15:09:37 +0000
commit2ffd9176b10caefab5f2bade13b1b54154266b35 (patch)
treecb0c460c8e9bdaf2210d9ed5acc0287e7abc9205 /target-sparc/cc_helper.c
parentcffc581873fdb482644acfc4f61d294ad4e81cf0 (diff)
downloadqemu-2ffd9176b10caefab5f2bade13b1b54154266b35.zip
qemu-2ffd9176b10caefab5f2bade13b1b54154266b35.tar.gz
qemu-2ffd9176b10caefab5f2bade13b1b54154266b35.tar.bz2
Sparc: avoid AREG0 for lazy condition code helpers
Make lazy condition code helpers take a parameter for CPUState instead of relying on global env. Reviewed-by: Richard Henderson <rth@twiddle.net> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'target-sparc/cc_helper.c')
-rw-r--r--target-sparc/cc_helper.c73
1 files changed, 36 insertions, 37 deletions
diff --git a/target-sparc/cc_helper.c b/target-sparc/cc_helper.c
index a067397..04bd2cf 100644
--- a/target-sparc/cc_helper.c
+++ b/target-sparc/cc_helper.c
@@ -18,15 +18,14 @@
*/
#include "cpu.h"
-#include "dyngen-exec.h"
#include "helper.h"
-static uint32_t compute_all_flags(void)
+static uint32_t compute_all_flags(CPUState *env)
{
return env->psr & PSR_ICC;
}
-static uint32_t compute_C_flags(void)
+static uint32_t compute_C_flags(CPUState *env)
{
return env->psr & PSR_CARRY;
}
@@ -44,12 +43,12 @@ static inline uint32_t get_NZ_icc(int32_t dst)
}
#ifdef TARGET_SPARC64
-static uint32_t compute_all_flags_xcc(void)
+static uint32_t compute_all_flags_xcc(CPUState *env)
{
return env->xcc & PSR_ICC;
}
-static uint32_t compute_C_flags_xcc(void)
+static uint32_t compute_C_flags_xcc(CPUState *env)
{
return env->xcc & PSR_CARRY;
}
@@ -77,7 +76,7 @@ static inline uint32_t get_V_div_icc(target_ulong src2)
return ret;
}
-static uint32_t compute_all_div(void)
+static uint32_t compute_all_div(CPUState *env)
{
uint32_t ret;
@@ -86,7 +85,7 @@ static uint32_t compute_all_div(void)
return ret;
}
-static uint32_t compute_C_div(void)
+static uint32_t compute_C_div(CPUState *env)
{
return 0;
}
@@ -156,7 +155,7 @@ static inline uint32_t get_V_add_xcc(target_ulong dst, target_ulong src1,
return ret;
}
-static uint32_t compute_all_add_xcc(void)
+static uint32_t compute_all_add_xcc(CPUState *env)
{
uint32_t ret;
@@ -166,13 +165,13 @@ static uint32_t compute_all_add_xcc(void)
return ret;
}
-static uint32_t compute_C_add_xcc(void)
+static uint32_t compute_C_add_xcc(CPUState *env)
{
return get_C_add_xcc(CC_DST, CC_SRC);
}
#endif
-static uint32_t compute_all_add(void)
+static uint32_t compute_all_add(CPUState *env)
{
uint32_t ret;
@@ -182,13 +181,13 @@ static uint32_t compute_all_add(void)
return ret;
}
-static uint32_t compute_C_add(void)
+static uint32_t compute_C_add(CPUState *env)
{
return get_C_add_icc(CC_DST, CC_SRC);
}
#ifdef TARGET_SPARC64
-static uint32_t compute_all_addx_xcc(void)
+static uint32_t compute_all_addx_xcc(CPUState *env)
{
uint32_t ret;
@@ -198,7 +197,7 @@ static uint32_t compute_all_addx_xcc(void)
return ret;
}
-static uint32_t compute_C_addx_xcc(void)
+static uint32_t compute_C_addx_xcc(CPUState *env)
{
uint32_t ret;
@@ -207,7 +206,7 @@ static uint32_t compute_C_addx_xcc(void)
}
#endif
-static uint32_t compute_all_addx(void)
+static uint32_t compute_all_addx(CPUState *env)
{
uint32_t ret;
@@ -217,7 +216,7 @@ static uint32_t compute_all_addx(void)
return ret;
}
-static uint32_t compute_C_addx(void)
+static uint32_t compute_C_addx(CPUState *env)
{
uint32_t ret;
@@ -235,7 +234,7 @@ static inline uint32_t get_V_tag_icc(target_ulong src1, target_ulong src2)
return ret;
}
-static uint32_t compute_all_tadd(void)
+static uint32_t compute_all_tadd(CPUState *env)
{
uint32_t ret;
@@ -246,7 +245,7 @@ static uint32_t compute_all_tadd(void)
return ret;
}
-static uint32_t compute_all_taddtv(void)
+static uint32_t compute_all_taddtv(CPUState *env)
{
uint32_t ret;
@@ -321,7 +320,7 @@ static inline uint32_t get_V_sub_xcc(target_ulong dst, target_ulong src1,
return ret;
}
-static uint32_t compute_all_sub_xcc(void)
+static uint32_t compute_all_sub_xcc(CPUState *env)
{
uint32_t ret;
@@ -331,13 +330,13 @@ static uint32_t compute_all_sub_xcc(void)
return ret;
}
-static uint32_t compute_C_sub_xcc(void)
+static uint32_t compute_C_sub_xcc(CPUState *env)
{
return get_C_sub_xcc(CC_SRC, CC_SRC2);
}
#endif
-static uint32_t compute_all_sub(void)
+static uint32_t compute_all_sub(CPUState *env)
{
uint32_t ret;
@@ -347,13 +346,13 @@ static uint32_t compute_all_sub(void)
return ret;
}
-static uint32_t compute_C_sub(void)
+static uint32_t compute_C_sub(CPUState *env)
{
return get_C_sub_icc(CC_SRC, CC_SRC2);
}
#ifdef TARGET_SPARC64
-static uint32_t compute_all_subx_xcc(void)
+static uint32_t compute_all_subx_xcc(CPUState *env)
{
uint32_t ret;
@@ -363,7 +362,7 @@ static uint32_t compute_all_subx_xcc(void)
return ret;
}
-static uint32_t compute_C_subx_xcc(void)
+static uint32_t compute_C_subx_xcc(CPUState *env)
{
uint32_t ret;
@@ -372,7 +371,7 @@ static uint32_t compute_C_subx_xcc(void)
}
#endif
-static uint32_t compute_all_subx(void)
+static uint32_t compute_all_subx(CPUState *env)
{
uint32_t ret;
@@ -382,7 +381,7 @@ static uint32_t compute_all_subx(void)
return ret;
}
-static uint32_t compute_C_subx(void)
+static uint32_t compute_C_subx(CPUState *env)
{
uint32_t ret;
@@ -390,7 +389,7 @@ static uint32_t compute_C_subx(void)
return ret;
}
-static uint32_t compute_all_tsub(void)
+static uint32_t compute_all_tsub(CPUState *env)
{
uint32_t ret;
@@ -401,7 +400,7 @@ static uint32_t compute_all_tsub(void)
return ret;
}
-static uint32_t compute_all_tsubtv(void)
+static uint32_t compute_all_tsubtv(CPUState *env)
{
uint32_t ret;
@@ -410,26 +409,26 @@ static uint32_t compute_all_tsubtv(void)
return ret;
}
-static uint32_t compute_all_logic(void)
+static uint32_t compute_all_logic(CPUState *env)
{
return get_NZ_icc(CC_DST);
}
-static uint32_t compute_C_logic(void)
+static uint32_t compute_C_logic(CPUState *env)
{
return 0;
}
#ifdef TARGET_SPARC64
-static uint32_t compute_all_logic_xcc(void)
+static uint32_t compute_all_logic_xcc(CPUState *env)
{
return get_NZ_xcc(CC_DST);
}
#endif
typedef struct CCTable {
- uint32_t (*compute_all)(void); /* return all the flags */
- uint32_t (*compute_c)(void); /* return the C flag */
+ uint32_t (*compute_all)(CPUState *env); /* return all the flags */
+ uint32_t (*compute_c)(CPUState *env); /* return the C flag */
} CCTable;
static const CCTable icc_table[CC_OP_NB] = {
@@ -464,23 +463,23 @@ static const CCTable xcc_table[CC_OP_NB] = {
};
#endif
-void helper_compute_psr(void)
+void helper_compute_psr(CPUState *env)
{
uint32_t new_psr;
- new_psr = icc_table[CC_OP].compute_all();
+ new_psr = icc_table[CC_OP].compute_all(env);
env->psr = new_psr;
#ifdef TARGET_SPARC64
- new_psr = xcc_table[CC_OP].compute_all();
+ new_psr = xcc_table[CC_OP].compute_all(env);
env->xcc = new_psr;
#endif
CC_OP = CC_OP_FLAGS;
}
-uint32_t helper_compute_C_icc(void)
+uint32_t helper_compute_C_icc(CPUState *env)
{
uint32_t ret;
- ret = icc_table[CC_OP].compute_c() >> PSR_CARRY_SHIFT;
+ ret = icc_table[CC_OP].compute_c(env) >> PSR_CARRY_SHIFT;
return ret;
}