dingwws
驱动牛犊
驱动牛犊
  • 注册日期2001-05-09
  • 最后登录2018-05-30
  • 粉丝0
  • 关注0
  • 积分-6分
  • 威望101点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
  • 社区居民
阅读:1449回复:7

内嵌汇编代码的问题?

楼主#
更多 发布于:2002-05-27 08:40
我想在驱动代码中内嵌一些象
Call_Priority_VM_Event 一样的函数代码。
但编译时系统认不出这样的函数。怎么把函数的头文件包含进去??

编译错误如下:
error C2400:inline assembler syntax error in \'opcode\'; found \'LOCK_Call_Priority_VM_Event\'


最新喜欢:

baoyibao99baoyib...
AllenZh
驱动老牛
驱动老牛
  • 注册日期2001-08-19
  • 最后登录2015-11-27
  • 粉丝19
  • 关注10
  • 积分1316分
  • 威望2387点
  • 贡献值7点
  • 好评度321点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2002-05-27 09:45
Call_Priority_VM_Event 是从Windows 3.0就开始使用的VMM服务了,你需要Win98DDK或更底版本支持,调用如下:
include vmm.inc

mov     eax, PriorityBoost
mov     ebx, VMHandle
mov     ecx, Flags
mov     edx, RefData
mov     esi, OFFSET32 PriorityEventCallback
mov     edi, TimeOut
VMMCall Call_Priority_VM_Event
mov     [EventHandle], esi
 
Calls the callback function immediately or schedules a priority event for the specified virtual machine. This is an asynchronous service. Uses Flags and ESI.

Returns zero in ESI if the callback function was called immediately. Otherwise, returns the event handle in ESI. The handle can be used in a subsequent call to the Cancel_Priority_VM_Event service to cancel the event.
PriorityBoost
Priority boost for the virtual machine. This parameter must be a value such that when added to the current execution priority, the result is within the range Reserved_Low_Boost to Reserved_High_Boost. This parameter can be 0 if no boost is necessary. Common priority boost values, from lowest to highest, are as follows: Value  Meaning  
Reserved_Low_Boost  Reserved for use by system.  
Cur_Run_VM_Boost  Use to boost the priority of each virtual machine, in turn, forcing them to run for their allotted time slices.  
Low_Pri_Device_Boost  Use for operations that need timely processing but are not time critical.  
High_Pri_Device_Boost  Use for time-critical operations that should not circumvent the critical section boost.  
Critical_Section_Boost  Use to boost the priority of the virtual machine whenever it enters a critical section (calls Begin_Critical_Section).  
Time_Critical_Boost  Use for operations that require immediate processing, even when another virtual machine is in a critical section. For example, VPICD uses this when simulating hardware interrupts.  
Reserved_High_Boost  Reserved for use by system.  


Forgetting to pass a priority value in the EAX register is a common error.

VMHandle
Handle of the virtual machine to process the event. This value must be a valid VM handle.
Flags
A combination of these action flags: Value  Meaning  
PEF_Always_Sched  Event is always scheduled, meaning the callback function is never called immediately.  
PEF_Dont_Unboost  Priority of the virtual machine is not reduced after return from callback function.  
PEF_Time_Out  Specifies that time-out value in the EDI register should be used. Available in Windows version 3.1 or later.  
PEF_Wait_For_STI  Callback function is not called until the virtual machine enables interrupts in all threads.  
PEF_Wait_Not_Crit  Callback function is not called until the virtual machine is not in a critical section or time-critical operation.  
PEF_Wait_Not_Time_Crit, PEF_Wait_Not_HW_Int  Callback function is not called until the thread priority is below TIME_CRITICAL_BOOST. Useful to prevent an event from occurring while an interrupt is being simulated into a VM.  


All other values are reserved.

RefData
Reference data to pass to the callback function.
EventCallback
Address of the callback function to install. For more information about the callback function, see PriorityEventCallback.
TimeOut
Number of milliseconds until the event times out. The service uses this parameter only if the PEF_Time_Out value is specified by Flags.
The system carries out a task switch to the specified virtual machine if it is not the current virtual machine. If PriorityBoost is not zero, the service boosts the priority of the virtual machine before calling the callback function.

