Re: in line assembly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Kevin Ma" <kevin.ma@xxxxxxxxxxxxxxxxx> writes:

> I'm new in using GCC. This is for an embedded system development. When I
> tried to use in line assembly, I found I can't write a relatively large
> block of assembly within C. For example, if I wrote,
> 
> asm(
>   lea        -60(a7), a7                     ;
>   movem.l            d0-d6/a0-a5, (a7)            ;
>   move.l   MACSR, d6                   ;
>   move.l   %0x00, d0                     ;
>   move.l   d0, MACSR                   ;
>   (and a lot of lines ...)
> )
> The compiler would not recognize it. Seems I have to write strictly in the
> syntax as 
> 
> asm ("fsinx %1,%0" : "=f" (result) : "f" (angle));
> 
> which is the only way specified in the GCC manual.
> 
> How can I overcome this problem and write a large chunk of assembly code in
> a C file? Thanks.

1) Use an assembler file instead, or

2) Use strings:
asm(
  "lea        -60(a7), a7                     ;"
  "movem.l            d0-d6/a0-a5, (a7)            ;"
  "move.l   MACSR, d6                   ;"
  "move.l   %0x00, d0                     ;"
  "move.l   d0, MACSR                   ;"
  (and a lot of lines ...)
)

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux