Page 1 of 1

problem with assembler source

Posted: Wed Jan 29, 2003 11:40 am
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

Re:problem with assembler source

Posted: Wed Jan 29, 2003 11:42 am
by beyondsociety
Are you sure this is inline asm? Cause it looks like NASM to me.

Re:problem with assembler source

Posted: Wed Jan 29, 2003 11:52 am
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

Re:problem with assembler source

Posted: Wed Jan 29, 2003 12:07 pm
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");