From: Viral Mehta <viral.mehta@einfochips.com>
To: Johnny Hung <johnny.hacking@gmail.com>
Cc: kernelnewbies@nl.linux.org, linux-embedded@vger.kernel.org
Subject: Re: How to move two valuables to x86 CPU register ebx, ecx by using AT&A inline asm.
Date: Thu, 19 Nov 2009 15:51:52 +0530 [thread overview]
Message-ID: <4B051C40.5040003@einfochips.com> (raw)
In-Reply-To: <cb9ecdfa0911190219r11fa165v331a590889edcfd0@mail.gmail.com>
[root@viral temp_c_files]# gcc foo.c
[root@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) );
}
[root@viral temp_c_files]#
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:
> It doesn't works. :(
>
> 2009/11/19 Viral Mehta <viral.mehta@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 <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 ecartis@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.
>> _____________________________________________________________________
>>
>>
>>
>
>
> 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.
_____________________________________________________________________
next prev parent reply other threads:[~2009-11-19 10:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-19 9:50 How to move two valuables to x86 CPU register ebx, ecx by using AT&A inline asm Johnny Hung
2009-11-19 10:05 ` Viral Mehta
2009-11-19 10:19 ` Johnny Hung
2009-11-19 10:21 ` Viral Mehta [this message]
2009-11-19 11:11 ` Johnny Hung
2009-11-20 6:04 ` stas
2009-11-20 10:43 ` David Woodhouse
2009-11-20 6:48 ` Américo Wang
2009-11-20 8:45 ` Jiri Slaby
2009-11-23 3:14 ` Johnny Hung
2009-11-23 5:43 ` Brian Gerst
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B051C40.5040003@einfochips.com \
--to=viral.mehta@einfochips.com \
--cc=johnny.hacking@gmail.com \
--cc=kernelnewbies@nl.linux.org \
--cc=linux-embedded@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).