I’m trying to translate the following from AT&T assembly to Intel assembly:
pushl 2000
Now this compiles down to:
ff 35 d0 07 00 00 pushl 0x7d0
But no matter what I try, I cannot get the same in Intel synax, I’ve tried:
intel asm
disassembly after compiling to at&t
push 2000
68 d0 07 00 00 push $0x7d0
push [2000]
68 d0 07 00 00 push $0x7d0
push dword ptr [2000]
68 d0 07 00 00 push $0x7d0
push dword ptr 2000
68 d0 07 00 00 push $0x7d0
So I’m out of clues, what is the equivalent of “pushl 2000”?
I think the original code isn’t doing what you think it’s doing. According to msdev the disassembly is:
Which is equal to pushing:
NOT pushing the value 2000 onto the stack. However – if that’s really what you want then the instruction is:
ds:is an indication to use thedssegment register. The segment registers are a hold-over from nasty 16-bit days. The major ones arecs– code segment,ds– data segment andss– stack segment (andfswhich is where thread locals are stored). Think of them as base offsets into memory. By default data accesses are off thedssegment.My guess as to why
push dword ptr [2000]didn’t work is that the compiler realized that that was a silly thing for you to use and ‘fixed it’. By forcing use of thedsprefix you indicate that you really mean to do a memory access there.