Changeset 39303 in vbox
- Timestamp:
- Nov 15, 2011 10:55:12 AM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 74857
- Location:
- trunk
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/types.h
r38549 r39303 118 118 { 119 119 /** The bitmap data. */ 120 uint32_t au32Bitmap[ 256/32];120 uint32_t au32Bitmap[8 /*256/32*/]; 121 121 } VMCPUSET; 122 122 /** Pointer to a Virtual CPU set. */ … … 124 124 /** Pointer to a const Virtual CPU set. */ 125 125 typedef VMCPUSET const *PCVMCPUSET; 126 127 /** Tests if a valid CPU ID is present in the set.. */128 #define VMCPUSET_IS_PRESENT(pSet, idCpu) ASMBitTest( &(pSet)->au32Bitmap, (idCpu))129 /** Adds a CPU to the set. */130 #define VMCPUSET_ADD(pSet, idCpu) ASMBitSet( &(pSet)->au32Bitmap, (idCpu))131 /** Deletes a CPU from the set. */132 #define VMCPUSET_DEL(pSet, idCpu) ASMBitClear(&(pSet)->au32Bitmap, (idCpu))133 /** Empties the set. */134 #define VMCPUSET_EMPTY(pSet) memset(&(pSet)->au32Bitmap[0], '\0', sizeof((pSet)->au32Bitmap))135 /** Filles the set. */136 #define VMCPUSET_FILL(pSet) memset(&(pSet)->au32Bitmap[0], 0xff, sizeof((pSet)->au32Bitmap))137 /** Filles the set. */138 #define VMCPUSET_IS_EQUAL(pSet1, pSet2) (memcmp(&(pSet1)->au32Bitmap[0], &(pSet2)->au32Bitmap[0], sizeof((pSet1)->au32Bitmap)) == 0)139 126 140 127 -
trunk/src/VBox/Devices/PC/DevACPI.cpp
r39091 r39303 23 23 #include <VBox/vmm/pgm.h> 24 24 #include <VBox/vmm/dbgftrace.h> 25 #include <VBox/vmm/vmcpuset.h> 25 26 #include <VBox/log.h> 26 27 #include <VBox/param.h> -
trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp
r39248 r39303 1793 1793 1794 1794 InsertConfigNode(pInst, "Config", &pCfg); 1795 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE /* not safe here yet. */ 1795 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE /* not safe here yet. */ /** @todo Make PCNet ring-0 safe on 32-bit mac kernels! */ 1796 1796 if (pDev == pDevPCNet) 1797 1797 { -
trunk/src/VBox/VMM/VMMAll/VMMAll.cpp
r39078 r39303 24 24 #include "VMMInternal.h" 25 25 #include <VBox/vmm/vm.h> 26 #include <VBox/vmm/vm m.h>26 #include <VBox/vmm/vmcpuset.h> 27 27 #include <VBox/param.h> 28 28 #include <iprt/thread.h> 29 29 #include <iprt/mp.h> 30 31 32 /******************************************************************************* 33 * Global Variables * 34 *******************************************************************************/ 35 /** User counter for the vmmInitFormatTypes function (pro forma). */ 36 static volatile uint32_t g_cFormatTypeUsers = 0; 37 38 39 /** 40 * Helper that formats a decimal number in the range 0..9999. 41 * 42 * @returns The length of the formatted number. 43 * @param pszBuf Output buffer with sufficient space. 44 * @param uNum The number to format. 45 */ 46 static unsigned vmmFormatTypeShortNumber(char *pszBuf, uint32_t uNumber) 47 { 48 unsigned off = 0; 49 if (uNumber >= 10) 50 { 51 if (uNumber >= 100) 52 { 53 if (uNumber >= 1000) 54 pszBuf[off++] = ((uNumber / 1000) % 10) + '0'; 55 pszBuf[off++] = ((uNumber / 100) % 10) + '0'; 56 } 57 pszBuf[off++] = ((uNumber / 10) % 10) + '0'; 58 } 59 pszBuf[off++] = (uNumber % 10) + '0'; 60 pszBuf[off] = '\0'; 61 return off; 62 } 63 64 65 /** 66 * @callback_method_impl{FNRTSTRFORMATTYPE, vmsetcpu} 67 */ 68 static DECLCALLBACK(size_t) vmmFormatTypeVmCpuSet(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput, 69 const char *pszType, void const *pvValue, 70 int cchWidth, int cchPrecision, unsigned fFlags, 71 void *pvUser) 72 { 73 PCVMCPUSET pSet = (PCVMCPUSET)pvValue; 74 uint32_t cCpus = 0; 75 uint32_t iCpu = RT_ELEMENTS(pSet->au32Bitmap) * 32; 76 while (iCpu--) 77 if (VMCPUSET_IS_PRESENT(pSet, iCpu)) 78 cCpus++; 79 80 char szTmp[32]; 81 AssertCompile(RT_ELEMENTS(pSet->au32Bitmap) * 32 < 999); 82 if (cCpus == 1) 83 { 84 iCpu = RT_ELEMENTS(pSet->au32Bitmap) * 32; 85 while (iCpu--) 86 if (VMCPUSET_IS_PRESENT(pSet, iCpu)) 87 { 88 szTmp[0] = 'c'; 89 szTmp[1] = 'p'; 90 szTmp[2] = 'u'; 91 return pfnOutput(pvArgOutput, szTmp, 3 + vmmFormatTypeShortNumber(&szTmp[3], iCpu)); 92 } 93 cCpus = 0; 94 } 95 if (cCpus == 0) 96 return pfnOutput(pvArgOutput, "<empty>", sizeof("<empty>") - 1); 97 if (cCpus == RT_ELEMENTS(pSet->au32Bitmap) * 32) 98 return pfnOutput(pvArgOutput, "<full>", sizeof("<full>") - 1); 99 100 /* 101 * Print cpus that are present: {1,2,7,9 ... } 102 */ 103 size_t cchRet = pfnOutput(pvArgOutput, "{", 1); 104 105 cCpus = 0; 106 iCpu = 0; 107 while (iCpu < RT_ELEMENTS(pSet->au32Bitmap) * 32) 108 { 109 if (VMCPUSET_IS_PRESENT(pSet, iCpu)) 110 { 111 /* Output the first cpu number. */ 112 int off = 0; 113 if (cCpus != 0) 114 szTmp[off++] = ','; 115 off += vmmFormatTypeShortNumber(&szTmp[off], iCpu); 116 117 /* Check for sequence. */ 118 uint32_t const iStart = ++iCpu; 119 while ( iCpu < RT_ELEMENTS(pSet->au32Bitmap) * 32 120 && VMCPUSET_IS_PRESENT(pSet, iCpu)) 121 iCpu++; 122 if (iCpu != iStart) 123 { 124 szTmp[off++] = '-'; 125 off += vmmFormatTypeShortNumber(&szTmp[off], iCpu); 126 } 127 128 /* Terminate and output. */ 129 szTmp[off] = '\0'; 130 cchRet += pfnOutput(pvArgOutput, szTmp, off); 131 } 132 iCpu++; 133 } 134 135 cchRet += pfnOutput(pvArgOutput, "}", 1); 136 NOREF(pvUser); 137 return cchRet; 138 } 139 140 141 /** 142 * Registers the VMM wide format types. 143 * 144 * Called by VMMR3Init, VMMR0Init and VMMRCInit. 145 */ 146 int vmmInitFormatTypes(void) 147 { 148 int rc = VINF_SUCCESS; 149 if (ASMAtomicIncU32(&g_cFormatTypeUsers) == 1) 150 rc = RTStrFormatTypeRegister("vmcpuset", vmmFormatTypeVmCpuSet, NULL); 151 return rc; 152 } 153 154 155 #ifndef IN_RC 156 /** 157 * Counterpart to vmmInitFormatTypes, called by VMMR3Term and VMMR0Term. 158 */ 159 void vmmTermFormatTypes(void) 160 { 161 if (ASMAtomicDecU32(&g_cFormatTypeUsers) == 0) 162 RTStrFormatTypeDeregister("vmcpuset"); 163 } 164 #endif 30 165 31 166 … … 203 338 return pVM->vmm.s.enmSwitcher; 204 339 } 340 -
trunk/src/VBox/VMM/VMMR0/GVMMR0.cpp
r39078 r39303 56 56 #include <VBox/vmm/gvm.h> 57 57 #include <VBox/vmm/vm.h> 58 #include <VBox/vmm/vmcpuset.h> 58 59 #include <VBox/vmm/vmm.h> 59 60 #include <VBox/param.h> -
trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
r39152 r39303 107 107 108 108 /* 109 * Initialize the GVMM, GMM, HWACCM, PGM (Darwin) and INTNET.110 */ 111 int rc = GVMMR0Init();109 * Initialize the VMM, GVMM, GMM, HWACCM, PGM (Darwin) and INTNET. 110 */ 111 int rc = vmmInitFormatTypes(); 112 112 if (RT_SUCCESS(rc)) 113 113 { 114 rc = G MMR0Init();114 rc = GVMMR0Init(); 115 115 if (RT_SUCCESS(rc)) 116 116 { 117 rc = HWACCMR0Init();117 rc = GMMR0Init(); 118 118 if (RT_SUCCESS(rc)) 119 119 { 120 rc = PGMRegisterStringFormatTypes();120 rc = HWACCMR0Init(); 121 121 if (RT_SUCCESS(rc)) 122 122 { 123 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE 124 rc = PGMR0DynMapInit(); 125 #endif 123 rc = PGMRegisterStringFormatTypes(); 126 124 if (RT_SUCCESS(rc)) 127 125 { 128 rc = IntNetR0Init(); 126 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE 127 rc = PGMR0DynMapInit(); 128 #endif 129 129 if (RT_SUCCESS(rc)) 130 130 { 131 #ifdef VBOX_WITH_PCI_PASSTHROUGH 132 rc = PciRawR0Init(); 133 #endif 131 rc = IntNetR0Init(); 134 132 if (RT_SUCCESS(rc)) 135 133 { 136 rc = CPUMR0ModuleInit(); 134 #ifdef VBOX_WITH_PCI_PASSTHROUGH 135 rc = PciRawR0Init(); 136 #endif 137 137 if (RT_SUCCESS(rc)) 138 138 { 139 rc = CPUMR0ModuleInit(); 140 if (RT_SUCCESS(rc)) 141 { 139 142 #ifdef VBOX_WITH_TRIPLE_FAULT_HACK 140 rc = vmmR0TripleFaultHackInit(); 141 if (RT_SUCCESS(rc)) 142 #endif 143 { 144 LogFlow(("ModuleInit: returns success.\n")); 145 return VINF_SUCCESS; 143 rc = vmmR0TripleFaultHackInit(); 144 if (RT_SUCCESS(rc)) 145 #endif 146 { 147 LogFlow(("ModuleInit: returns success.\n")); 148 return VINF_SUCCESS; 149 } 150 151 /* 152 * Bail out. 153 */ 154 #ifdef VBOX_WITH_TRIPLE_FAULT_HACK 155 vmmR0TripleFaultHackTerm(); 156 #endif 146 157 } 147 148 /* 149 * Bail out. 150 */ 151 #ifdef VBOX_WITH_TRIPLE_FAULT_HACK 152 vmmR0TripleFaultHackTerm(); 158 #ifdef VBOX_WITH_PCI_PASSTHROUGH 159 PciRawR0Term(); 153 160 #endif 154 161 } 155 #ifdef VBOX_WITH_PCI_PASSTHROUGH 156 PciRawR0Term(); 157 #endif 162 IntNetR0Term(); 158 163 } 159 IntNetR0Term(); 164 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE 165 PGMR0DynMapTerm(); 166 #endif 160 167 } 161 #ifdef VBOX_WITH_2X_4GB_ADDR_SPACE 162 PGMR0DynMapTerm(); 163 #endif 168 PGMDeregisterStringFormatTypes(); 164 169 } 165 PGMDeregisterStringFormatTypes();170 HWACCMR0Term(); 166 171 } 167 HWACCMR0Term();172 GMMR0Term(); 168 173 } 169 GMMR0Term();170 } 171 GVMMR0Term();174 GVMMR0Term(); 175 } 176 vmmTermFormatTypes(); 172 177 } 173 178 … … 215 220 GMMR0Term(); 216 221 GVMMR0Term(); 222 223 vmmTermFormatTypes(); 217 224 218 225 LogFlow(("ModuleTerm: returns\n")); -
trunk/src/VBox/VMM/VMMR3/VMM.cpp
r39283 r39303 256 256 DBGFR3InfoRegisterInternal(pVM, "ff", "Displays the current Forced actions Flags.", vmmR3InfoFF); 257 257 vmmR3InitRegisterStats(pVM); 258 vmmInitFormatTypes(); 258 259 259 260 return VINF_SUCCESS; … … 767 768 } 768 769 #endif 770 771 vmmTermFormatTypes(); 769 772 return rc; 770 773 } -
trunk/src/VBox/VMM/include/VMMInternal.h
r38954 r39303 506 506 RT_C_DECLS_BEGIN 507 507 508 int vmmInitFormatTypes(void); 509 void vmmTermFormatTypes(void); 510 508 511 #ifdef IN_RING3 509 512 int vmmR3SwitcherInit(PVM pVM);
Note:
See TracChangeset
for help on using the changeset viewer.