aboutsummaryrefslogtreecommitdiff
path: root/target/xtensa/translate.c
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2019-02-11 12:22:29 -0800
committerMax Filippov <jcmvbkbc@gmail.com>2019-02-28 04:43:22 -0800
commitc949009bc0612cbfc7bc5b80c3e9ea3e24313434 (patch)
treef9db6c6424c5ccc8a7b6309edc7da6e7268ec19c /target/xtensa/translate.c
parent8df3fd359697d68095c5f1ba47e83e8e237a3055 (diff)
target/xtensa: only rotate window in the retw helper
Move return address calculation and WINDOW_START adjustment out of the retw helper to simplify logic a bit and avoid using registers directly. Pass a0 as a parameter to the helper. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Diffstat (limited to 'target/xtensa/translate.c')
-rw-r--r--target/xtensa/translate.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
index cbb8d879a8..e63a5f5e71 100644
--- a/target/xtensa/translate.c
+++ b/target/xtensa/translate.c
@@ -2227,8 +2227,13 @@ static bool test_ill_retw(DisasContext *dc, const uint32_t arg[],
static void translate_retw(DisasContext *dc, const uint32_t arg[],
const uint32_t par[])
{
- TCGv_i32 tmp = tcg_const_i32(dc->pc);
- gen_helper_retw(tmp, cpu_env, tmp);
+ TCGv_i32 tmp = tcg_const_i32(1);
+ tcg_gen_shl_i32(tmp, tmp, cpu_SR[WINDOW_BASE]);
+ tcg_gen_andc_i32(cpu_SR[WINDOW_START],
+ cpu_SR[WINDOW_START], tmp);
+ tcg_gen_movi_i32(tmp, dc->pc);
+ tcg_gen_deposit_i32(tmp, tmp, cpu_R[0], 0, 30);
+ gen_helper_retw(cpu_env, cpu_R[0]);
gen_jump(dc, tmp);
tcg_temp_free(tmp);
}