VirtualBox

Changeset 37566 in vbox


Ignore:
Timestamp:
Jun 20, 2011 11:42:13 PM (13 years ago)
Author:
vboxsync
Message:

more testing, bugfixing and docs.

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  
    2626
    2727
     28#define RTMEM_WRAP_TO_EF_APIS
    2829/*******************************************************************************
    2930*   Header Files                                                               *
     
    173174    RTMemFree(pKernel->pachStrTab);
    174175    pKernel->pachStrTab = NULL;
     176
    175177    RTMemFree(pKernel->paSyms);
    176178    pKernel->paSyms = NULL;
     
    192194    RTMemFree(pKernel->pLoadCmds);
    193195    pKernel->pLoadCmds = NULL;
    194     RT_ZERO(pKernel->apSections);
     196    memset((void *)&pKernel->apSections[0], 0, sizeof(pKernel->apSections[0]) * MACHO_MAX_SECT);
    195197}
    196198
     
    230232
    231233
     234/* Rainy day: Find the right headers for these symbols ... if there are any. */
    232235extern "C" void ev_try_lock(void);
    233236extern "C" void OSMalloc(void);
    234237extern "C" void OSlibkernInit(void);
    235 extern "C" int osrelease;
    236 extern "C" int ostype;
     238extern "C" int  osrelease;
     239extern "C" int  ostype;
    237240extern "C" void kdp_set_interface(void);
    238241
     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 */
    239253static int rtR0DarwinMachKernelCheckStandardSymbols(PRTR0DARWINKERNEL pKernel)
    240254{
     
    804818
    805819
     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 */
    806829static int rtR0DarwinMachKernelOpen(const char *pszMachKernel, PRTR0DARWINKERNEL *ppHandle)
    807830{
     831    *ppHandle = NULL;
    808832    PRTR0DARWINKERNEL pKernel = (PRTR0DARWINKERNEL)RTMemAllocZ(sizeof(*pKernel));
    809833    if (!pKernel)
     
    822846
    823847    rtR0DarwinMachKernelLoadDone(pKernel);
    824     if (RT_FAILURE(rc))
     848    if (RT_SUCCESS(rc))
     849        *ppHandle = pKernel;
     850    else
    825851        rtR0DarwinMachKernelClose(pKernel);
    826852    return rc;
  • trunk/src/VBox/Runtime/testcase/tstRTDarwinMachKernel.cpp

    r37560 r37566  
    3939    PRTR0DARWINKERNEL pKernel;
    4040    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);
    4156}
    4257
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette