diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 03:01:46 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-06 03:01:46 +0000 |
commit | f8fe689a81f906d1b91bb3220acde2a4ecb14c5b (patch) | |
tree | 26484e9d7e2c67806c2d1760196ff01aaa858e8c /src/VBox/VMM/VMMAll/PDMAllCritSectBoth.cpp | |
parent | Initial commit. (diff) | |
download | virtualbox-f8fe689a81f906d1b91bb3220acde2a4ecb14c5b.tar.xz virtualbox-f8fe689a81f906d1b91bb3220acde2a4ecb14c5b.zip |
Adding upstream version 6.0.4-dfsg.upstream/6.0.4-dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/VBox/VMM/VMMAll/PDMAllCritSectBoth.cpp')
-rw-r--r-- | src/VBox/VMM/VMMAll/PDMAllCritSectBoth.cpp | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/src/VBox/VMM/VMMAll/PDMAllCritSectBoth.cpp b/src/VBox/VMM/VMMAll/PDMAllCritSectBoth.cpp new file mode 100644 index 00000000..0938ab51 --- /dev/null +++ b/src/VBox/VMM/VMMAll/PDMAllCritSectBoth.cpp @@ -0,0 +1,97 @@ +/* $Id: PDMAllCritSectBoth.cpp $ */ +/** @file + * PDM - Code Common to Both Critical Section Types, All Contexts. + */ + +/* + * Copyright (C) 2006-2019 Oracle Corporation + * + * This file is part of VirtualBox Open Source Edition (OSE), as + * available from http://www.virtualbox.org. This file is free software; + * you can redistribute it and/or modify it under the terms of the GNU + * General Public License (GPL) as published by the Free Software + * Foundation, in version 2 as it comes in the "COPYING" file of the + * VirtualBox OSE distribution. VirtualBox OSE is distributed in the + * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. + */ + + +/********************************************************************************************************************************* +* Header Files * +*********************************************************************************************************************************/ +#define LOG_GROUP LOG_GROUP_PDM//_CRITSECT +#include "PDMInternal.h" +#include <VBox/vmm/pdmcritsect.h> +#include <VBox/vmm/pdmcritsectrw.h> +#include <VBox/vmm/vm.h> +#include <iprt/errcore.h> + +#include <VBox/log.h> +#include <iprt/assert.h> +#include <iprt/asm.h> + + +#if defined(IN_RING3) || defined(IN_RING0) +/** + * Process the critical sections (both types) queued for ring-3 'leave'. + * + * @param pVCpu The cross context virtual CPU structure. + */ +VMM_INT_DECL(void) PDMCritSectBothFF(PVMCPU pVCpu) +{ + uint32_t i; + Assert( pVCpu->pdm.s.cQueuedCritSectLeaves > 0 + || pVCpu->pdm.s.cQueuedCritSectRwShrdLeaves > 0 + || pVCpu->pdm.s.cQueuedCritSectRwExclLeaves > 0); + + /* Shared leaves. */ + i = pVCpu->pdm.s.cQueuedCritSectRwShrdLeaves; + pVCpu->pdm.s.cQueuedCritSectRwShrdLeaves = 0; + while (i-- > 0) + { +# ifdef IN_RING3 + PPDMCRITSECTRW pCritSectRw = pVCpu->pdm.s.apQueuedCritSectRwShrdLeaves[i]; +# else + PPDMCRITSECTRW pCritSectRw = (PPDMCRITSECTRW)MMHyperR3ToCC(pVCpu->CTX_SUFF(pVM), + pVCpu->pdm.s.apQueuedCritSectRwShrdLeaves[i]); +# endif + + pdmCritSectRwLeaveSharedQueued(pCritSectRw); + LogFlow(("PDMR3CritSectFF: %p (R/W)\n", pCritSectRw)); + } + + /* Last, exclusive leaves. */ + i = pVCpu->pdm.s.cQueuedCritSectRwExclLeaves; + pVCpu->pdm.s.cQueuedCritSectRwExclLeaves = 0; + while (i-- > 0) + { +# ifdef IN_RING3 + PPDMCRITSECTRW pCritSectRw = pVCpu->pdm.s.apQueuedCritSectRwExclLeaves[i]; +# else + PPDMCRITSECTRW pCritSectRw = (PPDMCRITSECTRW)MMHyperR3ToCC(pVCpu->CTX_SUFF(pVM), + pVCpu->pdm.s.apQueuedCritSectRwExclLeaves[i]); +# endif + + pdmCritSectRwLeaveExclQueued(pCritSectRw); + LogFlow(("PDMR3CritSectFF: %p (R/W)\n", pCritSectRw)); + } + + /* Normal leaves. */ + i = pVCpu->pdm.s.cQueuedCritSectLeaves; + pVCpu->pdm.s.cQueuedCritSectLeaves = 0; + while (i-- > 0) + { +# ifdef IN_RING3 + PPDMCRITSECT pCritSect = pVCpu->pdm.s.apQueuedCritSectLeaves[i]; +# else + PPDMCRITSECT pCritSect = (PPDMCRITSECT)MMHyperR3ToCC(pVCpu->CTX_SUFF(pVM), pVCpu->pdm.s.apQueuedCritSectLeaves[i]); +# endif + + PDMCritSectLeave(pCritSect); + LogFlow(("PDMR3CritSectFF: %p\n", pCritSect)); + } + + VMCPU_FF_CLEAR(pVCpu, VMCPU_FF_PDM_CRITSECT); +} +#endif /* IN_RING3 || IN_RING0 */ + |