-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
M16C INDEXBD instruction does not affect succeeding MOV instruction #7504
Comments
Adding further information that may be more relevant.
We can see the instruction matches to pattern But in M16C/80 slaspec file we have
Interestingly the INDEXBD documentation says that only MOV.B:G format can be used but we can see that the compiler has emitted a short format in the form of MOV.B:S.
So I am now questioning if the compiler that emitted this code was wrong. |
I definitely think the compiler is in the wrong here. I double-checked the disassembly of the MOV.B:S instruction and it's correct. There shouldn't be a byteoffset added here. |
If behaviour still works as expected, should Ghidra emulate this behaviour regardless of what the specs say? I do not currently posses the hardware to test if the actual CPU modifies the memory offset. But the code I have did run on actual hardware at some point. I will have to investigate. The bug report should be re-classified as something else as to not confuse others. |
Yes, if the behavior works as expected, then Ghidra should emulate it correctly. |
We can see INDEXBD setting the 0x3009 register to the appropriate value, however the next instruction which is a MOV never adds this register.
The appropriate execution must be MOV.B:S R0L, (DAT_000414 + byteIndexOffset) but here we see it is never added via a INT_ADD pcode and I propose this is an actual bug.
In C pseudo code the pcode must do the following:
*(DAT_000414 + byteIndexOffset) = R0L;
If required this bug report may be merged with my other one that was made into a discussion.
The text was updated successfully, but these errors were encountered: