Changeset 37566 in vbox
- Timestamp:
- Jun 20, 2011 11:42:13 PM (13 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/darwin/mach_kernel-r0drv-darwin.cpp
r37565 r37566 26 26 27 27 28 #define RTMEM_WRAP_TO_EF_APIS 28 29 /******************************************************************************* 29 30 * Header Files * … … 173 174 RTMemFree(pKernel->pachStrTab); 174 175 pKernel->pachStrTab = NULL; 176 175 177 RTMemFree(pKernel->paSyms); 176 178 pKernel->paSyms = NULL; … … 192 194 RTMemFree(pKernel->pLoadCmds); 193 195 pKernel->pLoadCmds = NULL; 194 RT_ZERO(pKernel->apSections);196 memset((void *)&pKernel->apSections[0], 0, sizeof(pKernel->apSections[0]) * MACHO_MAX_SECT); 195 197 } 196 198 … … 230 232 231 233 234 /* Rainy day: Find the right headers for these symbols ... if there are any. */ 232 235 extern "C" void ev_try_lock(void); 233 236 extern "C" void OSMalloc(void); 234 237 extern "C" void OSlibkernInit(void); 235 extern "C" int osrelease;236 extern "C" int ostype;238 extern "C" int osrelease; 239 extern "C" int ostype; 237 240 extern "C" void kdp_set_interface(void); 238 241 242 243 /** 244 * Check the symbol table against symbols we known symbols. 245 * 246 * This is done to detect whether the on disk image and the in 247 * memory images matches. Mismatches could stem from user 248 * replacing the default kernel image on disk. 249 * 250 * @returns IPRT status code. 251 * @param pKernel The internal scratch data. 252 */ 239 253 static int rtR0DarwinMachKernelCheckStandardSymbols(PRTR0DARWINKERNEL pKernel) 240 254 { … … 804 818 805 819 820 /** 821 * Opens symbol table of the mach_kernel. 822 * 823 * @returns IPRT status code. 824 * @param pszMachKernel The path to the mach_kernel image. 825 * @param ppHandle Where to return a handle on success. 826 * Call rtR0DarwinMachKernelClose on it 827 * when done. 828 */ 806 829 static int rtR0DarwinMachKernelOpen(const char *pszMachKernel, PRTR0DARWINKERNEL *ppHandle) 807 830 { 831 *ppHandle = NULL; 808 832 PRTR0DARWINKERNEL pKernel = (PRTR0DARWINKERNEL)RTMemAllocZ(sizeof(*pKernel)); 809 833 if (!pKernel) … … 822 846 823 847 rtR0DarwinMachKernelLoadDone(pKernel); 824 if (RT_FAILURE(rc)) 848 if (RT_SUCCESS(rc)) 849 *ppHandle = pKernel; 850 else 825 851 rtR0DarwinMachKernelClose(pKernel); 826 852 return rc; -
trunk/src/VBox/Runtime/testcase/tstRTDarwinMachKernel.cpp
r37560 r37566 39 39 PRTR0DARWINKERNEL pKernel; 40 40 RTTESTI_CHECK_RC_RETV(rtR0DarwinMachKernelOpen(pszMachKernel, &pKernel), VINF_SUCCESS); 41 static const char * const s_apszSyms[] = 42 { 43 "ast_pending", 44 "i386_signal_cpu", 45 "i386_cpu_IPI", 46 "dtrace_register", 47 "dtrace_suspend", 48 }; 49 for (unsigned i = 0; i < RT_ELEMENTS(s_apszSyms); i++) 50 { 51 uintptr_t uPtr = rtR0DarwinMachKernelLookup(pKernel, s_apszSyms[i]); 52 RTTestIPrintf(RTTESTLVL_ALWAYS, "%p %s\n", uPtr, s_apszSyms[i]); 53 RTTESTI_CHECK(uPtr != 0); 54 } 55 rtR0DarwinMachKernelClose(pKernel); 41 56 } 42 57
Note:
See TracChangeset
for help on using the changeset viewer.