uCodeDisasm icon indicating copy to clipboard operation
uCodeDisasm copied to clipboard

(possible bug) variable str_special_imms is initialized twice in function str_special_imms

Open fishilico opened this issue 4 years ago • 1 comments

Hello, Thanks for sharing this great work!

While reading the code of the disassembler, I stumbled upon these lines in function get_str_uop_xxx_ustate_special_imms: https://github.com/chip-red-pill/uCodeDisasm/blob/a69515f0f3790bc3706f6c051e9b06f6a0635973/glm_ucode_disasm/glm_ucode_disasm.py#L543-L547

The variable str_special_imms is reset after being set to str_special_imms += "0x%08x" % special_imm,. This seems to be either dead code or a bug in the disassembler.

When removing the second str_special_imms = (), the output changes:

--- a/ucode/ucode_glm.txt
+++ b/ucode/ucode_glm.txt
@@ -485,7 +485,7 @@ U013e: 000e0f000200                WRMSLOOPCTRFBR(0x0000000f)
            018000ca                SEQW URET0
 ------------------------------------------------------------------------------------
 
-U0140: 000b01838208                tmp8:= UPDATEUSTATE(!0x04)
+U0140: 000b01838208                tmp8:= UPDATEUSTATE(0x00000001, !0x04)
 U0141: 000cec8fe288    LFNCEMARK-> tmp14:= SAVEUIP(0x01, U43ec)
            04875240                SEQW GOTO U0752
 ------------------------------------------------------------------------------------
@@ -1174,7 +1174,7 @@ U0306: 386a4e400270     SYNCFULL-> BTUJB_DIRECT_NOTTAKEN(tmp0, 0x00000005, uret0
 ------------------------------------------------------------------------------------
 
 U0308: 1c1000e33144                tmp3:= LDZX_DSZN_ASZ32_SC1(DS, r64base, r64idx, IMM_MACRO_ALIAS_DISPLACEMENT, mode=0x18)
-U0309: 000b03838208    LFNCEMARK-> tmp8:= UPDATEUSTATE(!0x0c)
+U0309: 000b03838208    LFNCEMARK-> tmp8:= UPDATEUSTATE(0x00000003, !0x0c)
 U030a: 000cec8fe288                tmp14:= SAVEUIP(0x01, U43ec)
            04859580                SEQW GOTO U0595
 ------------------------------------------------------------------------------------
...

I do not know whether the expected output of the disassembler is the current one or the new one, so I am opening this issue in order to make you aware of a possible bug. Feel free to close this issue if this is not a bug.

fishilico avatar May 18 '21 15:05 fishilico

Usually xxx means that it is not done yet. Just like fixme and todo.

ValZapod avatar Jun 24 '21 23:06 ValZapod