Inline assembly doesn't like constant 64bit values... Help?
Udi Finkelstein
Linux-IL at udif.com
Fri Feb 4 09:43:49 IST 2011
I'm not an x86-64 expert, but it implies from intel docs that 64 bit
immediate values are supported only for the MOV instruction:
http://www.intel.com/assets/pdf/manual/253666.pdf
-------------------
2.2.1.5 Immediates
In 64-bit mode, the typical size of immediate operands remains 32 bits. When
the
operand size is 64 bits, the processor sign-extends all immediates to 64
bits prior to
their use.
Support for 64-bit immediate operands is accomplished by expanding the
semantics
of the existing move (MOV reg, imm16/32) instructions. These instructions
(opcodes
B8H – BFH) move 16-bits or 32-bits of immediate data (depending on the
effective
operand size) into a GPR. When the effective operand size is 64 bits, these
instructions
can be used to load an immediate into a GPR. A REX prefix is needed to
override
the 32-bit default operand size to a 64-bit operand size.
For example:
48 B8 8877665544332211 MOV RAX,1122334455667788H
-------------------
Udi
On Fri, Feb 4, 2011 at 9:02 AM, Gilboa Davara <gilboad at gmail.com> wrote:
> Hello all,
>
> I'm trying to pass the following command inside GCC inline assembly
> block (which targets x86_64 kernel and usermode).
>
> asm volatile
> {
> ...
> "andq $0x5555555555555555, %%r11 ;"
> ...
> }
>
> And getting the following error:
> 'Error: operand type mismatch for `and''
>
> The 32bit version of this code (which uses $0x55555555 constant value)
> works just fine.
> Shaving ~4 digits off the constant value, seems to working as well.
>
> So, any idea how I can force-feed 64bit hex values into 64bit inline
> assembly?
>
> - Gilboa
>
>
> _______________________________________________
> Linux-il mailing list
> Linux-il at cs.huji.ac.il
> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20110204/daa81a2c/attachment-0001.html>
More information about the Linux-il
mailing list