Il 28/10/2012 16:30, Laszlo Ersek ha scritto: >> > Is there a UEFI macro for a compiler optimization barrier? If so, use >> > it and forget volatile altogether... > Wherever the virtio specification required a memory barrier, I used > MemoryFence(). I used volatile wherever I thought it was necessary in > combination with MemoryFence. > > I encountered MemoryFence() first in "4.2.6 Memory ordering" in the UEFI > spec (2.3.1). > > I think the x86_64 / gcc-4.4 implementation of MemoryFence() is in > "MdePkg/Library/BaseLib/X64/GccInline.c".
Which is wrong, because it should really be an mfence instruction. :) Instead, as things stand the x86 MemoryFence() is just a compiler-optimization barrier, i.e. a replacement for volatile. This is fine for virtio's uses, but wrong in general so it is better if we document virtio's needs in the code. With this in place, we can remove volatile. Patches coming soon. Paolo ------------------------------------------------------------------------------ The Windows 8 Center - In partnership with Sourceforge Your idea - your app - 30 days. Get started! http://windows8center.sourceforge.net/ what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/ _______________________________________________ edk2-devel mailing list edk2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-devel