VirtualBox

Changeset 43055 in vbox


Ignore:
Timestamp:
Aug 28, 2012 11:50:20 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
80390
Message:

VBoxTpG.cpp: Fix for 32-bit mac KEXTs.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Config.kmk

    r43019 r43055  
    29792979
    29802980TEMPLATE_VBoxR0_USES               += dtrace
     2981TEMPLATE_VBoxR0_DTRACE_HDR_FLAGS    = --ring-0-context-agnostic
     2982TEMPLATE_VBoxR0_DTRACE_OBJ_FLAGS    = --ring-0-context-agnostic
    29812983ifdef VBOX_WITH_DTRACE_R0
    29822984 TEMPLATE_VBoxR0_DTRACETOOL         = VBoxTpG
  • trunk/src/bldprogs/VBoxTpG.cpp

    r41362 r43055  
    144144static uint32_t             g_fTypeContext              = VTG_TYPE_CTX_R0;
    145145static const char          *g_pszContextDefine          = "IN_RING0";
     146static const char          *g_pszContextDefine2         = NULL;
    146147static bool                 g_fApplyCpp                 = false;
    147148static uint32_t             g_cVerbosity                = 0;
     
    297298    apszArgs[iArg++] = g_pszAssemblerDefOpt;
    298299    apszArgs[iArg++] = g_pszContextDefine;
     300    if (g_pszContextDefine2)
     301    {
     302        apszArgs[iArg++] = g_pszAssemblerDefOpt;
     303        apszArgs[iArg++] = g_pszContextDefine2;
     304    }
    299305    if (g_szAssemblerOsDef[0])
    300306    {
     
    310316    apszArgs[iArg++] = pszTempAsm;
    311317    apszArgs[iArg]   = NULL;
     318    Assert(iArg <= RT_ELEMENTS(apszArgs));
    312319
    313320    if (g_cVerbosity > 1)
     
    458465                    "  NAME(%%1):\n"
    459466                    " %%endmacro\n"
    460                     " ; Section order hack!\n"
    461                     " ; With the ld64-97.17 linker there was a problem with it determin the section\n"
    462                     " ; order based on symbol references. The references to the start and end of the\n"
    463                     " ; __VTGPrLc section forced it in front of __VTGObj.\n"
    464                     " extern section$start$__VTG$__VTGObj\n"
    465                     " extern section$end$__VTG$__VTGObj\n"
    466                     " [section __VTG __VTGObj        align=1024]\n"
     467                    "  %%ifdef IN_RING3\n"
     468                    "   %%define VTG_NEW_MACHO_LINKER\n"
     469                    "  %%elif ARCH_BITS == 64\n"
     470                    "   %%define VTG_NEW_MACHO_LINKER\n"
     471                    "  %%elifdef IN_RING0_AGNOSTIC\n"
     472                    "   %%define VTG_NEW_MACHO_LINKER\n"
     473                    "  %%endif\n"
     474                    " %%ifdef VTG_NEW_MACHO_LINKER\n"
     475                    "  ; Section order hack!\n"
     476                    "  ; With the ld64-97.17 linker there was a problem with it determining the section\n"
     477                    "  ; order based on symbol references. The references to the start and end of the\n"
     478                    "  ; __VTGPrLc section forced it in front of __VTGObj, we want __VTGObj first.\n"
     479                    "  extern section$start$__VTG$__VTGObj\n"
     480                    "  extern section$end$__VTG$__VTGObj\n"
     481                    " %%else\n"
     482                    "  ; Creating 32-bit kext of the type MH_OBJECT. No fancy section end/start symbols handy.\n"
     483                    "  [section __VTG __VTGObj        align=16]\n"
     484                    "VTG_GLOBAL g_aVTGObj_LinkerPleaseNoticeMe, data\n"
     485                    "  [section __VTG __VTGPrLc.Begin align=16]\n"
     486                    "VTG_GLOBAL g_aVTGPrLc, data\n"
     487                    "  [section __VTG __VTGPrLc align=16]\n"
     488                    "VTG_GLOBAL g_aVTGPrLc_LinkerPleaseNoticeMe, data\n"
     489                    "  [section __VTG __VTGPrLc.End   align=16]\n"
     490                    "VTG_GLOBAL g_aVTGPrLc_End, data\n"
     491                    " %%endif\n"
     492                    " [section __VTG __VTGObj]\n"
    467493                    "\n"
    468494                    "%%elifdef ASM_FORMAT_PE\n"
     
    518544                    "    dd          0\n"
    519545                    "    dd          0\n"
    520                     "%%ifdef ASM_FORMAT_MACHO ; Apple has a real decent linker!\n"
    521                     "extern section$start$__VTG$__VTGPrLc\n"
     546                    "%%ifdef VTG_NEW_MACHO_LINKER\n"
     547                    " extern section$start$__VTG$__VTGPrLc\n"
    522548                    "    RTCCPTR_DEF section$start$__VTG$__VTGPrLc\n"
    523549                    " %%if ARCH_BITS == 32\n"
    524550                    "    dd          0\n"
    525551                    " %%endif\n"
    526                     "extern section$end$__VTG$__VTGPrLc\n"
     552                    " extern section$end$__VTG$__VTGPrLc\n"
    527553                    "    RTCCPTR_DEF section$end$__VTG$__VTGPrLc\n"
    528554                    " %%if ARCH_BITS == 32\n"
     
    547573    ScmStreamPrintf(pStrm,
    548574                    "    dd 0%08xh, 0%08xh, 0%08xh, 0%08xh\n"
    549                     "%%ifdef ASM_FORMAT_MACHO\n"
     575                    "%%ifdef VTG_NEW_MACHO_LINKER\n"
    550576                    "    RTCCPTR_DEF section$start$__VTG$__VTGObj\n"
    551577                    " %%if ARCH_BITS == 32\n"
     
    21782204        kVBoxTpGOpt_RawModeContext,
    21792205        kVBoxTpGOpt_Ring0Context,
     2206        kVBoxTpGOpt_Ring0ContextAgnostic,
    21802207        kVBoxTpGOpt_Ring3Context,
    21812208        kVBoxTpGOpt_End
     
    22082235        { "--raw-mode-context",                 kVBoxTpGOpt_RawModeContext,             RTGETOPT_REQ_NOTHING },
    22092236        { "--ring-0-context",                   kVBoxTpGOpt_Ring0Context,               RTGETOPT_REQ_NOTHING },
     2237        { "--ring-0-context-agnostic",          kVBoxTpGOpt_Ring0ContextAgnostic,       RTGETOPT_REQ_NOTHING },
    22102238        { "--ring-3-context",                   kVBoxTpGOpt_Ring3Context,               RTGETOPT_REQ_NOTHING },
    22112239        /** @todo We're missing a bunch of assembler options! */
     
    23652393                g_fTypeContext = VTG_TYPE_CTX_RC;
    23662394                g_pszContextDefine = "IN_RC";
     2395                g_pszContextDefine2 = NULL;
    23672396                break;
    23682397
     
    23702399                g_fTypeContext = VTG_TYPE_CTX_R0;
    23712400                g_pszContextDefine = "IN_RING0";
     2401                g_pszContextDefine2 = NULL;
     2402                break;
     2403
     2404            case kVBoxTpGOpt_Ring0ContextAgnostic:
     2405                g_fTypeContext = VTG_TYPE_CTX_R0;
     2406                g_pszContextDefine = "IN_RING0_AGNOSTIC";
     2407                g_pszContextDefine2 = "IN_RING0";
    23722408                break;
    23732409
     
    23752411                g_fTypeContext = VTG_TYPE_CTX_R3;
    23762412                g_pszContextDefine = "IN_RING3";
     2413                g_pszContextDefine2 = NULL;
    23772414                break;
    23782415
Note: See TracChangeset for help on using the changeset viewer.

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