vmware-svga/lib
Micah Dowty 99a767c5d9 Hopefully fix Metalkit refdriver SVGA_WaitForIRQ hangs
There's been a longstanding bug in the IRQ handling code
in the Metalkit version of the SVGA reference driver, which
occasionally caused tests to hang.

I looked at the disassembly of SVGA_WaitForIRQ and friends, and
I found one big problem and one smaller problem:

The 'switchContext' flag is used to tell the IRQ handler
whether it should branch to the saved context or not. This
value *must* be written before we halt, or we can deadlock.
Unfortunately, the value wasn't marked as 'volatile', and the
compiler was optimizing out this assignment entirely! This
means that 'flags' will never get set, and we'll be in an
infinite loop.

Given this bug, I'm not sure why WaitForIRQ ever worked.
It's possible that we were fine if the IRQ had already arrived
by the time WaitForIRQ was called, but we'd deadlock if we
actually ended up waiting. If this is the case, it also means
that fence-stress isn't doing a very good job of stressing the
IRQ code.

The other, much less severe problem: The stack frames for
WaitForIRQInternal and SaveContext may have been partially
overlapping, since gcc was allocating 0x10 bytes on the
stack before calling SaveContext. The proper solution is
probably just to rewrite all of this in assembly, but for
now I just increased the number of padding words on the
stack by adding extra NULL parameters to WaitForIRQInternal.
2009-05-07 22:35:49 +00:00
..
metalkit Initial revision 2009-04-13 07:05:42 +00:00
refdriver Hopefully fix Metalkit refdriver SVGA_WaitForIRQ hangs 2009-05-07 22:35:49 +00:00
util Enhance lib/util/vmbackdoor with some basic support for 2009-04-17 21:49:50 +00:00
vmware Initial revision 2009-04-13 07:05:42 +00:00
Makefile.rules Initial revision 2009-04-13 07:05:42 +00:00
README Initial revision 2009-04-13 07:05:42 +00:00

Library Code
------------

metalkit -
   Open source (MIT-licensed) library code for writing programs
   that run on the IA32 architecture on the "bare metal", without
   an operating system.

refdriver -
   Source code for the VMware SVGA reference driver.

util -
   Utility code used by the accompanying examples. Includes higher
   level APIs built on top of the reference driver, as well as
   miscellaneous code such as text rendering and matrix math.

vmware -
   VMware-provided header files, including the headers which define
   registers and FIFO commands used by the VMware SVGA device.

win32 -
   A Win32 port of the VMWare SVGA reference driver. This driver runs
   in userspace, using the kernel mode interface provided by VMware's
   proprietary kernel-mode graphics driver for Windows XP.