Skip to content

x86 mov instruction immediate stripped of hex prefix #160

@1superchip

Description

@1superchip

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions