* M68k Inline Assmbly with C Style Operands
@ 2000-10-28 12:07 Alex Holland
2000-10-28 12:17 ` Doug Evans
0 siblings, 1 reply; 2+ messages in thread
From: Alex Holland @ 2000-10-28 12:07 UTC (permalink / raw)
To: crossgcc
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 672 bytes --]
Hi,
Â
Using gcc-2.95.2 cross development
tools  for a m68k-elf target under Cygwin, I am having problems
getting inline assembly with C operands to compile/assemble/link:
Â
// Example 1: No C style operands  works
fine.
asm("move 0x2700, %sr");Â
Â
// Example 2: The % in %sr made the compiler look for
another operand.
#define MY_MACRO 0x2700
Â
asm("move %0, %sr;"    :
   : "i"(MY_MACRO) );
Â
//Â Example 3: Would not link because sr is
undefined.
asm("move %0, sr;"    :
   : "i"(MY_MACRO) );
Any suggestions for making Example 2 or Example 3
work?
Â
Thanks, Alex
^ permalink raw reply [flat|nested] 2+ messages in thread
* M68k Inline Assmbly with C Style Operands
2000-10-28 12:07 M68k Inline Assmbly with C Style Operands Alex Holland
@ 2000-10-28 12:17 ` Doug Evans
0 siblings, 0 replies; 2+ messages in thread
From: Doug Evans @ 2000-10-28 12:17 UTC (permalink / raw)
To: Alex Holland; +Cc: crossgcc
Alex Holland writes:
> // Example 1: No C style operands works fine.
> asm("move 0x2700, %sr");
Without arguments, gcc passes the string through to the assembler
unchanged. This is a DIFFERENT kind of asm than an asm with colon
separated arguments. For example, such an asm is always marked as
"volatile" (IIRC!), and it can be used outside functions.
> // Example 2: The % in %sr made the compiler look for another operand.
> #define MY_MACRO 0x2700
>
> asm("move %0, %sr;"
> :
> : "i"(MY_MACRO)
> );
s/%sr/%%sr/
> // Example 3: Would not link because sr is undefined.
> asm("move %0, sr;"
> :
> : "i"(MY_MACRO)
> );
I'm guessing %%sr is what you want.
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-10-28 12:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-28 12:07 M68k Inline Assmbly with C Style Operands Alex Holland
2000-10-28 12:17 ` Doug Evans
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 read-only IMAP folder(s) and NNTP newsgroup(s).