VirtualBox

Changeset 340 in vbox for trunk


Ignore:
Timestamp:
Jan 26, 2007 12:48:25 AM (18 years ago)
Author:
vboxsync
Message:

Import jump glue is required for GCC on Linux/GNU.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/recompiler/new/VBoxREMWrapper.cpp

    r133 r340  
    158158 * use calling convention wrappers.
    159159 */
    160 #if defined(__WIN64__) || defined(__DOXYGEN__)
     160#if (defined(__AMD64__) && defined(__WIN__)) || defined(__DOXYGEN__)
    161161# define USE_REM_CALLING_CONVENTION_GLUE
     162#endif
     163
     164/** @def USE_REM_IMPORT_JUMP_GLUE
     165 * Define USE_REM_IMPORT_JUMP_GLUE for platforms where we need to
     166 * emit some jump glue to deal with big addresses.
     167 */
     168#if (defined(__AMD64__) && !defined(USE_REM_CALLING_CONVENTION_GLUE) && !defined(__DARWIN__)) || defined(__DOXYGEN__)
     169# define USE_REM_IMPORT_JUMP_GLUE
    162170#endif
    163171
     
    10021010
    10031011
    1004 # ifdef USE_REM_CALLING_CONVENTION_GLUE
     1012# if defined(USE_REM_CALLING_CONVENTION_GLUE) || defined(USE_REM_IMPORT_JUMP_GLUE)
    10051013/** LIFO of read-write-executable memory chunks used for wrappers. */
    10061014static PREMEXECMEM g_pExecMemHead;
     
    10401048
    10411049
    1042 # ifdef USE_REM_CALLING_CONVENTION_GLUE
     1050# if defined(USE_REM_CALLING_CONVENTION_GLUE) || defined(USE_REM_IMPORT_JUMP_GLUE)
    10431051/**
    10441052 * Allocates a block of memory for glue code.
     
    10741082    return memset((uint8_t *)pCur + RT_ALIGN_Z(sizeof(*pCur), 32), 0xcc, cbAligned);
    10751083}
    1076 
    1077 
     1084# endif /* USE_REM_CALLING_CONVENTION_GLUE || USE_REM_IMPORT_JUMP_GLUE */
     1085
     1086
     1087# ifdef USE_REM_CALLING_CONVENTION_GLUE
    10781088/**
    10791089 * Checks if a function is all straight forward integers.
     
    13211331static int remGenerateImportGlue(PRTUINTPTR pValue, PREMFNDESC pDesc)
    13221332{
    1323 # ifdef USE_REM_CALLING_CONVENTION_GLUE
     1333# if defined(USE_REM_CALLING_CONVENTION_GLUE) || defined(USE_REM_IMPORT_JUMP_GLUE)
    13241334    if (!pDesc->pvWrapper)
    13251335    {
     1336#  ifdef USE_REM_CALLING_CONVENTION_GLUE
    13261337        if (remIsFunctionAllInts(pDesc))
    13271338        {
     
    13821393#endif
    13831394        }
     1395#  else  /* !USE_REM_CALLING_CONVENTION_GLUE */
     1396
     1397        /*
     1398         * Generate a jump patch.
     1399         */
     1400        uint8_t *pb;
     1401#   ifdef __AMD64__
     1402        pDesc->pvWrapper = pb = (uint8_t *)remAllocGlue(32);
     1403        AssertReturn(pDesc->pvWrapper, VERR_NO_MEMORY);
     1404        *pb++ = 0xcc;
     1405        *pb++ = 0xff;
     1406        *pb++ = 0x24;
     1407        *pb++ = 0x25;
     1408        *(uint32_t *)pb = (uintptr_t)pb + 5;
     1409        pb += 5;
     1410        *(uint64_t *)pb = (uint64_t)pDesc->pv;
     1411#   else
     1412        pDesc->pvWrapper = pb = (uint8_t *)remAllocGlue(8);
     1413        AssertReturn(pDesc->pvWrapper, VERR_NO_MEMORY);
     1414        *pb++ = 0xea;
     1415        *(uint32_t *)pb = (uint32_t)pDesc->pv;
     1416#   endif
     1417#  endif /* !USE_REM_CALLING_CONVENTION_GLUE */
    13841418    }
    13851419    *pValue = (uintptr_t)pDesc->pvWrapper;
    1386 
    13871420# else  /* !USE_REM_CALLING_CONVENTION_GLUE */
    13881421    *pValue = (uintptr_t)pDesc->pv;
     
    14951528    for (i = 0; i < ELEMENTS(g_aExports); i++)
    14961529        *(void **)g_aExports[i].pv = NULL;
    1497 # ifdef USE_REM_CALLING_CONVENTION_GLUE
     1530# if defined(USE_REM_CALLING_CONVENTION_GLUE) || defined(USE_REM_IMPORT_JUMP_GLUE)
    14981531    for (i = 0; i < ELEMENTS(g_aVMMImports); i++)
    14991532        g_aVMMImports[i].pvWrapper = NULL;
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