Skip to contentSkip to conversation

target/i386: Save cc_op before loop insns

PATCH In review Richard Henderson 3 participants 5 messages Jul 20, 2020 – Jul 24, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/i386: Save cc_op before loop insns

We forgot to update cc_op before these branch insns, which lead to losing track of the current eflags.

---
 target/i386/translate.c | 1 +
 1 file changed, 1 insertion(+)
target/i386/translate.c +1 -0
index a1d31f09c1..caea6f5fb1 100644
@@ -7148,6 +7148,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
             l1 = gen_new_label();
             l2 = gen_new_label();
             l3 = gen_new_label();
+            gen_update_cc_op(s);
             b &= 3;
             switch(b) {
             case 0: /* loopnz */
Signature · 1 line
2.25.1
#1 lore raw

Ping?

Quoted 22 lines · Richard Henderson

We forgot to update cc_op before these branch insns, which lead to losing track of the current eflags.

---
 target/i386/translate.c | 1 +
 1 file changed, 1 insertion(+)
target/i386/translate.c +1 -0
index a1d31f09c1..caea6f5fb1 100644
@@ -7148,6 +7148,7 @@ static target_ulong disas_insn(DisasContext *s, CPUState *cpu)
             l1 = gen_new_label();
             l2 = gen_new_label();
             l3 = gen_new_label();
+            gen_update_cc_op(s);
             b &= 3;
             switch(b) {
             case 0: /* loopnz */
#2 lore raw

Looks good, will queue when I am back---or just send a pull request yourself if you prefer.

Paolo

Il ven 24 lug 2020, 20:35 Richard Henderson <[email protected]> ha scritto:

Quoted 28 lines

Ping?

target/i386/translate.c static target_ulong disas_insn(DisasContext *s,

Quoted 14 lines · Richard Henderson

We forgot to update cc_op before these branch insns, which lead to losing track of the current eflags.

---
 target/i386/translate.c | 1 +
 1 file changed, 1 insertion(+)
target/i386/translate.c +0 -0
index a1d31f09c1..caea6f5fb1 100644
@@ -7148,6 +7148,7 @@ static target_ulong disas_insn(DisasContext *s,

CPUState *cpu)

Quoted 8 lines
target/i386/translate.c +1 -0
             l1 = gen_new_label();
             l2 = gen_new_label();
             l3 = gen_new_label();
+            gen_update_cc_op(s);
             b &= 3;
             switch(b) {
             case 0: /* loopnz */
#3 lore raw
Quoted 2 lines · Paolo Bonzini

Looks good, will queue when I am back---or just send a pull request yourself if you prefer.

Ok, will do. Thanks.

r~

Quoted 34 lines

Paolo

Il ven 24 lug 2020, 20:35 Richard Henderson <[email protected] <mailto:[email protected]>> ha scritto:

    Ping?

    On 7/20/20 8:40 AM, Richard Henderson wrote:
    > We forgot to update cc_op before these branch insns,
    > which lead to losing track of the current eflags.
    >
    > Buglink: https://bugs.launchpad.net/qemu/+bug/1888165
    > Signed-off-by: Richard Henderson <[email protected]
    <mailto:[email protected]>>
    > ---
    >  target/i386/translate.c | 1 +
    >  1 file changed, 1 insertion(+)
    >
    > diff --git a/target/i386/translate.c b/target/i386/translate.c
    > index a1d31f09c1..caea6f5fb1 100644
    > --- a/target/i386/translate.c
    > +++ b/target/i386/translate.c
    > @@ -7148,6 +7148,7 @@ static target_ulong disas_insn(DisasContext *s,
    CPUState *cpu)
    >              l1 = gen_new_label();
    >              l2 = gen_new_label();
    >              l3 = gen_new_label();
    > +            gen_update_cc_op(s);
    >              b &= 3;
    >              switch(b) {
    >              case 0: /* loopnz */
    >
Reviewed-by on v1 1/1
#4 lore raw
In reply to Richard Henderson
Quoted 14 lines · Richard Henderson

We forgot to update cc_op before these branch insns, which lead to losing track of the current eflags.

---
 target/i386/translate.c | 1 +
 1 file changed, 1 insertion(+)
target/i386/translate.c +0 -0
index a1d31f09c1..caea6f5fb1 100644

target/i386/translate.c static target_ulong disas_insn(DisasContext *s, · line 7148

Quoted 1 line
target/i386/translate.c +0 -0
@@ -7148,6 +7148,7 @@ static target_ulong disas_insn(DisasContext *s,
 CPUState *cpu)

At first I thought that was too broad to go in disas_insn and then I realised it was one of those mega functions....

target/i386/translate.c static target_ulong disas_insn(DisasContext *s, CPUState *cpu) · line 7151

Quoted 4 lines
target/i386/translate.c +1 -0
             l1 = gen_new_label();
             l2 = gen_new_label();
             l3 = gen_new_label();
+            gen_update_cc_op(s);

Seems legit:

<snip>

Signature · 1 line
Alex Bennée