Files
@ d0a14f973771
Branch filter:
Location: vmkdrivers/BLD/build/HEADERS/vmkapi-current-all-public/vmkernel64/release/core/vmkapi_cpu.h
d0a14f973771
3.9 KiB
text/x-chdr
ESXi-5.0-U1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | /* **********************************************************
* Copyright 2010 VMware, Inc. All rights reserved.
* **********************************************************/
/*
* @VMKAPIMOD_LICENSE@
*/
/*
******************************************************************************
* CPU */ /**
*
* \addtogroup Core
* @{
* \defgroup CPU CPU
* @{
******************************************************************************
*/
#ifndef _VMKAPI_CORE_CPU_H_
#define _VMKAPI_CORE_CPU_H_
/** \cond never */
#ifndef VMK_HEADER_INCLUDED_FROM_VMKAPI_H
#error This vmkapi file should never be included directly but only via vmkapi.h
#endif
/** \endcond never */
/**
* Opaque identifier for a PCPU
*/
typedef struct VMKPCPUIDInt *vmk_PCPUID;
/**
* Opaque structure used for state in VMK_WITH_PCPU_DO macro.
*/
typedef struct vmk_WithPCPUState {
vmk_uint8 opaque[8];
} vmk_WithPCPUState;
/** \cond never
* We don't want the following to show up in doxygen.
*/
/*
******************************************************************************
* _vmk_PCPUGet -- */ /**
*
* \brief Get an identifier for the PCPU that the code is currtly running on
*
* Retrieves an identifier for the current PCPU and disables preemption
*
* \note Always use VMK_WITH_PCPU_DO { } VMK_END_WITH_PCPU. Never use
* _vmk_PCPUGet on its own.
*
* \note A caller has to release the PCPU and reenable preemption with a
* subsequent vmk_PCPURelease call. It is the duty of the caller to
* reenable preemption as fast as possible.
*
* \return Identifier for the current PCPU
*
******************************************************************************
*/
vmk_PCPUID _vmk_PCPUGet(vmk_WithPCPUState *withPCPU);
/*
******************************************************************************
* _vmk_PCPURelease -- */ /**
*
* \brief Release a PCPU previously acquired via vmk_PcpuGet
*
* \note Always use VMK_WITH_PCPU_DO { } VMK_END_WITH_PCPU. Never use
* _vmk_PCPURelease on its own.
*
* \param[in] pcpu PCPU identifier previously returned by _vmk_PCPUGet
*
******************************************************************************
*/
void _vmk_PCPURelease(vmk_PCPUID pcpu,
vmk_WithPCPUState *withPCPU);
/** \endcond never */
/*
******************************************************************************
* VMK_WITH_PCPU_DO -- */ /**
*
* \brief Start a code section that needs to stay pinned to the current PCPU
*
* Provides an identifier for the current PCPU in pcpu and disables preemption.
*
* \note Has to be paired with a subsequent VMK_END_WITH_PCPU call
*
* \note Callers are responsible for surrendering the PCPU by calling
* VMK_END_WITH_PCPU as quickly as possible
*
******************************************************************************
*/
#define VMK_WITH_PCPU_DO(_pcpu) \
do { \
vmk_WithPCPUState _withPCPUState; \
vmk_PCPUID _pcpu = _vmk_PCPUGet(&_withPCPUState);
/*
******************************************************************************
* VMK_END_WITH_PCPU -- */ /**
*
* \brief End a pinned code section
*
* Releases the PCPU and restores preemption to its previous state
*
* \note Has to be paired with a prior call to VMK_WITH_PCPU_DO
*
******************************************************************************
*/
#define VMK_END_WITH_PCPU(_pcpu) \
_vmk_PCPURelease(_pcpu, &_withPCPUState); \
} while(0);
#endif
/** @} */
/** @} */
|