Does anyone can point me out. Any reply is appreciated.
BRs, H. Johnny
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
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
Johnny Hung 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:
> ==
> unsigned int val = 10;
> unsigned int tmp = 5;
> ....
> __asm__ volatile ("movl %0, %%ebx"
> "movl %1, %%ecx"
> "outb $0x27, $0xb2"
> :
> :"r"(val), "r"(tmp)
> :"%ebx", "%ecx"
> );
>
> Does anyone can point me out. Any reply is appreciated.
>
> BRs, H. Johnny
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to eca...@nl.linux.org
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>
>
> Email Scanned for Virus & Dangerous Content by : www.CleanMailGateway.com
>
>
>
--
_____________________________________________________________________
Disclaimer: This e-mail message and all attachments transmitted with it
are intended solely for the use of the addressee and may contain legally
privileged and confidential information. If the reader of this message
is not the intended recipient, or an employee or agent responsible for
delivering this message to the intended recipient, you are hereby
notified that any dissemination, distribution, copying, or other use of
this message or its attachments is strictly prohibited. If you have
received this message in error, please notify the sender immediately by
replying to this message and please delete it from your computer. Any
views expressed in this message are those of the individual sender
unless otherwise stated.Company has taken enough precautions to prevent
the spread of viruses. However the company accepts no liability for any
damage caused by any virus transmitted by this email.
_____________________________________________________________________
2009/11/19 Viral Mehta <viral...@einfochips.com>:
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.
Why not just:
("outb $0x27, %%al" : : "a" (0xb2), "b"(val), "c" (tmp));
--
js
Faculty of Informatics, Masaryk University
Suse Labs, Novell
# gcc inlineasm.c
inlineasm.c: Assembler messages:
inlineasm.c:7: Error: suffix or operands invalid for `out'
[root@debian-johnny] ~/workspace/test
# cat inlineasm.c
#include <stdio.h>
int main ()
{
unsigned int val = 5, tmp = 10;
asm volatile ("outb $0x27, %%al"
:
: "a" (0xb2), "b"(val), "c" (tmp)
);
}
It seems the source of outb instruction cannot be a constant. Is
there a AT&T instructions document for x86?
BRs, H. Johnny
In AT&T syntax, the source register comes first. So it should be
"outb %%al, $0x27", assuming that 0x27 is the port number you are
trying to write to.
--
Brian Gerst