sunil
sunil

Reputation: 19

32 bit _asm code to 64 bit assembly code on Windows

i have a driver code havin an assembly code that is using _asm (inline assembly) its working fine when i am compiling in 32 bit WDK but it throw following error:

"error C4235: nonstandard extension used : '_asm' keyword not supported on this architecture"

please convert following _asm code for 64 bit compilation.

_asm
    {
        mov     ebx, cr0 
        push    ebx 
        and     ebx, ~010000h 
        mov     cr0, ebx
    } 

Upvotes: 1

Views: 5519

Answers (1)

ephemient
ephemient

Reputation: 204668

Using Microsoft's compiler intrinsics,

#include <intrin.h>
__writecr0(__readcr0() & ~0x1000);

This should work on both x86 and x64 (though of course manipulating CR0 can only be done in kernel mode).

Upvotes: 3

Related Questions