radareorg / radare2

UNIX-like reverse engineering framework and command-line toolset
https://www.radare.org/
GNU Lesser General Public License v3.0
20.01k stars 2.96k forks source link

disassembly for mips mtc/mfc: incorrect coprocessor registry #19528

Open cavedon opened 2 years ago

cavedon commented 2 years ago

Environment

Radare 5.5.4 (or today's master, 0c6d40c) on Ubuntu focal 64 bit

Description

The disassembly in mfc/mtc instructions allows to read and write coprocessor registers. For example

00608340 mtc0 v1, $12

Writes v1 to the coprocessor 0 register 12. The disassembly when using -e mips.gnu is correct, as shown above. When using -e mips, the disassembly references the GPR number 12 (i.e. t4):

00608340  mtc0 v1, t4, 0

Test

Correct:

% rasm2 -a mips -D 00608340
0x00000000   4                 00608340  mtc0 v1, t4, 0

Incorrect:

% rasm2 -a mips.gnu -D 00608340
0x00000000   4                 00608340  mtc0 v1, $12
cavedon commented 2 years ago

Actually this is a duplicate of #17372. The bug is actually in the capstone project https://github.com/capstone-engine/capstone/issues/1673. It may be worthwhile keeping the bug open in radare2 as well until the upstream bug is resolved, as it manifests as bug in radare2 as well.

radare commented 2 years ago

Thanks

On 23 Dec 2021, at 18:37, Ludovico Cavedon @.***> wrote:

 Actually this is a duplicate of #17372. The bug is actually in the capstone project capstone-engine/capstone#1673. It may be worthwhile keeping the bug open in radare2 as well until the upstream bug is resolved, as it manifests as bug in radare2 as well.

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you are subscribed to this thread.