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

x/arch/x86/x86asm: Mem.Disp is positive for negative displacements #8000

Open
josharian opened this issue May 15, 2014 · 4 comments
Open

x/arch/x86/x86asm: Mem.Disp is positive for negative displacements #8000

josharian opened this issue May 15, 2014 · 4 comments
Milestone

Comments

@josharian
Copy link
Contributor

The instruction 48 8b 0c 25 c0 5c 07 80 is disassembled as MOVQ 0x80075cc0, CX. It
should be disassembled as MOVQ 0xffffffff80075cc0, CX. Addresses are signed, and should
be sign-extended. See the discussion in issue #7980 for details.

To reproduce, run 'go tool objdump addr31 0x2000 0x2012'. addr31 is attached. It was
created by stripping a binary built from the code in issue #7980.

Attachments:

  1. addr31.gz (153196 bytes)
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@minux minux changed the title cmd/objdump: incorrect disassembly of MOV instruction with address > 2^31-1 x/arch/x86/x86asm: Mem.Disp is positive for negative displacements Jan 15, 2017
@josharian
Copy link
Contributor Author

(Migrating comment from #18666)

I worked on a CL for this ages ago: https://codereview.appspot.com/100480046/. It may serve as a useful starting point for anyone fixing this.

@minux
Copy link
Member

minux commented Jan 16, 2017 via email

@josharian
Copy link
Contributor Author

My understanding is far more limited than yours. But I think you are correct.

@josharian
Copy link
Contributor Author

...that is, that the changes in those cases should be reverted.

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

3 participants