Inline assembly

Can i use MOV instruction to access CR4 register from kernel mode?

_asm
{
MOV EAX, CR4
}

I am getting this error " error C2094: label ‘CR4’ was undefined"

I am able to access CR0 and CR3 reg using MOV instruction. Do i need to
change anything in the building environment to make this inline assembly
code compilable?

Thanks and Regards,
Anoop


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Can’t you just inline a db with the instruction’s machine code ?

Alberto.

-----Original Message-----
From: ANOOP.G [mailto:xxxxx@nestec.net]
Sent: Monday, June 25, 2001 7:51 AM
To: NT Developers Interest List
Subject: [ntdev] Inline assembly

Can i use MOV instruction to access CR4 register from kernel mode?

_asm
{
MOV EAX, CR4
}

I am getting this error " error C2094: label ‘CR4’ was undefined"

I am able to access CR0 and CR3 reg using MOV instruction. Do i need to
change anything in the building environment to make this inline assembly
code compilable?

Thanks and Regards,
Anoop


You are currently subscribed to ntdev as: xxxxx@compuware.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Hi,
I had same problem. We can assemble it in using MASM by using 586 as the
processor type.
However in VC compiler we were not able to get it compiled (assembled).
What we did was to inject the opcodes using

__emit

and that did work fine.

Rgds,
Manish

-----Original Message-----
From: ANOOP.G [mailto:xxxxx@nestec.net]
Sent: Monday, June 25, 2001 5:21 PM
To: NT Developers Interest List
Subject: [ntdev] Inline assembly

Can i use MOV instruction to access CR4 register from kernel mode?

_asm
{
MOV EAX, CR4
}

I am getting this error " error C2094: label ‘CR4’ was undefined"

I am able to access CR0 and CR3 reg using MOV instruction. Do i need to
change anything in the building environment to make this inline assembly
code compilable?

Thanks and Regards,
Anoop


You are currently subscribed to ntdev as: xxxxx@zensar.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

The inline assembly capability of C compilers do not support the full
command set of the machine code.

Gary G. Little
Staff Engineer
Broadband Storage, Inc.
xxxxx@Broadstor.com
xxxxx@inland.net

-----Original Message-----
From: ANOOP.G [mailto:xxxxx@nestec.net]
Sent: Monday, June 25, 2001 4:51 AM
To: NT Developers Interest List
Subject: [ntdev] Inline assembly

Can i use MOV instruction to access CR4 register from kernel mode?

_asm
{
MOV EAX, CR4
}

I am getting this error " error C2094: label ‘CR4’ was undefined"

I am able to access CR0 and CR3 reg using MOV instruction. Do i need to
change anything in the building environment to make this inline assembly
code compilable?

Thanks and Regards,
Anoop


You are currently subscribed to ntdev as: xxxxx@broadstor.com
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com

VC6 came out before CR4 was introduced. Hence the inline assembler doesn’t
know about it. Use a separate ASM file, or use __emit.

One other thing you might try is the Visual C++ 6.0 Processor Pack,
available at http://msdn.microsoft.com/vstudio/downloads/ppack/default.asp

This supposedly supports the instruction sets of more advanced processors.

Scott

On 06/26/01, “Gary Little ” wrote:
> This message is in MIME format. Since your mail reader does not understand
> this format, some or all of this message may not be legible.
>
> ------_=_NextPart_001_01C0FD92.C7001DA0
> Content-Type: text/plain;
> charset=“iso-8859-1”
>
> The inline assembly capability of C compilers do not support the full
> command set of the machine code.
>
> Gary G. Little
> Staff Engineer
> Broadband Storage, Inc.
> xxxxx@Broadstor.com
> xxxxx@inland.net
>
>
> -----Original Message-----
> From: ANOOP.G [mailto:xxxxx@nestec.net]
> Sent: Monday, June 25, 2001 4:51 AM
> To: NT Developers Interest List
> Subject: [ntdev] Inline assembly
>
>
>
> Can i use MOV instruction to access CR4 register from kernel mode?
>
> _asm
> {
> MOV EAX, CR4
> }
>
> I am getting this error " error C2094: label ‘CR4’ was undefined"
>
> I am able to access CR0 and CR3 reg using MOV instruction. Do i need to
> change anything in the building environment to make this inline assembly
> code compilable?
>
> Thanks and Regards,
> Anoop
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@broadstor.com
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com