problem with assembler source

Programming, for all ages and all languages.
Post Reply
Matze2003

problem with assembler source

Post by Matze2003 »

hi @ all,
i try to compile this source code under suse linux with gcc, but there are errors, here the source:

asm(" mov eax, 0");
asm(" CPUID");
asm(" mov [REGEBX], ebx");
asm(" mov [REGECX], ecx");
asm(" mov [REGEDX], edx");

this source is inline asm...
here the errors:

Error: too many memory references for mov
Error: invalid char '[' beginning operand 1 [REGEBX]
and so on....

i think the syntax is not correct, can you help me ???

thanks, by. matze
beyondsociety

Re:problem with assembler source

Post by beyondsociety »

Are you sure this is inline asm? Cause it looks like NASM to me.
Matze2003

Re:problem with assembler source

Post by Matze2003 »

hi, oh sorry, i mean the source is in nasm, i need it for gcc. now, when i want to compile it with gcc, there are errors.

thanks, by.matze
jrfritz

Re:problem with assembler source

Post by jrfritz »

GCC uses the AT&T syntax...you can find links on google on how to use that assembler syntax...or to get partial NASM syntax use this macro I made:

#define inasm(s) asm(".intel_syntax no_prefix"); asm(s); asm(".att_syntax prefix");
Post Reply