summaryrefslogtreecommitdiff
path: root/src/VBox/HostDrivers/Support/SUPDrvTracer.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-03-26 19:21:20 +0000
committer <>2014-05-08 15:03:54 +0000
commitfb123f93f9f5ce42c8e5785d2f8e0edaf951740e (patch)
treec2103d76aec5f1f10892cd1d3a38e24f665ae5db /src/VBox/HostDrivers/Support/SUPDrvTracer.cpp
parent58ed4748338f9466599adfc8a9171280ed99e23f (diff)
downloadVirtualBox-master.tar.gz
Imported from /home/lorry/working-area/delta_VirtualBox/VirtualBox-4.3.10.tar.bz2.HEADVirtualBox-4.3.10master
Diffstat (limited to 'src/VBox/HostDrivers/Support/SUPDrvTracer.cpp')
-rw-r--r--src/VBox/HostDrivers/Support/SUPDrvTracer.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/VBox/HostDrivers/Support/SUPDrvTracer.cpp b/src/VBox/HostDrivers/Support/SUPDrvTracer.cpp
index 45c622ef..373b2693 100644
--- a/src/VBox/HostDrivers/Support/SUPDrvTracer.cpp
+++ b/src/VBox/HostDrivers/Support/SUPDrvTracer.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2012 Oracle Corporation
+ * Copyright (C) 2012-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -345,7 +345,9 @@ static int supdrvVtgValidateHdr(PVTGOBJHDR pVtgHdr, RTUINTPTR uVtgHdrAddr, const
#ifdef RT_OS_DARWIN
/* The loader and/or ld64-97.17 seems not to generate fixups for our
__VTGObj section. Detect this by comparing them with the
- u64VtgObjSectionStart member and assume max image size of 4MB. */
+ u64VtgObjSectionStart member and assume max image size of 4MB.
+ Seems to be worked around by the __VTGPrLc.End and __VTGPrLc.Begin
+ padding fudge, meaning that the linker misplaced the relocations. */
if ( (int64_t)u64Tmp != (int32_t)u64Tmp
&& pVtgHdr->u64VtgObjSectionStart != uVtgHdrAddr
&& pVtgHdr->u64VtgObjSectionStart < _4M
@@ -635,7 +637,6 @@ static int supdrvVtgValidate(PVTGOBJHDR pVtgHdr, RTUINTPTR uVtgHdrAddr, const ui
MY_CHECK_RET(paProbeLocs[i].uLine < _1G, VERR_SUPDRV_VTG_BAD_PROBE_LOC);
MY_CHECK_RET(paProbeLocs[i].fEnabled == false, VERR_SUPDRV_VTG_BAD_PROBE_LOC);
MY_CHECK_RET(paProbeLocs[i].idProbe == 0, VERR_SUPDRV_VTG_BAD_PROBE_LOC);
- MY_WITHIN_IMAGE(paProbeLocs[i].pszFunction, VERR_SUPDRV_VTG_BAD_PROBE_LOC);
offTmp = (uintptr_t)paProbeLocs[i].pProbe - (uintptr_t)pVtgHdr->offProbes - (uintptr_t)pVtgHdr;
#ifdef RT_OS_DARWIN /* See header validation code. */
if ( offTmp >= pVtgHdr->cbProbes
@@ -645,12 +646,17 @@ static int supdrvVtgValidate(PVTGOBJHDR pVtgHdr, RTUINTPTR uVtgHdrAddr, const ui
&& !fUmod )
{
uint64_t offDelta = uVtgHdrAddr - pVtgHdr->u64VtgObjSectionStart;
+
paProbeLocs[i].pProbe = (PVTGDESCPROBE)((uintptr_t)paProbeLocs[i].pProbe + offDelta);
+ if ((uintptr_t)paProbeLocs[i].pszFunction < _4M)
+ paProbeLocs[i].pszFunction = (const char *)((uintptr_t)paProbeLocs[i].pszFunction + offDelta);
+
offTmp += offDelta;
}
#endif
MY_CHECK_RET(offTmp < pVtgHdr->cbProbes, VERR_SUPDRV_VTG_BAD_PROBE_LOC);
MY_CHECK_RET(offTmp / sizeof(VTGDESCPROBE) * sizeof(VTGDESCPROBE) == offTmp, VERR_SUPDRV_VTG_BAD_PROBE_LOC);
+ MY_WITHIN_IMAGE(paProbeLocs[i].pszFunction, VERR_SUPDRV_VTG_BAD_PROBE_LOC);
}
}
@@ -1466,13 +1472,13 @@ SUPR0TracerFireProbe: \n\
");
# if defined(RT_ARCH_AMD64)
__asm__(" \
- movq g_pfnSupdrvProbeFireKernel(%rip), %rax \n\
- jmp *%rax \n\
+ movq g_pfnSupdrvProbeFireKernel(%rip), %rax \n\
+ jmp *%rax \n\
");
# elif defined(RT_ARCH_X86)
__asm__("\
- movl g_pfnSupdrvProbeFireKernel, %eax \n\
- jmp *%eax \n\
+ movl g_pfnSupdrvProbeFireKernel, %eax \n\
+ jmp *%eax \n\
");
# else
# error "Which arch is this?"
@@ -2132,6 +2138,7 @@ int VBOXCALL supdrvIOCtl_TracerUmodDeregister(PSUPDRVDEVEXT pDevExt, PSUPDRVS
RTR0MemObjFree(pUmod->hMemObjMap, false /*fFreeMappings*/);
RTR0MemObjFree(pUmod->hMemObjLock, false /*fFreeMappings*/);
RTMemFree(pUmod);
+ rc = VINF_SUCCESS;
}
else
rc = VERR_NOT_FOUND;