lovedriver
驱动牛犊
驱动牛犊
  • 注册日期2004-11-01
  • 最后登录2005-01-14
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1121回复:5

driver中可以使用sin,以及log10函数

楼主#
更多 发布于:2004-12-14 16:31
但是ddk帮助中啥也找不到,没有相关的帮助。
热爱驱动
aiwadgj
驱动老牛
驱动老牛
  • 注册日期2004-11-13
  • 最后登录2020-12-24
  • 粉丝0
  • 关注0
  • 积分119分
  • 威望84点
  • 贡献值0点
  • 好评度14点
  • 原创分0分
  • 专家分0分
  • 社区居民
沙发#
发布于:2004-12-14 17:41
目前有关部门规定,
内核模式的驱动程序中
只能用DDK中说明的函数!
酒也在沉溺,何时麻醉我抑郁。过去了的一切会平息。。。。。。。
AllenZh
驱动老牛
驱动老牛
  • 注册日期2001-08-19
  • 最后登录2015-11-27
  • 粉丝19
  • 关注10
  • 积分1316分
  • 威望2387点
  • 贡献值7点
  • 好评度321点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2004-12-14 20:33
但是ddk帮助中啥也找不到,没有相关的帮助。

检验不要在驱动中使用浮点运算,因为这样你可能会降低系统总体性能
1,承接Windows下驱动/应用开发 2,本人原创虚拟鼠标/键盘,触摸屏,虚拟显卡,Mirror驱动,XP无盘的SCSI虚拟磁盘驱动等 3,windows下有尝技术服务(包括BUG调试,员工培训等) 欢迎深圳和海外企业联系.msn:mfczmh@sina.com
wowocock
VIP专家组
VIP专家组
  • 注册日期2002-04-08
  • 最后登录2016-01-09
  • 粉丝16
  • 关注2
  • 积分601分
  • 威望1651点
  • 贡献值1点
  • 好评度1227点
  • 原创分1分
  • 专家分0分
地板#
发布于:2004-12-14 22:23
在系统中不用浮点运算,可能是因为进程切换的时候无法保存SSE寄存器,所以你可以手动做,或者直接用汇编来处理.
花开了,然后又会凋零,星星是璀璨的,可那光芒也会消失。在这样 一瞬间,人降生了,笑者,哭着,战斗,伤害,喜悦,悲伤憎恶,爱。一切都只是刹那间的邂逅,而最后都要归入死亡的永眠
wowocock
VIP专家组
VIP专家组
  • 注册日期2002-04-08
  • 最后登录2016-01-09
  • 粉丝16
  • 关注2
  • 积分601分
  • 威望1651点
  • 贡献值1点
  • 好评度1227点
  • 原创分1分
  • 专家分0分
地下室#
发布于:2004-12-14 22:31
FPU 和MMX的可以使用.
在设备驱动程序中(WDM or Kernel Mode)中如何使用浮点数
Using Floating Point or MMX in a WDM Driver
Kernel-mode WDM drivers for Windows Me, Windows 98, Windows 98 SE, and Windows 2000 must follow certain guidelines for using floating-point operations, MMX, 3DNOW!, or Intel's SSE extensions.

Kernel-mode WDM drivers must wrap use of the floating-point unit (FPU) between calls to KeSaveFloatingPointState and KeRestoreFloatingPointState. (See the Kernel-Mode Drivers Reference in the Windows 2000 DDK for details.) Failure to use these routines can cause calculation errors in concurrent user-mode applications.

KeSaveFloatingPointState saves the FPU state of the currently running application in a system-provided buffer and reinitializes the FPU for the driver. The routine takes a single parameter, a driver-allocated buffer, which provides support for nested calls. If KeSaveFloatingPointState is called twice at the same IRQL without an intervening call to KeRestoreFloatingPointState, the nonvolatile FPU state is saved in the driver-allocated buffer. (The caller must save volatile state from ST0-ST7, MMX0-MMX7, and XMMI0-XMMI7.)

If the system is low on memory, KeSaveFloatingPointState can fail. Drivers must check the returned status and, if a failure occurs, must not access the FPU.

When a driver has finished using the FPU, it calls KeRestoreFloatingPointState to restore the previous application state.

The following example shows how a WDM driver should wrap its FPU access:

KFLOATING_SAVE saveData;
NTSTATUS status;
double floatValue;

status = KeSaveFloatingPointState(&saveData);

if (NT_SUCCESS(status)) {

floatValue = 1.0;
KeRestoreFloatingPointState(&saveData);
}
In the example, the assignment to the floating-point variable occurs between calls to KeSaveFloatingPointState and KeRestoreFloatingPointState. Because any assignment to a floating-point variable uses the FPU, drivers must ensure that KeSaveFloatingPointState has returned without error before initializing such a variable.

On Windows 2000, WDM drivers can call KeSaveFloatingPointState at IRQL <= DISPATCH_LEVEL. However, use of floating-point operations is not supported in interrupt service routines (ISRs). On Windows 2000, the FPU is set to long real precision (that is, double or 53-bit), with all exceptions masked, upon return from KeSaveFloatingPointState.

On Windows Me, Windows 98, and Windows 98 SE, drivers that use the FPU must adhere to the following guidelines:

Access the FPU only from passive-level work items or worker threads.
Do not call KeSaveFloatingPointState or attempt to use the FPU or MMX from a DPC, from an IOCTL handler, or from any other handler called from user mode. Do not try to circumvent this rule; there is no driver-implementable workaround that is guaranteed to operate correctly on all processors.
Reload the FPU control word with 0x27F after KeSaveFloatingPointState returns. Doing so ensures that the FPU is set to long real precision (double or 53-bit), with all exceptions masked, as on Windows 2000.
For Windows 98 and Windows 98 SE only, always call KeSaveFloatingPointState at IRQL PASSIVE_LEVEL. Calling this routine at IRQL DISPATCH_LEVEL can cause a system crash.
花开了,然后又会凋零,星星是璀璨的,可那光芒也会消失。在这样 一瞬间,人降生了,笑者,哭着,战斗,伤害,喜悦,悲伤憎恶,爱。一切都只是刹那间的邂逅,而最后都要归入死亡的永眠
lovedriver
驱动牛犊
驱动牛犊
  • 注册日期2004-11-01
  • 最后登录2005-01-14
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2004-12-15 09:45
大概一般情况下也不需要使用float,
效率问题还在其次,使用也不方便。

热爱驱动
游客

返回顶部