GNiDiA
驱动小牛
驱动小牛
  • 注册日期2006-10-11
  • 最后登录2017-10-09
  • 粉丝0
  • 关注0
  • 积分1002分
  • 威望145点
  • 贡献值0点
  • 好评度124点
  • 原创分0分
  • 专家分0分
  • 社区居民
阅读:1660回复:6

OSKRNL中的奇怪指令

楼主#
更多 发布于:2007-04-02 09:38
  在NTOSKRNL中的函数里经常看到这个奇怪的指令
mov edi, edi
之所以奇怪是因为很多函数的第一条指令就是它。

有两个问题:
这是用什么编译器生成的?
这有什么用?或者说为什么要在开头生成这样的指令?

哪位能说说?
GNiDiA
驱动小牛
驱动小牛
  • 注册日期2006-10-11
  • 最后登录2017-10-09
  • 粉丝0
  • 关注0
  • 积分1002分
  • 威望145点
  • 贡献值0点
  • 好评度124点
  • 原创分0分
  • 专家分0分
  • 社区居民
沙发#
发布于:2007-04-04 08:43
感谢感谢
wangjianfeng
驱动小牛
驱动小牛
  • 注册日期2004-05-28
  • 最后登录2013-10-02
  • 粉丝0
  • 关注0
  • 积分1002分
  • 威望263点
  • 贡献值0点
  • 好评度260点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2007-04-03 15:40
花指令,相当于NOP
Odyssey
驱动小牛
驱动小牛
  • 注册日期2004-12-15
  • 最后登录2008-03-29
  • 粉丝0
  • 关注0
  • 积分1000分
  • 威望115点
  • 贡献值0点
  • 好评度115点
  • 原创分0分
  • 专家分0分
地板#
发布于:2007-04-03 11:50
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

                         C/C++ COMPILER OPTIONS


                              -OPTIMIZATION-

/O1 minimize space                      /O2 maximize speed
/Ob<n> inline expansion (default n=0)   /Od disable optimizations (default)
/Og enable global optimization          /Oi[-] enable intrinsic functions
/Os favor code space                    /Ot favor code speed
/Ox maximum optimizations               /Oy[-] enable frame pointer omission

                             -CODE GENERATION-

/GF enable read-only string pooling     /Gm[-] enable minimal rebuild
/Gy[-] separate functions for linker    /GS[-] enable security checks
/GR[-] enable C++ RTTI                  /GX[-] enable C++ EH (same as /EHsc)
/EHs enable C++ EH (no SEH exceptions)  /EHa enable C++ EH (w/ SEH exceptions)
/EHc extern "C" defaults to nothrow
/fp:<except[-]|fast|precise|strict> choose floating-point model:
    except[-] - consider floating-point exceptions when generating code
    fast - "fast" floating-point model; results are less predictable
(press <return> to continue)
    precise - "precise" floating-point model; results are predictable
    strict - "strict" floating-point model (implies /fp:except)
/GL[-] enable link-time code generation /GA optimize for Windows Application
/Ge force stack checking for all funcs  /Gs[num] control stack checking calls
/Gh enable _penter function call        /GH enable _pexit function call
/GT generate fiber-safe TLS accesses    /RTC1 Enable fast checks (/RTCsu)
/RTCc Convert to smaller type checks    /RTCs Stack Frame runtime checking
/RTCu Uninitialized local usage checks
/clr[:option] compile for common language runtime, where option is:
    pure - produce IL-only output file (no native executable code)
    safe - produce IL-only verifiable output file
    oldSyntax - accept the Managed Extensions syntax from Visual C++ 2002/2003
    initialAppDomain - enable initial AppDomain behavior of Visual C++ 2002
    noAssembly - do not produce an assembly
/Gd __cdecl calling convention          /Gr __fastcall calling convention
/Gz __stdcall calling convention        /GZ Enable stack checks (/RTCs)
/QIfist[-] use FIST instead of ftol()
/hotpatch ensure function padding for hotpatchable images
/arch:<SSE|SSE2> minimum CPU architecture requirements, one of:
    SSE - enable use of instructions available with SSE enabled CPUs
    SSE2 - enable use of instructions available with SSE2 enabled CPUs

                              -OUTPUT FILES-

(press <return> to continue)

maybe you can use /hotpatch switch.  
GNiDiA
驱动小牛
驱动小牛
  • 注册日期2006-10-11
  • 最后登录2017-10-09
  • 粉丝0
  • 关注0
  • 积分1002分
  • 威望145点
  • 贡献值0点
  • 好评度124点
  • 原创分0分
  • 专家分0分
  • 社区居民
地下室#
发布于:2007-04-02 15:38
引用第1楼Odyssey2007-04-02 12:27发表的“”:
it is generated by visual C/C++ compiler
A 2 bytes nop for hotpatch (a near jmp)


需要什么选项吗?
我用VC6和VS2005都生成不了这样的代码

WIN2000DDK和VISTA DDK也生成不了
WQXNETQIQI
驱动大牛
驱动大牛
  • 注册日期2006-06-12
  • 最后登录2010-10-26
  • 粉丝0
  • 关注0
  • 积分13分
  • 威望1076点
  • 贡献值0点
  • 好评度895点
  • 原创分1分
  • 专家分0分
5楼#
发布于:2007-04-02 13:33
great
驱动开发者 呵呵
Odyssey
驱动小牛
驱动小牛
  • 注册日期2004-12-15
  • 最后登录2008-03-29
  • 粉丝0
  • 关注0
  • 积分1000分
  • 威望115点
  • 贡献值0点
  • 好评度115点
  • 原创分0分
  • 专家分0分
6楼#
发布于:2007-04-02 12:27
it is generated by visual C/C++ compiler
A 2 bytes nop for hotpatch (a near jmp)
游客

返回顶部