We've got a SCSIPort Miniport style driver that is hanging the system when
it goes into Hibernate mode. We've tracked down where its hanging to a
prefetchw assembly instruction. This gets inserted during optimization, and
as such, this driver only fails when using the free build. The checked build
works fine.
My question is whether there's a way to turn off certain aspects of compiler
optimization. Specifically, the generation of that prefetchw. If we change
the code around a little, we can either get the code to jump over the
prefetch, or make sure the compiler doesn't create it. But those solutions
add a bunch of memory accesses, which is not ideal since this is in a
critical section of code.
We suspect that the problem is that prefetchw is not supported on an Intel
processor, which is what we are running the driver on. We have not yet had a
chance to test this out on an AMD processor.
We are using the Microsoft C/C++ Optimizing Compiler Version 14.00.50727.278
for x64. We've tried different flags for changing the optimization levels,
but it either creates code that doesn't work, or doesn't optimize at all.
We've also tried the /favor:EM64T flag, but that doesn't seem to have an
effect. I've noticed other compilers have ways of turning off prefetching
specifically, but I couldn't find anything that does that in the Microsoft C
compiler.
So, I guess my question is, does anyone have either a solution or workaround
to our problem, as well as any ideas why a prefetchw instruction would lock
up the computer during hibernate mode?
Thanks in advance,
~Tom