VirtualBox

Changeset 41052 in vbox


Ignore:
Timestamp:
Apr 25, 2012 3:01:48 PM (13 years ago)
Author:
vboxsync
Message:

Deal with 10.8 being PIE and not loaded at the link address.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r0drv/darwin/dbgkrnlinfo-r0drv-darwin.cpp

    r41050 r41052  
    145145    /** The file offset of the symbol table. */
    146146    uint32_t            offSyms;
     147    /** Offset between link address and actual load address. */
     148    uintptr_t           offLoad;
    147149    /** @} */
    148150
     
    359361 * Looks up a kernel symbol.
    360362 *
    361  *
    362363 * @returns The symbol address on success, 0 on failure.
    363364 * @param   pThis               The internal scratch data.
     
    380381        if (   *pszTabName == '_'
    381382            && strcmp(pszTabName + 1, pszSymbol) == 0)
    382             return pSym->n_value;
     383            return pSym->n_value + pThis->offLoad;
    383384    }
    384385#else
     
    524525        KNOWN_ENTRY(vm_map_wire),
    525526        KNOWN_ENTRY(PE_kputc),
     527        KNOWN_ENTRY(kernel_map),
     528        KNOWN_ENTRY(kernel_pmap),
    526529    };
    527530
     
    10371040        rc = rtR0DbgKrnlDarwinLoadSymTab(pThis);
    10381041    if (RT_SUCCESS(rc))
     1042    {
     1043#ifdef IN_RING0
     1044        /*
     1045         * Determine the load displacement (10.8 kernels are PIE).
     1046         */
     1047        uintptr_t uLinkAddr = rtR0DbgKrnlDarwinLookup(pThis, "kernel_map");
     1048        if (uLinkAddr != 0)
     1049            pThis->offLoad = (uintptr_t)&kernel_map - uLinkAddr;
     1050#endif
    10391051        rc = rtR0DbgKrnlDarwinCheckStandardSymbols(pThis);
     1052    }
    10401053
    10411054    rtR0DbgKrnlDarwinLoadDone(pThis);
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