Re: How to move two valuables to x86 CPU register ebx, ecx by using AT&A inline asm.
From: AmÃrico Wang
Date: Fri Nov 20 2009 - 01:48:46 EST
On Thu, Nov 19, 2009 at 5:50 PM, Johnny Hung <johnny.hacking@xxxxxxxxx> wrote:
> Hi All:
> Â ÂI want to move two local valuables to x86 arch CPU ebx, ecx
> register and do outb cpu instruction by using AT&A inline asm in
> kernel driver. ÂThe following code was I wrote but gcc report syntax
> error:
You must mean AT&T.
> ==
> Â Âunsigned int val = 10;
> Â Âunsigned int tmp = 5;
> Â Â....
> Â Â__asm__ volatile ("movl %0, %%ebx"
You need to put "\n\t" in the end of each asm statement.
> Â Â Â Â Â"movl %1, %%ecx"
> Â Â Â Â Â"outb $0x27, $0xb2"
This is wrong, 'outb' instruction cann't accept both of
its operands as constants, IIRC.
> Â Â Â Â Â:
> Â Â Â Â Â:"r"(val), "r"(tmp)
> Â Â Â Â Â:"%ebx", "%ecx"
> Â );
>
> Does anyone can point me out. Any reply is appreciated.
Regards.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/