- Timestamp:
- Jan 2, 2015 12:34:34 PM (10 years ago)
- Location:
- trunk/src/VBox/ExtPacks/VBoxDTrace
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/ExtPacks/VBoxDTrace/VBoxDTraceR0/VBoxDTraceR0.cpp
r53672 r53675 886 886 /** The configured resource base. */ 887 887 uint32_t uBase; 888 /** The configured resource end (base included). */889 uint32_t uEnd;888 /** The configured max number of items. */ 889 uint32_t cMaxItems; 890 890 /** The size of the apChunks array. */ 891 891 uint32_t cMaxChunks; … … 910 910 */ 911 911 AssertMsgReturn((uintptr_t)pvBase <= UINT32_MAX, ("%p\n", pvBase), NULL); 912 AssertMsgReturn(cb <= UINT32_MAX, ("%zu\n", cb), NULL); 912 913 AssertMsgReturn((uintptr_t)pvBase + cb - 1 <= UINT32_MAX, ("%p %zu\n", pvBase, cb), NULL); 913 914 AssertMsgReturn(cbUnit == 1, ("%zu\n", cbUnit), NULL); … … 922 923 * Allocate the instance. 923 924 */ 924 uint32_t cChunks = (uint32_t)(cb - (uintptr_t)pvBase);925 cChunks += VBOXDTVMEMCHUNK_BITS - 1;926 cChunks /= VBOXDTVMEMCHUNK_BITS;925 uint32_t cChunks = cb / VBOXDTVMEMCHUNK_BITS; 926 if (cb % VBOXDTVMEMCHUNK_BITS) 927 cChunks++; 927 928 PVBOXDTVMEM pThis = (PVBOXDTVMEM)RTMemAllocZ(RT_OFFSETOF(VBOXDTVMEM, apChunks[cChunks])); 928 929 if (!pThis) … … 938 939 pThis->cCurChunks = 0; 939 940 pThis->uBase = (uint32_t)(uintptr_t)pvBase; 940 pThis-> uEnd= (uint32_t)cb;941 pThis->cMaxItems = (uint32_t)cb; 941 942 pThis->cMaxChunks = cChunks; 942 943 … … 1024 1025 /* Out of resources? */ 1025 1026 if (cChunks >= pThis->cMaxChunks) 1026 {1027 SUPR0Printf("cChunks=%u cMaxChunks=%u!!\n", cChunks, pThis->cMaxChunks);1028 1027 break; 1029 }1030 1028 1031 1029 /* … … 1034 1032 uint32_t const iFirstBit = cChunks > 0 ? pThis->apChunks[cChunks - 1]->iFirst + VBOXDTVMEMCHUNK_BITS : 0; 1035 1033 uint32_t const cFreeBits = cChunks + 1 == pThis->cMaxChunks 1036 ? pThis-> uEnd - pThis->uBase - iFirstBit1034 ? pThis->cMaxItems - (iFirstBit - pThis->uBase) 1037 1035 : VBOXDTVMEMCHUNK_BITS; 1038 1036 Assert(cFreeBits <= VBOXDTVMEMCHUNK_BITS); … … 1042 1040 pChunk = (PVBOXDTVMEMCHUNK)RTMemAllocZ(sizeof(*pChunk)); 1043 1041 if (!pChunk) 1044 {1045 SUPR0Printf("returning NULL!!\n");1046 1042 return NULL; 1047 }1048 1043 1049 1044 SUPR0Printf("Adding chunk %p at bit %u, covering %u bits\n", pChunk, iFirstBit, cFreeBits); … … 1099 1094 uint32_t uMem = (uint32_t)(uintptr_t)pvMem; 1100 1095 AssertReturnVoid(uMem >= pThis->uBase); 1101 AssertReturnVoid(uMem < pThis->uEnd);1102 1103 1096 uMem -= pThis->uBase; 1097 AssertReturnVoid(uMem < pThis->cMaxItems); 1098 1104 1099 1105 1100 /* -
trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dtrace.c
r53674 r53675 12565 12565 (void) snprintf(c, sizeof (c), "dtrace_aggid_%p", state); 12566 12566 #endif 12567 #ifndef VBOX /* Avoid idProbe = UINT32_MAX as it is used as invalid value by VTG. */ 12567 12568 state->dts_aggid_arena = vmem_create(c, (void *)1, UINT32_MAX, 1, 12568 12569 NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER); 12570 #else 12571 state->dts_aggid_arena = vmem_create(c, (void *)1, _1G, 1, 12572 NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER); 12573 #endif 12569 12574 12570 12575 #ifndef VBOX … … 14868 14873 ASSERT(MUTEX_HELD(&cpu_lock)); 14869 14874 14875 #ifndef VBOX /* Reduce the area a bit just to be sure our vmem fake doesn't blow up. */ 14870 14876 dtrace_arena = vmem_create("dtrace", (void *)1, UINT32_MAX, 1, 14871 14877 NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER); 14878 #else 14879 dtrace_arena = vmem_create("dtrace", (void *)1, UINT32_MAX - 16, 1, 14880 NULL, NULL, NULL, 0, VM_SLEEP | VMC_IDENTIFIER); 14881 #endif 14872 14882 #ifndef VBOX 14873 14883 dtrace_minor = vmem_create("dtrace_minor", (void *)DTRACEMNRN_CLONE,
Note:
See TracChangeset
for help on using the changeset viewer.