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
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
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
[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]#
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
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