VirtualBox

Ticket #1083: vmreq_fix_1.5

File vmreq_fix_1.5, 1.9 KB (added by Frank Mehnert, 17 years ago)

Patch against VBox 1.5.4 OSE to fix this problem

Line 
1Index: src/VBox/VMM/VMReq.cpp
2===================================================================
3--- src/VBox/VMM/VMReq.cpp (revision 27120)
4+++ src/VBox/VMM/VMReq.cpp (revision 27121)
5@@ -525,9 +525,16 @@
6 return VERR_VM_REQUEST_INVALID_TYPE;
7 }
8
9+ /*
10+ * Are we the EMT or not?
11+ * Also, store pVM (and fFlags) locally since pReq may be invalid after queuing it.
12+ */
13 int rc = VINF_SUCCESS;
14- if (pReq->pVM->NativeThreadEMT != RTThreadNativeSelf())
15+ PVM pVM = ((VMREQ volatile *)pReq)->pVM; /* volatile paranoia */
16+ if (pVM->NativeThreadEMT != RTThreadNativeSelf())
17 {
18+ unsigned fFlags = ((VMREQ volatile *)pReq)->fFlags; /* volatile paranoia */
19+
20 /*
21 * Insert it.
22 */
23@@ -535,20 +542,20 @@
24 PVMREQ pNext;
25 do
26 {
27- pNext = pReq->pVM->vm.s.pReqs;
28+ pNext = pVM->vm.s.pReqs;
29 pReq->pNext = pNext;
30- } while (!ASMAtomicCmpXchgPtr((void * volatile *)&pReq->pVM->vm.s.pReqs, (void *)pReq, (void *)pNext));
31+ } while (!ASMAtomicCmpXchgPtr((void * volatile *)&pVM->vm.s.pReqs, (void *)pReq, (void *)pNext));
32
33 /*
34 * Notify EMT.
35 */
36- VM_FF_SET(pReq->pVM, VM_FF_REQUEST);
37- VMR3NotifyFF(pReq->pVM, false);
38+ VM_FF_SET(pVM, VM_FF_REQUEST);
39+ VMR3NotifyFF(pVM, false);
40
41 /*
42 * Wait and return.
43 */
44- if (!(pReq->fFlags & VMREQFLAGS_NO_WAIT))
45+ if (!(fFlags & VMREQFLAGS_NO_WAIT))
46 rc = VMR3ReqWait(pReq, cMillies);
47 LogFlow(("VMR3ReqQueue: returns %Vrc\n", rc));
48 }
49@@ -558,7 +565,7 @@
50 * The requester was EMT, just execute it.
51 */
52 pReq->enmState = VMREQSTATE_QUEUED;
53- rc = vmR3ReqProcessOne(pReq->pVM, pReq);
54+ rc = vmR3ReqProcessOne(pVM, pReq);
55 LogFlow(("VMR3ReqQueue: returns %Vrc (processed)\n", rc));
56 }
57 return rc;

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy