How to move two valuables to x86 CPU register ebx, ecx by using ATA inline asm.

2009-11-19 Thread Johnny Hung
Hi All: I want to move two local valuables to x86 arch CPU ebx, ecx register and do outb cpu instruction by using ATA inline asm in kernel driver. The following code was I wrote but gcc report syntax error: == unsigned int val = 10; unsigned int tmp = 5; __asm__ volatile

Re: How to move two valuables to x86 CPU register ebx, ecx by using ATA inline asm.

2009-11-19 Thread Viral Mehta
How about putting \n at the end ? Just try out, __asm__ volatile (movl %0, %%ebx\n movl %1, %%ecx\n Thanks, Viral Mehta, Embedded Software Engineer, Tel. No. 91 79 26563705, Ext. 423 www.einfochips.com http://www.einfochips.com Prepare and Prevent rather than Repair and Repent

Re: How to move two valuables to x86 CPU register ebx, ecx by using ATA inline asm.

2009-11-19 Thread Johnny Hung
It doesn't works. :( 2009/11/19 Viral Mehta viral.me...@einfochips.com: How about putting \n at the end ? Just try out, __asm__ volatile (movl %0, %%ebx\n         movl %1, %%ecx\n Thanks, Viral Mehta, Embedded Software Engineer, Tel. No. 91 79 26563705, Ext. 423 www.einfochips.com

Re: How to move two valuables to x86 CPU register ebx, ecx by using ATA inline asm.

2009-11-19 Thread Viral Mehta
[r...@viral temp_c_files]# gcc foo.c [r...@viral temp_c_files]# cat foo.c #include stdio.h int main() { unsigned int val = 10; unsigned int tmp = 5; __asm__ volatile (movl (%0), %%ebx\n movl (%1), %%ecx\n : : r(val), r(tmp) ); } [r...@viral temp_c_files]#

Re: How to move two valuables to x86 CPU register ebx, ecx by using ATA inline asm.

2009-11-19 Thread stas
It seems to me that this example code is not free of errors. After the third : we should list registers ebx and ecx to let gcc know they could change in asm section. There can be no difference in -O0 but may have large impact on result in -O{2,3} modes. Actually resulting code may not include push

Re: How to move two valuables to x86 CPU register ebx, ecx by using ATA inline asm.

2009-11-19 Thread Américo Wang
On Thu, Nov 19, 2009 at 5:50 PM, Johnny Hung johnny.hack...@gmail.com wrote: Hi All:    I want to move two local valuables to x86 arch CPU ebx, ecx register and do outb cpu instruction by using ATA inline asm in kernel driver.  The following code was I wrote but gcc report syntax error: You