提交 8e9b0678 编写于 作者: A Alexandre Courbot 提交者: Aurelien Jarno

target-sh4: Split the LDST macro into 2 sub-macros

The LDST macro is used to generate ldc and stc instructions that work with a
specific register. However, the SGR register only supports stc up to SH4A,
which supports both stc and ldc. This patch creates two sub-macros named LD
and ST that handle generating ldc and stc instructions separately, and
redeclares LDST to use these sub-macro.
Signed-off-by: NAlexandre Courbot <gnurou@gmail.com>
Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
上级 1ddda5cd
...@@ -1511,7 +1511,7 @@ static void _decode_opc(DisasContext * ctx) ...@@ -1511,7 +1511,7 @@ static void _decode_opc(DisasContext * ctx)
tcg_temp_free(addr); tcg_temp_free(addr);
} }
return; return;
#define LDST(reg,ldnum,ldpnum,stnum,stpnum,prechk) \ #define LD(reg,ldnum,ldpnum,prechk) \
case ldnum: \ case ldnum: \
prechk \ prechk \
tcg_gen_mov_i32 (cpu_##reg, REG(B11_8)); \ tcg_gen_mov_i32 (cpu_##reg, REG(B11_8)); \
...@@ -1520,7 +1520,8 @@ static void _decode_opc(DisasContext * ctx) ...@@ -1520,7 +1520,8 @@ static void _decode_opc(DisasContext * ctx)
prechk \ prechk \
tcg_gen_qemu_ld32s (cpu_##reg, REG(B11_8), ctx->memidx); \ tcg_gen_qemu_ld32s (cpu_##reg, REG(B11_8), ctx->memidx); \
tcg_gen_addi_i32(REG(B11_8), REG(B11_8), 4); \ tcg_gen_addi_i32(REG(B11_8), REG(B11_8), 4); \
return; \ return;
#define ST(reg,stnum,stpnum,prechk) \
case stnum: \ case stnum: \
prechk \ prechk \
tcg_gen_mov_i32 (REG(B11_8), cpu_##reg); \ tcg_gen_mov_i32 (REG(B11_8), cpu_##reg); \
...@@ -1535,6 +1536,9 @@ static void _decode_opc(DisasContext * ctx) ...@@ -1535,6 +1536,9 @@ static void _decode_opc(DisasContext * ctx)
tcg_temp_free(addr); \ tcg_temp_free(addr); \
} \ } \
return; return;
#define LDST(reg,ldnum,ldpnum,stnum,stpnum,prechk) \
LD(reg,ldnum,ldpnum,prechk) \
ST(reg,stnum,stpnum,prechk)
LDST(gbr, 0x401e, 0x4017, 0x0012, 0x4013, {}) LDST(gbr, 0x401e, 0x4017, 0x0012, 0x4013, {})
LDST(vbr, 0x402e, 0x4027, 0x0022, 0x4023, CHECK_PRIVILEGED) LDST(vbr, 0x402e, 0x4027, 0x0022, 0x4023, CHECK_PRIVILEGED)
LDST(ssr, 0x403e, 0x4037, 0x0032, 0x4033, CHECK_PRIVILEGED) LDST(ssr, 0x403e, 0x4037, 0x0032, 0x4033, CHECK_PRIVILEGED)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册