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

x86 mov instruction immediate stripped of hex prefix #160

Open
1superchip opened this issue May 24, 2024 · 0 comments
Open

x86 mov instruction immediate stripped of hex prefix #160

1superchip opened this issue May 24, 2024 · 0 comments

Comments

@1superchip
Copy link
Contributor

Hex immediates in the mov instruction can be stripped of the hex prefix 0x causing an error with finding the address immediate in process_reloc.

mov is included in instructions_with_address_immediates for I686.

Code that removes the hex prefix:

        addr = ""
        if mnemonic in arch.instructions_with_address_immediates:
            row, addr = split_off_address(row)
            # objdump prefixes addresses with 0x/-0x if they don't resolve to some
            # symbol + offset. Strip that.
            addr = addr.replace("0x", "")

decomp.me scratch:
https://decomp.me/scratch/dA1P1

Relevant line of code:
g_EnemyManagerDrawChain.arg = mgr;

objdump output:

  9a:   mov    %edx,0x1c
                        9c: dir32       ?g_EnemyManagerDrawChain@@3VChainElem@@A-0xee5ec

0x1c is an offset which the relocation should be applied to: mov %edx,?g_EnemyManagerDrawChain@@3VChainElem@@A-0xee5ec+0x1c

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

No branches or pull requests

1 participant