If the amount of time specified by TimeOut elapses before the system can switch to the virtual machine, the system sets the carry flag and calls the callback function immediately regardless of which virtual machine is currently running. In this case, any requested priority boost is canceled even if Flags specified the PEF_Dont_Unboost value. The callback function should always check the carry flag to determine whether a time out occurred.
以上信息摘自MSDN中
 
1,承接Windows下驱动/应用开发 2,本人原创虚拟鼠标/键盘,触摸屏,虚拟显卡,Mirror驱动,XP无盘的SCSI虚拟磁盘驱动等 3,windows下有尝技术服务(包括BUG调试,员工培训等) 欢迎深圳和海外企业联系.msn:mfczmh@sina.com
fracker
驱动太牛
驱动太牛
  • 注册日期2001-06-28
  • 最后登录2021-03-30
  • 粉丝0
  • 关注0
  • 积分219分
  • 威望81点
  • 贡献值0点
  • 好评度23点
  • 原创分0分
  • 专家分1分
  • 社区居民
板凳#
发布于:2002-05-27 09:50
VToolsD的东西?你最好把源代码贴出来,不知道你装了VToolsD没有.
dingwws
驱动牛犊
驱动牛犊
  • 注册日期2001-05-09
  • 最后登录2018-05-30
  • 粉丝0
  • 关注0
  • 积分-6分
  • 威望101点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
  • 社区居民
地板#
发布于:2002-05-27 12:24
include vmm.inc 怎么包含进去呢

include vmm.inc编译出错

#include vmm.inc也出错阿
???
关键是怎么在vc环境中应用这个头文件??


shyeagle
驱动老牛
驱动老牛
  • 注册日期2002-04-30
  • 最后登录2007-07-31
  • 粉丝1
  • 关注1
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2002-05-27 12:35
*.inc是汇编程序的包含文件,不能直接用于C,你可以单独做一个汇编模块来包含inc文件。
[url=http://www.01study.com]01空间网[/url] [url=http://www.01study.com/forum/dispbbs.asp?boardID=73&ID=193&skin=0]版主招募[/url] [img]http://shy2003.vip.sina.com/map/yjs.gif[/img]
dingwws
驱动牛犊
驱动牛犊
  • 注册日期2001-05-09
  • 最后登录2018-05-30
  • 粉丝0
  • 关注0
  • 积分-6分
  • 威望101点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
  • 社区居民
5楼#
发布于:2002-05-27 12:40
VToolsD中已经封装好了(成立一个c函数).多了一个参数.可以用
Call_Priority_VM_Event(LOW_PRI_DEVICE_BOOST,Get_Sys_VM_Handle(),
PEF_WAIT_FOR_STI+PEF_WAIT_NOT_CRIT,
0,PriorityEventLogHandler, 0,&tThunk);


我想问怎么可以在用c写驱动中嵌入这种汇编的函数??
vmm.inc怎么想一般的*.h这样的包含进c语言文件中,进行编译??

dingwws
驱动牛犊
驱动牛犊
  • 注册日期2001-05-09
  • 最后登录2018-05-30
  • 粉丝0
  • 关注0
  • 积分-6分
  • 威望101点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
  • 社区居民
6楼#
发布于:2002-05-27 12:41
谢谢.
AllenZh
驱动老牛
驱动老牛
  • 注册日期2001-08-19
  • 最后登录2015-11-27
  • 粉丝19
  • 关注10
  • 积分1316分
  • 威望2387点
  • 贡献值7点
  • 好评度321点
  • 原创分0分
  • 专家分0分
7楼#
发布于:2002-05-27 13:31
如果使用DDK并用C,你可包括VMM.h文件,而不是VMM.inc(使用汇编时使用)
1,承接Windows下驱动/应用开发 2,本人原创虚拟鼠标/键盘,触摸屏,虚拟显卡,Mirror驱动,XP无盘的SCSI虚拟磁盘驱动等 3,windows下有尝技术服务(包括BUG调试,员工培训等) 欢迎深圳和海外企业联系.msn:mfczmh@sina.com
游客

返回顶部