- Timestamp:
- Jan 26, 2007 12:48:25 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/recompiler/new/VBoxREMWrapper.cpp
r133 r340 158 158 * use calling convention wrappers. 159 159 */ 160 #if defined(__WIN64__) || defined(__DOXYGEN__)160 #if (defined(__AMD64__) && defined(__WIN__)) || defined(__DOXYGEN__) 161 161 # 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 162 170 #endif 163 171 … … 1002 1010 1003 1011 1004 # if def USE_REM_CALLING_CONVENTION_GLUE1012 # if defined(USE_REM_CALLING_CONVENTION_GLUE) || defined(USE_REM_IMPORT_JUMP_GLUE) 1005 1013 /** LIFO of read-write-executable memory chunks used for wrappers. */ 1006 1014 static PREMEXECMEM g_pExecMemHead; … … 1040 1048 1041 1049 1042 # if def USE_REM_CALLING_CONVENTION_GLUE1050 # if defined(USE_REM_CALLING_CONVENTION_GLUE) || defined(USE_REM_IMPORT_JUMP_GLUE) 1043 1051 /** 1044 1052 * Allocates a block of memory for glue code. … … 1074 1082 return memset((uint8_t *)pCur + RT_ALIGN_Z(sizeof(*pCur), 32), 0xcc, cbAligned); 1075 1083 } 1076 1077 1084 # endif /* USE_REM_CALLING_CONVENTION_GLUE || USE_REM_IMPORT_JUMP_GLUE */ 1085 1086 1087 # ifdef USE_REM_CALLING_CONVENTION_GLUE 1078 1088 /** 1079 1089 * Checks if a function is all straight forward integers. … … 1321 1331 static int remGenerateImportGlue(PRTUINTPTR pValue, PREMFNDESC pDesc) 1322 1332 { 1323 # if def USE_REM_CALLING_CONVENTION_GLUE1333 # if defined(USE_REM_CALLING_CONVENTION_GLUE) || defined(USE_REM_IMPORT_JUMP_GLUE) 1324 1334 if (!pDesc->pvWrapper) 1325 1335 { 1336 # ifdef USE_REM_CALLING_CONVENTION_GLUE 1326 1337 if (remIsFunctionAllInts(pDesc)) 1327 1338 { … … 1382 1393 #endif 1383 1394 } 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 */ 1384 1418 } 1385 1419 *pValue = (uintptr_t)pDesc->pvWrapper; 1386 1387 1420 # else /* !USE_REM_CALLING_CONVENTION_GLUE */ 1388 1421 *pValue = (uintptr_t)pDesc->pv; … … 1495 1528 for (i = 0; i < ELEMENTS(g_aExports); i++) 1496 1529 *(void **)g_aExports[i].pv = NULL; 1497 # if def USE_REM_CALLING_CONVENTION_GLUE1530 # if defined(USE_REM_CALLING_CONVENTION_GLUE) || defined(USE_REM_IMPORT_JUMP_GLUE) 1498 1531 for (i = 0; i < ELEMENTS(g_aVMMImports); i++) 1499 1532 g_aVMMImports[i].pvWrapper = NULL;
Note:
See TracChangeset
for help on using the changeset viewer.