microblaze: Add support for the sleep insn
PATCH 1/1 microblaze: Add support for the sleep insn
From: "Edgar E. Iglesias" <[email protected]>
Signed-off-by Edgar E. Iglesias <[email protected]>
--- target-microblaze/translate.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
target-microblaze/translate.c +15 -0
@@ -1317,6 +1317,21 @@ static void dec_br(DisasContext *dc)/* Memory barrier. */ mbar = (dc->ir >>16 ) &31 ;if (mbar ==2 && dc->imm ==4 ) { +/* mbar IMM & 16 decodes to sleep. */ +if (dc->rd &16 ) { +TCGv_i32 tmp =tcg_const_i32 (EXCP_HLT ); + +LOG_DIS ("sleep\n" ); + +t_sync_flags (dc); +tcg_gen_st_i32 (tcg_const_i32 (1 ), cpu_env, + -offsetof(MicroBlazeCPU , env) + +offsetof(CPUState , halted)); +tcg_gen_movi_tl (cpu_SR[SR_PC ], dc->pc +4 ); +gen_helper_raise_exception (cpu_env, tmp); +tcg_temp_free_i32 (tmp); +return ; + }LOG_DIS ("mbar %d\n" , dc->rd);/* Break the TB. */ dc->cpustate_changed =1 ;
Signature · 1 line
1.7.9.5
Quoted 13 lines · On Fri, Mar 29, 2013 at 9:44 PM, <[email protected]> wrote:
From: "Edgar E. Iglesias" <[email protected]>
Signed-off-by Edgar E. Iglesias <[email protected]>--- target-microblaze/translate.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)target-microblaze/translate.c +0
-0@@ -1317,6 +1317,21 @@ static void dec_br(DisasContext *dc)/* Memory barrier. */
target-microblaze/translate.c static void dec_br(DisasContext *dc) · line 1327
Quoted 10 lines
target-microblaze/translate.c +8
-0mbar = (dc->ir >>16 ) &31 ;if (mbar ==2 && dc->imm ==4 ) { +/* mbar IMM & 16 decodes to sleep. */ +if (dc->rd &16 ) { +TCGv_i32 tmp =tcg_const_i32 (EXCP_HLT ); + +LOG_DIS ("sleep\n" ); + +t_sync_flags (dc); + tcg_gen_st_i32(tcg_const_i32(1), cpu_env,
This leaks the result of tcg_const_i32(1).
Quoted 14 lines
target-microblaze/translate.c +7
-1+ -offsetof(MicroBlazeCPU , env) + +offsetof(CPUState, halted)); +tcg_gen_movi_tl (cpu_SR[SR_PC ], dc->pc +4 ); +gen_helper_raise_exception (cpu_env, tmp); +tcg_temp_free_i32 (tmp); +return ; + }LOG_DIS ("mbar %d\n" , dc->rd);/* Break the TB. */ dc->cpustate_changed =1 ; --1.7.9.5
Quoted 18 lines · Blue Swirl
Quoted 17 lines · On Fri, Mar 29, 2013 at 9:44 PM, <[email protected]> wrote:
From: "Edgar E. Iglesias" <[email protected]>
Signed-off-by Edgar E. Iglesias <[email protected]>--- target-microblaze/translate.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)target-microblaze/translate.c +2
-0@@ -1317,6 +1317,21 @@ static void dec_br(DisasContext *dc)/* Memory barrier. */ mbar = (dc->ir >>16 ) &31 ;if (mbar ==2 && dc->imm ==4 ) { +/* mbar IMM & 16 decodes to sleep. */ +if (dc->rd &16 ) {
Quoted 8 lines
target-microblaze/translate.c static void dec_br(DisasContext *dc) · line 1327
Quoted 6 lines
target-microblaze/translate.c +6
-0+TCGv_i32 tmp =tcg_const_i32 (EXCP_HLT ); + +LOG_DIS ("sleep\n" ); + +t_sync_flags (dc); + tcg_gen_st_i32(tcg_const_i32(1), cpu_env,This leaks the result of
tcg_const_i32(1).
Fixed in v2, thanks
Edgar