Skip to content

Zentool disassembly shows incorrect register output. #189

@jschoen483

Description

@jschoen483

zen_reg_to_string(op.reg2),

    // Now decode the remainder as necessary.
    putstr("\t%-*s\t%s, %s, ",
            kMnemonicWidth,
            mnemonic,
            zen_reg_to_string(op.reg2),
            zen_reg_to_string(op.reg1));

@sirdarckcat
In dump_reg_op if both op.reg1 and op.reg2 are a differentreg[0-x] constants, i.e. "reg2" "reg4", the printed register is wrong because zen_reg_to_string uses the same static char[] buffer to create a formatted return string at runtime. The function zen_reg_to_string, is called twice before the return value is used in the putstr

Suggesting a change to split it into two separate separate putstr(...,zen_reg_to_string(...)) calls.

    // Now decode the remainder as necessary.seq
    putstr("\t%-*s\t%s, ",
            kMnemonicWidth,
            mnemonic,
            zen_reg_to_string(op.reg2));
    putstr("%s, ", zen_reg_to_string(op.reg1));

This also changes the expected output for /test/mcop.sh in the mcop 382E9C1110E00000 case from
adc reg2, reg2, reg7
to
adc reg2, reg4, reg7

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions