VirtualBox

Ignore:
Timestamp:
Nov 5, 2013 6:38:08 PM (11 years ago)
Author:
vboxsync
Message:

SUPDrv: Made dtrace support build against UEKR3.

Location:
trunk/src/VBox/HostDrivers/Support
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPDrv-dtrace.cpp

    r48952 r49395  
    4747# include VBOX_PATH_MACOSX_DTRACE_H
    4848#elif defined(RT_OS_LINUX)
    49 /* DTrace experiments with the Unbreakable Enterprise Kernel (UEK)
     49/* Avoid type and define conflicts. */
     50# undef UINT8_MAX
     51# undef UINT16_MAX
     52# undef UINT32_MAX
     53# undef UINT64_MAX
     54# undef INT64_MAX
     55# undef INT64_MIN
     56# define intptr_t dtrace_intptr_t
     57
     58# if 0
     59/* DTrace experiments with the Unbreakable Enterprise Kernel (UEK2)
    5060   (Oracle Linux).
    5161   1. The dtrace.h here is from the dtrace module source, not
     
    5868            -e 's/$/\tdrivers\/dtrace\/dtrace\tEXPORT_SYMBOL/' \
    5969      >> Module.symvers
     70      Update: Althernative workaround (active), resolve symbols dynamically.
    6071   3. No tracepoints in vboxdrv, vboxnet* or vboxpci yet.  This requires yasm
    6172      and VBoxTpG and build time. */
    62 # undef UINT8_MAX
    63 # undef UINT16_MAX
    64 # undef UINT32_MAX
    65 # undef UINT64_MAX
    66 # undef INT64_MAX
    67 # undef INT64_MIN
    68 # define intptr_t dtrace_intptr_t
    69 # include "dtrace.h"
     73#  include "dtrace.h"
     74# else
     75/* DTrace experiments with the Unbreakable Enterprise Kernel (UEKR3)
     76   (Oracle Linux).
     77   1. To generate the missing entries for the dtrace module in Module.symvers
     78      of UEK:
     79      nm /lib/modules/....../kernel/drivers/dtrace/dtrace.ko  \
     80      | grep _crc_ \
     81      | sed -e 's/^......../0x/' -e 's/ A __crc_/\t/' \
     82            -e 's/$/\tdrivers\/dtrace\/dtrace\tEXPORT_SYMBOL/' \
     83      >> Module.symvers
     84      Update: Althernative workaround (active), resolve symbols dynamically.
     85   2. No tracepoints in vboxdrv, vboxnet* or vboxpci yet.  This requires yasm
     86      and VBoxTpG and build time. */
     87#  include <dtrace/provider.h>
     88#  include <dtrace/enabling.h> /* Missing from provider.h. */
     89#  include <dtrace/arg.h> /* Missing from provider.h. */
     90# endif
     91# include <linux/kallsyms.h>
     92/** Status code fixer (UEK uses linux convension unlike the others). */
    7093# define FIX_UEK_RC(a_rc) (-(a_rc))
    7194#else
     
    192215*   Global Variables                                                           *
    193216*******************************************************************************/
    194 #ifdef RT_OS_DARWIN
    195 /** @name DTrace kernel interface used on Darwin
     217#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX)
     218/** @name DTrace kernel interface used on Darwin and Linux.
    196219 * @{ */
    197220static void        (* g_pfnDTraceProbeFire)(dtrace_id_t, uint64_t, uint64_t, uint64_t, uint64_t, uint64_t);
     
    10281051const SUPDRVTRACERREG * VBOXCALL supdrvDTraceInit(void)
    10291052{
    1030 #ifdef RT_OS_DARWIN
     1053#if defined(RT_OS_DARWIN) || defined(RT_OS_LINUX)
    10311054    /*
    10321055     * Resolve the kernel symbols we need.
    10331056     */
     1057# ifndef RT_OS_LINUX
    10341058    RTDBGKRNLINFO hKrnlInfo;
    10351059    int rc = RTR0DbgKrnlInfoOpen(&hKrnlInfo, 0);
     
    10391063        return NULL;
    10401064    }
     1065# endif
    10411066
    10421067    static const struct
     
    10531078        { "dtrace_unregister",   (PFNRT*)&dtrace_unregister   },
    10541079    };
    1055     for (unsigned i = 0; i < RT_ELEMENTS(s_aDTraceFunctions); i++)
    1056     {
     1080    unsigned i;
     1081    for (i = 0; i < RT_ELEMENTS(s_aDTraceFunctions); i++)
     1082    {
     1083# ifndef RT_OS_LINUX
    10571084        rc = RTR0DbgKrnlInfoQuerySymbol(hKrnlInfo, NULL, s_aDTraceFunctions[i].pszName,
    10581085                                        (void **)s_aDTraceFunctions[i].ppfn);
     
    10621089            break;
    10631090        }
    1064     }
    1065 
     1091# else
     1092        unsigned long ulAddr = kallsyms_lookup_name(s_aDTraceFunctions[i].pszName);
     1093        if (!ulAddr)
     1094        {
     1095            SUPR0Printf("supdrvDTraceInit: Failed to resolved '%s' (i=%u).\n", s_aDTraceFunctions[i].pszName, i);
     1096            break;
     1097        }
     1098        SUPR0Printf("supdrvDTraceInit: '%s' -> %lx.\n", s_aDTraceFunctions[i].pszName, ulAddr);
     1099        *s_aDTraceFunctions[i].ppfn = (PFNRT)ulAddr;
     1100# endif
     1101    }
     1102
     1103# ifndef RT_OS_LINUX
    10661104    RTR0DbgKrnlInfoRelease(hKrnlInfo);
    10671105    if (RT_FAILURE(rc))
    10681106        return NULL;
     1107# endif
    10691108#endif
    10701109
  • trunk/src/VBox/HostDrivers/Support/linux/Makefile

    r48901 r49395  
    156156        math/gcc/qdivrem.o \
    157157        math/gcc/udivdi3.o \
    158         math/gcc/divdi3.o \
     158        math/gcc/divdi3.o \
    159159        math/gcc/umoddi3.o
    160160endif
     
    242242 INCL    += $(addprefix -I$(KBUILD_EXTMOD),/ /include /r0drv/linux)
    243243 INCL    += $(addprefix -I$(KBUILD_EXTMOD)/vboxdrv,/ /include /r0drv/linux)
     244 ifdef VBOX_WITH_NATIVE_DTRACE
     245  INCL   += -I/usr/include/linux -I/usr/include
     246 endif
    244247 export INCL
    245248endif
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