阅读:1449回复:7
内嵌汇编代码的问题?
我想在驱动代码中内嵌一些象
Call_Priority_VM_Event 一样的函数代码。 但编译时系统认不出这样的函数。怎么把函数的头文件包含进去?? 编译错误如下: error C2400:inline assembler syntax error in \'opcode\'; found \'LOCK_Call_Priority_VM_Event\' |
|
最新喜欢:baoyib... |
沙发#
发布于: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中 |
|
|
板凳#
发布于:2002-05-27 09:50
VToolsD的东西?你最好把源代码贴出来,不知道你装了VToolsD没有.
|
|
地板#
发布于:2002-05-27 12:24
include vmm.inc 怎么包含进去呢
include vmm.inc编译出错 #include vmm.inc也出错阿 ??? 关键是怎么在vc环境中应用这个头文件?? |
|
地下室#
发布于:2002-05-27 12:35
*.inc是汇编程序的包含文件,不能直接用于C,你可以单独做一个汇编模块来包含inc文件。
|
|
|
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语言文件中,进行编译?? |
|
6楼#
发布于:2002-05-27 12:41
谢谢.
|
|
7楼#
发布于:2002-05-27 13:31
如果使用DDK并用C,你可包括VMM.h文件,而不是VMM.inc(使用汇编时使用)
|
|
|