简体   繁体   English

Windows上将32位_asm代码转换为64位汇编代码

[英]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: 我有一个驱动程序代码,使用32位WDK进行编译时,正在使用_asm (内联程序集)的程序集代码正常工作,但会引发以下错误:

"error C4235: nonstandard extension used : '_asm' keyword not supported on this architecture" “错误C4235:使用了非标准扩展名:此体系结构不支持'_asm'关键字”

please convert following _asm code for 64 bit compilation. 请转换以下_asm代码进行64位编译。

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

Using Microsoft's compiler intrinsics, 使用Microsoft的编译器内部函数,

#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). 这应该在x86和x64上都可以工作(当然,只能在内核模式下操作CR0 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM