inline assembler and Pentium specific instruction(s) 
Author Message
 inline assembler and Pentium specific instruction(s)

ok, I'm sure the answer is obvious but it currently
eludes me. I'm trying to compile the following
fragment of code which uses the Pentium specific
cpuid opcode.

 __asm
 {
  mov eax, 2
  cpuid
 }

I get the compilation error,

C2400: inline assembler syntax error in 'opcode'; found 'newline'

Further investigation of this error, shows that it can be caused
by ( suprise , suprise ) Pentium specific opcodes.

"Specifying a Pentium instruction can cause this error. Choosing the Pentium
option (/G5) causes the compiler to generate instruction sequences optimized
for the Pentium, but does not allow instructions specific to the Pentium. "

.. that last bit seems a bit odd.

Does anyone know how I can specify Pentium ( and other processor
specific opcodes ) in inline assembler without getting this sort of
error.

Thanks ,

Mark/



Sun, 14 Jan 2001 03:00:00 GMT  
 inline assembler and Pentium specific instruction(s)
Maybe you can put the hex value of the opcode inline as a constant byte or
whatever.
Quote:

> ok, I'm sure the answer is obvious but it currently
> eludes me. I'm trying to compile the following
> fragment of code which uses the Pentium specific
> cpuid opcode.

>  __asm
>  {
>   mov eax, 2
>   cpuid
>  }

> I get the compilation error,

> C2400: inline assembler syntax error in 'opcode'; found 'newline'

> Further investigation of this error, shows that it can be caused
> by ( suprise , suprise ) Pentium specific opcodes.

> "Specifying a Pentium instruction can cause this error. Choosing the Pentium
> option (/G5) causes the compiler to generate instruction sequences optimized
> for the Pentium, but does not allow instructions specific to the Pentium. "

> .. that last bit seems a bit odd.

> Does anyone know how I can specify Pentium ( and other processor
> specific opcodes ) in inline assembler without getting this sort of
> error.

> Thanks ,

> Mark/



Sun, 14 Jan 2001 03:00:00 GMT  
 inline assembler and Pentium specific instruction(s)

Quote:

>Maybe you can put the hex value of the opcode inline as a constant byte
or
>whatever.

I suspect you can write raw machine language with the ASM directive
'emit'.

  --  Phlip                  (no replies - address munged)
======= http://users.deltanet.com/~tegan/home.html =======



Sun, 14 Jan 2001 03:00:00 GMT  
 inline assembler and Pentium specific instruction(s)

Thanks , the _emit instruction does the job.

I'm not sure about Microsoft frowning on this sort of thing tho'. Its in
their
documentation ( with any words warning you off using it ) , and I'm sure
they
must use it in their libraries when testing for things like MMX in DirectX.

Mark.



Mon, 22 Jan 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Dose VC++ 5.0 inline assembler support CPUID instruction?

2. Assembler needed for the Pentium processor

3. Assembler needed for the Pentium processor

4. Assembler needed for the Pentium processor

5. Counting the Assembler instructions in a block of C code

6. Pentium RDTSC timer (+GNU inline assembly) CPUID crashes

7. Arguments in included assembler instructions

8. 32-bit assembler instructions in c?

9. Pentium III inline assembly

10. How to compile Arm assembler instruction

11. Inline assembly locks system on INT instruction

12. Inline 8087 Instructions

 

 
Powered by phpBB® Forum Software