Re: jmp in asm

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

 



ranjith kumar writes:

 >     Assembly code can be included in a C program by
 > "asm" feature.
 > 
 > My question is to how to include assembly instructions
 >  like jmp ,jc ,loop....which require an address(indeed
 > a label) as an argument.

You can't jump out of (or into) an inline asm.  You put labels into
inline asms in the same way as usual asms, by prefixing assembler
statements.  There's even an example in the gcc manual:

-----------------------
 If you want to test the condition code produced by an assembler
instruction, you must include a branch and a label in the `asm'
construct, as follows:

     asm ("clr %0\n\tfrob %1\n\tbeq 0f\n\tmov #1,%0\n0:"
          : "g" (result)
          : "g" (input));
-----------------------

Andrew.

[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