Bug in ppc/BookE wait instruction
Hello,
I think there's a bug in "wait" instruction code generator for PowerPC architecture. It doesn't make sense to store a non-initialized register.
Best regards,
Jakub Horak
target-ppc/translate.c +1 -1
@@ -3439,7 +3439,7 @@ static void gen_sync(DisasContext *ctx)/* wait */ static void gen_wait (DisasContext *ctx) { -TCGv_i32 t0 =tcg_temp_new_i32 (); +TCGv_i32 t0 =tcg_const_i32 (1 );tcg_gen_st_i32 (t0, cpu_env, -offsetof(PowerPCCPU , env) + offsetof(CPUState , halted));tcg_temp_free_i32 (t0);
On 03/06/16 16:45, Jakub Horak wrote:
(Added David as PPC maintainer and qemu-ppc mailing list)
Quoted 14 lines
Hello,
I think there's a bug in "wait" instruction code generator for PowerPC architecture. It doesn't make sense to store a non-initialized register.Best regards,
Jakub Horaktarget-ppc/translate.c +0
-0
target-ppc/translate.c static void gen_sync(DisasContext *ctx) · line 3445
Quoted 8 lines
target-ppc/translate.c +1
-1@@ -3439,7 +3439,7 @@ static void gen_sync(DisasContext *ctx)/* wait */ static void gen_wait (DisasContext *ctx) { -TCGv_i32 t0 =tcg_temp_new_i32 (); +TCGv_i32 t0 =tcg_const_i32 (1 );tcg_gen_st_i32 (t0, cpu_env, -offsetof(PowerPCCPU , env) + offsetof(CPUState , halted));tcg_temp_free_i32 (t0);
ATB,
Mark.
Quoted 6 lines · Jakub Horak
Hello,
I think there's a bug in "wait" instruction code generator for PowerPC architecture. It doesn't make sense to store a non-initialized register.Best regards,
Jakub Horak
The fix looks correct, but I need a Signed-off-by line in order to apply it.
In future, please send such patches to myself and Alex Graf (target-ppc maintainers) the qemu-ppc list as well as qemu-devel. I wouldn't have spotted this if Marc Cave-Ayland hadn't copied it to me.
Quoted 16 lines
target-ppc/translate.c +1
-1@@ -3439,7 +3439,7 @@ static void gen_sync(DisasContext *ctx)/* wait */ static void gen_wait (DisasContext *ctx) { -TCGv_i32 t0 =tcg_temp_new_i32 (); +TCGv_i32 t0 =tcg_const_i32 (1 );tcg_gen_st_i32 (t0, cpu_env, -offsetof(PowerPCCPU , env) + offsetof(CPUState , halted));tcg_temp_free_i32 (t0);
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Hello,
Quoted 10 lines · David Gibson
Quoted 6 lines · Jakub Horak
Hello,
I think there's a bug in "wait" instruction code generator for PowerPC architecture. It doesn't make sense to store a non-initialized register.Best regards,
Jakub HorakThe fix looks correct, but I need a Signed-off-by line in order to apply it.
Here you go:
Fixed bug in code generator.
target-ppc/translate.c +1 -1
@@ -3439,7 +3439,7 @@ static void gen_sync(DisasContext *ctx)/* wait */ static void gen_wait (DisasContext *ctx) { -TCGv_i32 t0 =tcg_temp_new_i32 (); +TCGv_i32 t0 =tcg_const_i32 (1 );tcg_gen_st_i32 (t0, cpu_env, -offsetof(PowerPCCPU , env) + offsetof(CPUState , halted));tcg_temp_free_i32 (t0);
Quoted 4 lines
In future, please send such patches to myself and Alex Graf (target-ppc maintainers) the qemu-ppc list as well as qemu-devel. I wouldn't have spotted this if Marc Cave-Ayland hadn't copied it to me.
Sorry, I'll be more thoughtful next time.
Best regards,
Jakub
Quoted 23 lines
Quoted 17 lines
target-ppc/translate.c +1
-1@@ -3439,7 +3439,7 @@ static void gen_sync(DisasContext *ctx)/* wait */ static void gen_wait (DisasContext *ctx) { -TCGv_i32 t0 =tcg_temp_new_i32 (); +TCGv_i32 t0 =tcg_const_i32 (1 );tcg_gen_st_i32 (t0, cpu_env, -offsetof(PowerPCCPU , env) + offsetof(CPUState , halted));tcg_temp_free_i32 (t0);Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 37 lines · Jakub Horak
Hello,
Quoted 10 lines · David Gibson
Quoted 6 lines · Jakub Horak
Hello,
I think there's a bug in "wait" instruction code generator for PowerPC architecture. It doesn't make sense to store a non-initialized register.Best regards,
Jakub HorakThe fix looks correct, but I need a Signed-off-by line in order to apply it.
Here you go:
Fixed bug in code generator.
Signed-off-by Jakub Horak <[email protected]>target-ppc/translate.c +1
-1@@ -3439,7 +3439,7 @@ static void gen_sync(DisasContext *ctx)/* wait */ static void gen_wait (DisasContext *ctx) { -TCGv_i32 t0 =tcg_temp_new_i32 (); +TCGv_i32 t0 =tcg_const_i32 (1 );tcg_gen_st_i32 (t0, cpu_env, -offsetof(PowerPCCPU , env) + offsetof(CPUState , halted));tcg_temp_free_i32 (t0);Quoted 3 lines
Quoted 5 lines
Quoted 3 lines
In future, please send such patches to myself and Alex Graf (target-ppc maintainers) the qemu-ppc list as well as qemu-devel. I wouldn't have spotted this if Marc Cave-Ayland hadn't copied it to me.
Sorry, I'll be more thoughtful next time.
Sorry, I forgot about this one after you resent, I've now applied to ppc-for-2.7.
Quoted 25 lines
Best regards,
JakubQuoted 18 lines
Quoted 17 lines
target-ppc/translate.c +1
-1@@ -3439,7 +3439,7 @@ static void gen_sync(DisasContext *ctx)/* wait */ static void gen_wait (DisasContext *ctx) { -TCGv_i32 t0 =tcg_temp_new_i32 (); +TCGv_i32 t0 =tcg_const_i32 (1 );tcg_gen_st_i32 (t0, cpu_env, -offsetof(PowerPCCPU , env) + offsetof(CPUState , halted));tcg_temp_free_i32 (t0);
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson