retf / retq in 64 bit mode

Peter Johnson peter at tortall.net
Wed Mar 1 18:57:31 PST 2006


On Wed, 1 Mar 2006 SMarF at gmx.de wrote:

> fortunately not many peoplpe will use far-ret in 64-bit mode, but I tried
> and failed. The mnemonic
>  retq
> produces no opcode, and retf results in
>  0xCB
> missing the prefix 0x48 to code
>  0x48 0xCB
> which is produced for example by fasm. I've tested some hours with qEmu and
> a real AMD64, the difference is the location of CS and the amount of "pop"ed
> values. Fasm also produces 0xC3 instead of 0xCB, but I don't know which one
> is correct.

Stefan,

Fixed in r1393.  "retq" is not an opcode in NASM syntax, and thus simply 
makes a label.  To warn about this happening, you may want to turn on 
-Worphan-labels.

0xCB is the correct opcode for RETF; 0xC3 is a RET or RETN (near) 
instruction.  Yasm now correctly generates the 0x48 prefix in 64-bit mode 
for RETF.

Thanks for the bug report!

-- 
Peter


More information about the yasm-devel mailing list