VirtualBox

Changeset 101193 in vbox


Ignore:
Timestamp:
Sep 20, 2023 12:53:00 PM (15 months ago)
Author:
vboxsync
Message:

VMM/IEM: Some libunwind/darwin adjustments. bugref:10370

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompiler.cpp

    r101181 r101193  
    6666#else
    6767# include <iprt/formats/dwarf.h>
    68 extern "C" void __register_frame_info(void *begin, void *ob); /* found no header for these two */
     68# if defined(RT_OS_DARWIN)
     69#  define IEMNATIVE_USE_LIBUNWIND
     70extern "C" void  __register_frame(const void *pvFde);
     71extern "C" void  __deregister_frame(const void *pvFde);
     72# else
     73extern "C" void  __register_frame_info(void *pvBegin, void *pvObj); /* found no header for these two */
     74extern "C" void *__deregister_frame_info(void *pvBegin);           /* (returns pvObj from __register_frame_info call) */
     75# endif
    6976#endif
    7077
     
    160167typedef struct IEMEXECMEMCHUNKEHFRAME
    161168{
     169# ifdef IEMNATIVE_USE_LIBUNWIND
     170    /** The offset of the FDA into abEhFrame. */
     171    uintptr_t               offFda;
     172# else
    162173    /** struct object storage area. */
    163174    uint8_t                 abObject[1024];
     175# endif
    164176    /** The dwarf ehframe data for the chunk. */
    165177    uint8_t                 abEhFrame[512];
     
    435447     * Generate the CIE first.
    436448     */
     449#ifdef IEMNATIVE_USE_LIBUNWIND /* libunwind (llvm, darwin) only supports v1 and v3. */
     450    uint8_t const iDwarfVer = 3;
     451#else
     452    uint8_t const iDwarfVer = 4;
     453#endif
    437454    RTPTRUNION const PtrCie = Ptr;
    438455    *Ptr.pu32++ = 123;                                      /* The CIE length will be determined later. */
    439456    *Ptr.pu32++ = 0 /*UINT32_MAX*/;                         /* I'm a CIE in .eh_frame speak. */
    440     *Ptr.pb++   = 4;                                        /* DwARF v4. */
     457    *Ptr.pb++   = iDwarfVer;                                /* DwARF version */
    441458    *Ptr.pb++   = 0;                                        /* Augmentation. */
    442     *Ptr.pb++   = sizeof(uintptr_t);                        /* Address size. */
    443     *Ptr.pb++   = 0;                                        /* Segment selector size. */
     459    if (iDwarfVer >= 4)
     460    {
     461        *Ptr.pb++   = sizeof(uintptr_t);                    /* Address size. */
     462        *Ptr.pb++   = 0;                                    /* Segment selector size. */
     463    }
    444464    Ptr = iemDwarfPutLeb128(Ptr, 1);                        /* Code alignment factor (LEB128 = 1). */
    445465    Ptr = iemDwarfPutLeb128(Ptr, -8);                       /* Data alignment factor (LEB128 = -8). */
     
    462482     * Generate an FDE for the whole chunk area.
    463483     */
     484#ifdef IEMNATIVE_USE_LIBUNWIND
     485    pEhFrame->offFda = Ptr.u - (uintptr_t)&pEhFrame->abEhFrame[0];
     486#endif
    464487    RTPTRUNION const PtrFde = Ptr;
    465488    *Ptr.pu32++ = 123;                                      /* The CIE length will be determined later. */
     
    573596            {
    574597                iemExecMemAllocatorInitEhFrameForChunk(pExecMemAllocator, pEhFrame, pvChunk);
     598#  ifdef IEMNATIVE_USE_LIBUNWIND
     599                __register_frame(&pEhFrame->abEhFrame[pEhFrame->offFda]);
     600#  else
    575601                memset(pEhFrame->abObject, 0xf6, sizeof(pEhFrame->abObject)); /* color the memory to better spot usage */
    576602                __register_frame_info(pEhFrame->abEhFrame, pEhFrame->abObject);
     603#  endif
    577604            }
    578605            else
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