target-mips: use CP0EnLo_XI instead of magic number
PATCH 1/1 target-mips: use CP0EnLo_XI instead of magic number
--- target-mips/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target-mips/translate.c +2 -2
@@ -4947,7 +4947,7 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel)#if defined(TARGET_MIPS64 )if (ctx->rxi) {TCGv tmp =tcg_temp_new (); -tcg_gen_andi_tl (tmp, arg, (3ull <<62 )); +tcg_gen_andi_tl (tmp, arg, (3ull << CP0EnLo_XI));tcg_gen_shri_tl (tmp, tmp,32 );tcg_gen_or_tl (arg, arg, tmp);tcg_temp_free (tmp);
@@ -5002,7 +5002,7 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel)#if defined(TARGET_MIPS64 )if (ctx->rxi) {TCGv tmp =tcg_temp_new (); -tcg_gen_andi_tl (tmp, arg, (3ull <<62 )); +tcg_gen_andi_tl (tmp, arg, (3ull << CP0EnLo_XI));tcg_gen_shri_tl (tmp, tmp,32 );tcg_gen_or_tl (arg, arg, tmp);tcg_temp_free (tmp);
Signature · 1 line
2.1.0
Quoted 2 lines · Leon Alrae
Signed-off-by Leon Alrae <[email protected]>---
Enthusiastically:
However...
target-mips/translate.c static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel) · line 4951
Quoted 11 lines
target-mips/translate.c +1
-1@@ -4947,7 +4947,7 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel)#if defined(TARGET_MIPS64 )if (ctx->rxi) {TCGv tmp =tcg_temp_new (); -tcg_gen_andi_tl (tmp, arg, (3ull <<62 )); +tcg_gen_andi_tl (tmp, arg, (3ull << CP0EnLo_XI));tcg_gen_shri_tl (tmp, tmp,32 );
... don't we need to do:
tcg_gen_andi_tl(arg, arg, ~(3ull << CP0EnLo_XI));
here and for EntryLo1 as well (for LPA-enabled processors)?
target-mips/translate.c static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel) · line 4953
Quoted 2 lines
target-mips/translate.c +0
-0tcg_gen_or_tl (arg, arg, tmp);tcg_temp_free (tmp);
And do we want to have CP0C3_LPA set in the few templates that do in the
first place? AFAICT we don't really implement LPA so this bit will confuse software. Of course implementing it would be another option, not very complicated AFAICS, and if we can track the requirement to update MFC0 at that time, then the clean-up I mentioned above can be deferred until then.
Maciej
Quoted 10 lines · Maciej W. Rozycki
target-mips/translate.c static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel) · line 4951
Quoted 7 lines
target-mips/translate.c +1
-1@@ -4947,7 +4947,7 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel)#if defined(TARGET_MIPS64 )if (ctx->rxi) {TCGv tmp =tcg_temp_new (); -tcg_gen_andi_tl (tmp, arg, (3ull <<62 )); +tcg_gen_andi_tl (tmp, arg, (3ull << CP0EnLo_XI));tcg_gen_shri_tl (tmp, tmp,32 );... don't we need to do:
Quoted 3 lines
tcg_gen_andi_tl(arg, arg, ~(3ull << CP0EnLo_XI));here and for EntryLo1 as well (for LPA-enabled processors)?
Yes, this would be required if we supported LPA - good spot.
Quoted 10 lines
Review static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel) · line 4953
Quoted 3 lines
(quoted diff) +0
-0tcg_gen_or_tl(arg, arg, tmp); tcg_temp_free(tmp);And do we want to have
CP0C3_LPAset in the few templates that do in the
first place? AFAICT we don't really implement LPA so this bit will confuse software. Of course implementing it would be another option, not very complicated AFAICS, and if we can track the requirement to update MFC0 at that time, then the clean-up I mentioned above can be deferred until then.
In general I don't think it's a good idea to indicate presence of a feature in a CPU config if it isn't implemented at all in QEMU -- as you said, it will confuse software. As far as LPA goes I've got already an implementation of it (and XPA as well) which I haven't submitted upstream yet. I'll make sure it contains the change you suggested.
Thanks,
Leon
Quoted 7 lines · Leon Alrae
Quoted 6 lines
And do we want to have
CP0C3_LPAset in the few templates that do in the
first place? AFAICT we don't really implement LPA so this bit will confuse software. Of course implementing it would be another option, not very complicated AFAICS, and if we can track the requirement to update MFC0 at that time, then the clean-up I mentioned above can be deferred until then.
Quoted 5 lines
In general I don't think it's a good idea to indicate presence of a feature in a CPU config if it isn't implemented at all in QEMU -- as you said, it will confuse software. As far as LPA goes I've got already an implementation of it (and XPA as well) which I haven't submitted upstream yet. I'll make sure it contains the change you suggested.
Great, I'll leave it to you to sort out then. Thanks!
Maciej