Changeset 27800 in vbox for trunk/src/VBox/Runtime/common/log/log.cpp
- Timestamp:
- Mar 29, 2010 7:56:26 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 59459
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/log/log.cpp
r25899 r27800 293 293 RTLogGroupSettings(pLogger, pszGroupSettings); 294 294 295 #if defined(RT_ARCH_X86) && (!defined(LOG_USE_C99) || !defined(RT_WITHOUT_EXEC_ALLOC)) 295 296 /* 296 297 * Emit wrapper code. 297 298 */ 298 #if defined(LOG_USE_C99) && defined(RT_WITHOUT_EXEC_ALLOC)299 pu8Code = (uint8_t *)RTMemAlloc(64);300 #else301 299 pu8Code = (uint8_t *)RTMemExecAlloc(64); 302 #endif303 300 if (pu8Code) 304 301 { 305 302 pLogger->pfnLogger = *(PFNRTLOGGER*)&pu8Code; 306 #if defined(RT_ARCH_AMD64) || (defined(LOG_USE_C99) && defined(RT_WITHOUT_EXEC_ALLOC))307 /* this wrapper will not be used on AMD64, we will be requiring C99 compilers there. */308 *pu8Code++ = 0xcc;309 #else310 303 *pu8Code++ = 0x68; /* push imm32 */ 311 304 *(void **)pu8Code = pLogger; … … 319 312 *pu8Code++ = 0x04; 320 313 *pu8Code++ = 0xc3; /* ret near */ 321 #endif322 314 AssertMsg((uintptr_t)pu8Code - (uintptr_t)pLogger->pfnLogger <= 64, 323 315 ("Wrapper assembly is too big! %d bytes\n", (uintptr_t)pu8Code - (uintptr_t)pLogger->pfnLogger)); 324 325 316 rc = VINF_SUCCESS; 317 } 318 else 319 { 320 # ifdef RT_OS_LINUX 321 if (pszErrorMsg) /* Most probably SELinux causing trouble since the larger RTMemAlloc succeeded. */ 322 RTStrPrintf(pszErrorMsg, cchErrorMsg, "mmap(PROT_WRITE | PROT_EXEC) failed -- SELinux?"); 323 # endif 324 rc = VERR_NO_MEMORY; 325 } 326 if (RT_SUCCESS(rc)) 327 #endif /* X86 wrapper code*/ 328 { 326 329 #ifdef IN_RING3 /* files and env.vars. are only accessible when in R3 at the present time. */ 327 330 /* … … 435 438 RTMemExecFree(*(void **)&pLogger->pfnLogger); 436 439 #endif 437 }438 else439 {440 #ifdef RT_OS_LINUX441 /*442 * RTMemAlloc() succeeded but RTMemExecAlloc() failed -- most probably an SELinux problem.443 */444 if (pszErrorMsg)445 RTStrPrintf(pszErrorMsg, cchErrorMsg, "mmap(PROT_WRITE | PROT_EXEC) failed -- SELinux?");446 #endif /* RT_OS_LINUX */447 rc = VERR_NO_MEMORY;448 440 } 449 441 RTMemFree(pLogger);
Note:
See TracChangeset
for help on using the changeset viewer.