capstone icon indicating copy to clipboard operation
capstone copied to clipboard

TMS32c64x gives different assembly text if details are enabled

Open Rot127 opened this issue 9 months ago • 2 comments

Work environment

Questions Answers
System Capstone runs on OS/arch/bits All
Capstone module affected tms32oc64x
Source of Capstone git clone
Version/git commit v5, v6

Instruction bytes giving faulty results

0x02,0x7f,0xff,0xa9 (big endian)

Expected results

It should be either:

mvk.S1 -1, a4 ||

or

mvk -1, a4

But it must be consistent.

Steps to get the wrong result

With cstool:

cstool tms320c64x -d 0x02,0x7f,0xff,0xa9
cstool tms320c64x 0x02,0x7f,0xff,0xa9

Additional Logs, screenshots, source code, configuration dump, ...

The TMS320C64x_post_printer() changes the assembly text if the details are enabled. Which doesn't make sense, because it should also fix up the text if it isn't enabled.

Rot127 avatar Mar 20 '25 10:03 Rot127

cc @trufae To quote:

you can read more about this in the TI doc https://www.ti.com/lit/ug/spru732j/spru732j.pdf

what re those details /without details disasm difference? i mean, the || means the instruction will be executed in parallel with the previous or following instruction.

The p-bit (bit 0) determines whether the instruction executes in parallel with another instruction.

So what ever it does now is not correct. Will look at it after the Alpha4 patch release, since it takes a little more effort to be don properly.

Rot127 avatar Apr 02 '25 11:04 Rot127

Thanks for the effort! I plan to meanwhile integrate the gnu disassembler so it can be used to compare.

trufae avatar Apr 02 '25 11:04 trufae