-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disassemble mips privileged instruction code bug #17372
Comments
It might be a bug in capstone - could you please check with |
You can try with the gnu disassembler which is taken from the loongson branch |
e asm.arch=mips.gnu |
It seems to get worse with gnu disassembler [0xffffffff80affa10]> e asm.arch=mips.gnu [0xffffffff80affa10]> e asm.arch=mips |
Thank you @junchao-loongson ! Please paste a link to the issue you are going to create in capstone here as well, just for reference. |
I created this issue in capstone since found none reported yet: capstone-engine/capstone#1673 |
bug
I used radare2 to analyze a mips kernel
$ radare2 vmlinux
[0xffffffff80affa10]> pd 2
;-- entry0:
;-- kernel_entry:
;-- pc:
0xffffffff80affa10 03800c40 mfc0 t4, s0, 3
0xffffffff80affa14 80008c35 ori t4, t4, 0x80
In the disassemble result of the first instruction,mfc0 t4, s0, 3 ,s0 is a general register, but mfc0 is a privileged instruction.
For privileged instructions (mfc0 mtc0), the name should be indexed in Coprocessor 0 registers , not in general registers.
Expected behavior
[0xffffffff80affa10]> pd 2
;-- entry0:
;-- kernel_entry:
;-- pc:
0xffffffff80affa10 03800c40 mfc0 t4, config, 3
0xffffffff80affa14 80008c35 ori t4, t4, 0x80
or
[0xffffffff80affa10]> pd 2
;-- entry0:
;-- kernel_entry:
;-- pc:
0xffffffff80affa10 03800c40 mfc0 t4, $16, 3
0xffffffff80affa14 80008c35 ori t4, t4, 0x80
I'm try to fix this bug with minimal bad influence, but the trouble is that not only the radare2 code but also the capstone module code needs to be modified.
Work environment
ps:
I have a Loongson machine based on mips arch, and I want to add support for this machine in the future.
The text was updated successfully, but these errors were encountered: