Skip to content
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

Constants appear in disassembly as unknown opcodes #145

Open
danielpieczko opened this issue Jul 19, 2023 · 0 comments
Open

Constants appear in disassembly as unknown opcodes #145

danielpieczko opened this issue Jul 19, 2023 · 0 comments

Comments

@danielpieczko
Copy link
Contributor

I built and disassembled the FFD xcore-voice application and found this:

<xscope_xlink_start_token_ret>:
             0x00093f12: c0 77:       retsp (u6)      0x0
             0x00093f14: 00 00:       stw (2rus)      r0, r0[0x0]
             0x00093f16: 00 00:       stw (2rus)      r0, r0[0x0]
             0x00093f18: 00 00:       stw (2rus)      r0, r0[0x0]
             0x00093f1a: 00 00:       stw (2rus)      r0, r0[0x0]
             0x00093f1c: 00 00:       stw (2rus)      r0, r0[0x0]
             0x00093f1e: 00 00:       stw (2rus)      r0, r0[0x0]
             0x00093f20: 00 00:       stw (2rus)      r0, r0[0x0]
             0x00093f22: 80 ff:       ...
             0x00093f24: 00 00:       stw (2rus)      r0, r0[0x0]
             0x00093f26: 80 ff:       ...
             0x00093f28: 00 00:       stw (2rus)      r0, r0[0x0]
             0x00093f2a: 80 ff:       ...
             0x00093f2c: 00 00:       stw (2rus)      r0, r0[0x0]
             0x00093f2e: 80 ff:       ...

Note the 80 ff opcodes that can't be decoded into a valid instruction. It continues beyond this address with other values, some of which are valid instructions and others that aren't.

xscope_xlink_start_token_ret returns immediately and it turns out that the data which follows is unrelated to libxscope.a (which contains the xscope_xlink_start_token_ret symbol). Instead, this data is this set of constants.

They are in the .text section so they appear in the disassembly, so perhaps they should be in a data section instead. Using .text might be intentional for some reason (eg. to be able to dual-issue this code efficiently), so this change might not be possible without harming the performance.

This issue is purely cosmetic in that the code appears to work correctly, it just displays invalid instructions in the disassembly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants