jmp in asm
Andrew Haley
aph@redhat.com
Sun Nov 5 15:52:00 GMT 2006
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.
More information about the Gcc-help
mailing list