[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: [LI] inline assembly in C



On Wed, 22 Sep 1999, Mani Murugesan wrote:

> Does C under linux (gcc) support inline assembly routines? 

Yes, it does

> Also is there good documentation for calling routines completely
> written in assembly? 

There are no deep issues related to *calling* assembly routines. "as" will
happily believe all undeclared symbols to be global and "ld" will happily
try to link them in to extern symbols in your C code.  Maintaining stack
integrity is your responsibility though. There are some issues with
*writing* pure assembly routines. A good way to test is to write your
routine in C and then use gcc -S to check out what is expected.

On the other hand, writing inline assembly is a lot lot safer, and as long
as you want 32 bit code, there is nothing that you cant do with inline.

> I tried the man and info pages, but found it difficult to find exactly
> what I wanted.

Try "info gas" and look for i386 architecture specific details. Also look
at "info gcc" in the section on C extensions.

I hope this helps.


- --------------------------------------------------------------------
For more information on Linux in India visit http://www.linux-india.org/
The Linux India mailing list does not accept postings in HTML format.

------------------------------