Qijia Liu : winedbg: Distinguish -0 from 0.

Alexandre Julliard julliard at winehq.org
Mon Jan 4 15:37:51 CST 2021


Module: wine
Branch: master
Commit: 0201aa3b60c0a7f9d67e2d5fbee41a6f59fcaf22
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=0201aa3b60c0a7f9d67e2d5fbee41a6f59fcaf22

Author: Qijia Liu <liumeo at pku.edu.cn>
Date:   Wed Dec 30 22:28:20 2020 +0000

winedbg: Distinguish -0 from 0.

According to A8.8.56, A8.8.64 and A8.8.81 of ARM DDI 0406C.d,
0 and -0 generate different instructions.
Manually add "-".

Signed-off-by: Qijia Liu <liumeo at pku.edu.cn>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 programs/winedbg/be_arm.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/programs/winedbg/be_arm.c b/programs/winedbg/be_arm.c
index be4b310032c..b09bc5319b7 100644
--- a/programs/winedbg/be_arm.c
+++ b/programs/winedbg/be_arm.c
@@ -192,22 +192,20 @@ static UINT arm_disasm_halfwordtrans(UINT inst, ADDRESS64 *addr)
     short indexing  = (inst >> 24) & 0x01;
     short offset    = ((inst >> 4) & 0xf0) + (inst & 0x0f);
 
-    if (!direction) offset *= -1;
-
     dbg_printf("\n\t%s%s%s%s%s", load ? "ldr" : "str", sign ? "s" : "",
                halfword ? "h" : (sign ? "b" : ""), writeback ? "t" : "", get_cond(inst));
     dbg_printf("\t%s, ", tbl_regs[get_nibble(inst, 3)]);
     if (indexing)
     {
         if (immediate)
-            dbg_printf("[%s, #%d]", tbl_regs[get_nibble(inst, 4)], offset);
+            dbg_printf("[%s, #%s%d]", tbl_regs[get_nibble(inst, 4)], direction ? "" : "-", offset);
         else
             dbg_printf("[%s, %s]", tbl_regs[get_nibble(inst, 4)], tbl_regs[get_nibble(inst, 0)]);
     }
     else
     {
         if (immediate)
-            dbg_printf("[%s], #%d", tbl_regs[get_nibble(inst, 4)], offset);
+            dbg_printf("[%s], #%s%d", tbl_regs[get_nibble(inst, 4)], direction ? "" : "-", offset);
         else
             dbg_printf("[%s], %s", tbl_regs[get_nibble(inst, 4)], tbl_regs[get_nibble(inst, 0)]);
     }
@@ -310,15 +308,13 @@ static UINT arm_disasm_singletrans(UINT inst, ADDRESS64 *addr)
     short immediate = !((inst >> 25) & 0x01);
     short offset    = inst & 0x0fff;
 
-    if (!direction) offset *= -1;
-
     dbg_printf("\n\t%s%s%s%s", load ? "ldr" : "str", byte ? "b" : "", writeback ? "t" : "",
                get_cond(inst));
     dbg_printf("\t%s, ", tbl_regs[get_nibble(inst, 3)]);
     if (indexing)
     {
         if (immediate)
-            dbg_printf("[%s, #%d]", tbl_regs[get_nibble(inst, 4)], offset);
+            dbg_printf("[%s, #%s%d]", tbl_regs[get_nibble(inst, 4)], direction ? "" : "-", offset);
         else if (((inst >> 4) & 0xff) == 0x00) /* no shift */
             dbg_printf("[%s, %s]", tbl_regs[get_nibble(inst, 4)], tbl_regs[get_nibble(inst, 0)]);
         else if (((inst >> 4) & 0x01) == 0x00) /* immediate shift (there's no register shift) */
@@ -330,7 +326,7 @@ static UINT arm_disasm_singletrans(UINT inst, ADDRESS64 *addr)
     else
     {
         if (immediate)
-            dbg_printf("[%s], #%d", tbl_regs[get_nibble(inst, 4)], offset);
+            dbg_printf("[%s], #%s%d", tbl_regs[get_nibble(inst, 4)], direction ? "" : "-", offset);
         else if (((inst >> 4) & 0xff) == 0x00) /* no shift */
             dbg_printf("[%s], %s", tbl_regs[get_nibble(inst, 4)], tbl_regs[get_nibble(inst, 0)]);
         else if (((inst >> 4) & 0x01) == 0x00) /* immediate shift (there's no register shift) */
@@ -414,13 +410,11 @@ static UINT arm_disasm_coprocdatatrans(UINT inst, ADDRESS64 *addr)
     WORD indexing  = (inst >> 24) & 0x01;
     short offset    = (inst & 0xff) << 2;
 
-    if (!direction) offset *= -1;
-
     dbg_printf("\n\t%s%s%s", load ? "ldc" : "stc", translen ? "l" : "", get_cond(inst));
     if (indexing)
-        dbg_printf("\t%u, cr%u, [%s, #%d]%s", CPnum, CRd, tbl_regs[get_nibble(inst, 4)], offset, writeback?"!":"");
+        dbg_printf("\t%u, cr%u, [%s, #%s%d]%s", CPnum, CRd, tbl_regs[get_nibble(inst, 4)], direction ? "" : "-", offset, writeback?"!":"");
     else
-        dbg_printf("\t%u, cr%u, [%s], #%d", CPnum, CRd, tbl_regs[get_nibble(inst, 4)], offset);
+        dbg_printf("\t%u, cr%u, [%s], #%s%d", CPnum, CRd, tbl_regs[get_nibble(inst, 4)], direction ? "" : "-", offset);
     return 0;
 }
 




More information about the wine-cvs mailing list