This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Trouble with inline asm on m68k




  Do you need to use %% to get an 'escaped' % in the asm output ?


       DaveK
-- 
Burn your ID card!  http://www.optional-identity.org.uk/
Help support the campaign, copy this into your .sig!


>-----Original Message-----
>From: William A. Gatliff [mailto:bgat@saturn.billgatliff.com]
>Sent: 06 January 2002 03:54
>To: crossgcc@sources.redhat.com
>Subject: Re: Trouble with inline asm on m68k
>
>
>Guys:
>
>
>I've come up with a workaround:
>
>  int _len asm("%d1");
>
>This puts _len into %d1.  By assigning whatever it is I'm trying to
>get into %d1 to _len, I get the result I'm looking for.
>
>This accomplishes the goal, but forces me to allocate locals to get
>there.  For my immediate problem this is ok, but long-term I would
>like to understand what I'm doing wrong in the code below.
>
>
>Suggestions welcome,
>
>b.g.
>  
>
>On Sat, Jan 05, 2002 at 09:37:57PM -0600, William A. Gatliff wrote:
>> Guys:
>> 
>> 
>> Maybe it's just too late in the evening, maybe I'm just not reading
>> the info pages closely enough...
>> 
>> I'm trying to do this on a CPU32, m68k-elf-gcc (2.95.3):
>> 
>> ***
>> int len;
>> ...
>> __asm__ __volatile__ ("move.l %0, %d1" : : "r" (len) : "%d1");
>> 
>> [bgat@mars] m68k-elf-gcc -c -mcpu32 test.c
>> test.c:41: invalid 'asm': operand number out of range
>> ***
>> 
>> Seems like gcc is getting tripped up on the %d1 in the opcode,
>> thinking it is an operand number instead of a register name.  Turning
>> the "%d1" into just "d1" makes gcc happy, but causes an unresolved
>> reference to "d1" at link time.  The assembler doesn't know it is a
>> register (which makes sense).
>> 
>> I'm binding to an asm API, so I have to call out the register name.
>> 
>> I can't be the first person to have this problem.  What's 
>the solution?
>> 
>> Or better yet, what section of the infopages do I need to re-read?
>> 
>> 
>> Thanks!
>> 
>> 
>> b.g.
>> -- 
>> Bill Gatliff
>> bgat@billgatliff.com
>> 
>> ------
>> Want more information?  See the CrossGCC FAQ, 
>http://www.objsw.com/CrossGCC/
>> Want to unsubscribe? Send a 
>note to crossgcc-unsubscribe@sources.redhat.com
>> 
>
>-- 
>Bill Gatliff
>bgat@billgatliff.com
>
>------
>Want more information?  See the CrossGCC FAQ, 
>http://www.objsw.com/CrossGCC/
>Want to unsubscribe? Send a 
>note to crossgcc-unsubscribe@sources.redhat.com
>


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]