Prev: HLA Floating Point opcodes
Next: Pushad with GAS?
From: wolfgang kern on 22 Dec 2009 10:25 Bernd Gerber wrote: > I am learning assembler programming on 64-bit Linux. > The instruction "push edx" ends up with the error "instruction not > supported in 64-bit mode", the instrucion "push rdx" works fine. > What do I have to do to push edx? While in 64-bit- aka Long-mode all push/pop work only with 64 bits, so your tools error message stand correct. A 16-bit version of push/pop (with 66h override) is available in LM, but not any 32-bit variant. what's wrong on push rdx instead of push edx ? data-contenation of two 32 bit values can be done with ie: ROR/ROL/shift|AND-OR/etc.. __ wolfgang
From: Rod Pemberton on 23 Dec 2009 04:46
"Alexei A. Frounze" <alexfrunews(a)gmail.com> wrote in message news:b962c0b5-200c-42b1-bdaa-f0931d1f0ecf(a)u36g2000prn.googlegroups.com... > On Dec 21, 11:53 pm, "Rod Pemberton" <do_not_h...(a)nohavenot.cmm> > wrote: > > There is no way to encode a "push edx" as a single instruction in 64-bit > > mode. The stack size is 64-bits in 64-bit mode. What this means is that > > the stack pointer is adjusted by 8 bytes. IMO, it should also push 8 bytes > > onto the stack. That may or may not be the case, depending on the cpu, for > > values less than 64-bits. > > > > If pushing a value smaller than 64-bits where there is a valid instruction > > encoding for it, e.g., for 16-bits (2 bytes), the push should push 8 bytes > > after sign- or zero-extending the 16-bits to 64-bits. > Ok, 16-bit was a poor choice for example... > Pushing 16-bit values in 64-bit mode adjusts RSP by 2. No extension is > done. Are you talking about "PUSH r/m16", or 16-bit (0x66) "PUSH FS", or "PUSH imm16"? All are 16-bit values... But, if I'm reading the manuals correctly, two of the three do not adjust RSP by 2, but by 8. One is sign-extended and the other is zero-extended. Rod Pemberton |