hi,
i want to use inline assembly (with INTEL syntax) in my C Kernel code.
can i code like this in one of my C functions :
void CheckProcessor(void)
{
asm
{
mov eax,0x00;
cpuid;
.........
}
}
i give following compile options :
gcc -o KLoader.o -c KLoader.c -Wall -Werror -W --no-warn -nostdlib -nostartfiles -nodefaultlibs -masm=intel
given above options gcc doesn't compile source code. i think it has some problem with 'asm' keyword?
any solution would be highly appreciated!
intel inline assembly with gcc
intel inline assembly with gcc
Nothings Impossible
Re: intel inline assembly with gcc
That's not the right syntax for GCC inline assembler. Inline assembly is a non-standard extension to any compiler. Regardless of the assembler syntax itself, GCC's extended asm syntax is more like the following.kan wrote:Code: Select all
void CheckProcessor(void) { asm { mov eax,0x00; cpuid; ......... } }
Code: Select all
void CheckProcessor(void)
{
asm("mov eax,0x00\n\tcpuid"
: /* output constraints */
: /* input constraints */
: /* clobbers */);
.......
}
--
smw