[PATCH 2/4] target/i386: use gen_writeback() within gen_POP()

Mark Cave-Ayland posted 4 patches 5 months, 3 weeks ago
Maintainers: Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Eduardo Habkost <eduardo@habkost.net>
[PATCH 2/4] target/i386: use gen_writeback() within gen_POP()
Posted by Mark Cave-Ayland 5 months, 3 weeks ago
Instead of directly implementing the writeback using gen_op_st_v(), use the
existing gen_writeback() function.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
 target/i386/tcg/emit.c.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc
index a89f8e0ebb..2d5dc11548 100644
--- a/target/i386/tcg/emit.c.inc
+++ b/target/i386/tcg/emit.c.inc
@@ -2569,7 +2569,7 @@ static void gen_POP(DisasContext *s, CPUX86State *env, X86DecodedInsn *decode)
 
     if (op->has_ea) {
         /* NOTE: order is important for MMU exceptions */
-        gen_op_st_v(s, ot, s->T0, s->A0);
+        gen_writeback(s, decode, 0, s->T0);
         op->unit = X86_OP_SKIP;
     }
     /* NOTE: writing back registers after update is important for pop %sp */
-- 
2.39.2
Re: [PATCH 2/4] target/i386: use gen_writeback() within gen_POP()
Posted by Mark Cave-Ayland 5 months, 2 weeks ago
On 06/06/2024 10:53, Mark Cave-Ayland wrote:

> Instead of directly implementing the writeback using gen_op_st_v(), use the
> existing gen_writeback() function.
> 
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> ---
>   target/i386/tcg/emit.c.inc | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target/i386/tcg/emit.c.inc b/target/i386/tcg/emit.c.inc
> index a89f8e0ebb..2d5dc11548 100644
> --- a/target/i386/tcg/emit.c.inc
> +++ b/target/i386/tcg/emit.c.inc
> @@ -2569,7 +2569,7 @@ static void gen_POP(DisasContext *s, CPUX86State *env, X86DecodedInsn *decode)
>   
>       if (op->has_ea) {
>           /* NOTE: order is important for MMU exceptions */
> -        gen_op_st_v(s, ot, s->T0, s->A0);
> +        gen_writeback(s, decode, 0, s->T0);
>           op->unit = X86_OP_SKIP;
>       }
>       /* NOTE: writing back registers after update is important for pop %sp */

Hi Paolo,

I've just noticed that gen_writeback() also sets op->unit to X86_OP_SKIP at the end, 
so in fact the line below it explicitly setting op->unit can also be removed. Do you 
need me to send a v2 with this change included, or is it possible to touch it up 
before commit?


ATB,

Mark.