Index: /trunk/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceTypes.h
===================================================================
--- /trunk/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceTypes.h	(revision 53639)
+++ /trunk/src/VBox/ExtPacks/VBoxDTrace/include/VBoxDTraceTypes.h	(revision 53640)
@@ -42,8 +42,9 @@
 typedef uintptr_t               pc_t;
 typedef uint32_t                zoneid_t;
-typedef uintptr_t               caddr_t;
+typedef char                   *caddr_t;
 typedef uint64_t                hrtime_t;
 typedef RTCPUID                 processorid_t;
 typedef RTCCUINTREG             greg_t;
+typedef unsigned int            model_t;
 
 typedef struct VBoxDtCred
@@ -60,6 +61,26 @@
 typedef struct VBoxDtVMem       vmem_t;
 typedef struct VBoxDtCyclicId  *cyclic_id_t;
-typedef struct VBoxDtThread     kthread_t;
-typedef struct VBoxDtThread     proc_t;
+
+typedef struct VBoxDtThread
+{
+    hrtime_t                t_dtrace_vtime;
+    hrtime_t                t_dtrace_start;
+    uint8_t                 t_dtrace_stop;
+    uintptr_t               t_dtrace_scrpc;
+    uintptr_t               t_dtrace_astpc;
+    uint32_t                t_predcache;
+} kthread_t;
+extern kthread_t *VBoxDtGetCurrentThread(void);
+#define curthread               (VBoxDtGetCurrentThread())
+
+
+typedef struct VBoxDtProcess
+{
+    uint32_t                p_flag;
+} proc_t;
+
+#define SNOCD                   RT_BIT(0)
+
+
 typedef struct VBoxDtDevInfo    dev_info_t;
 typedef struct VBoxDtTaskQueue  taskq_t;
@@ -74,30 +95,67 @@
 {
     RTCPUID             cpu_id;
-    void               *cpuc_dtrace_illval;
+    uintptr_t           cpuc_dtrace_illval;
     uint16_t volatile   cpuc_dtrace_flags;
 
 } cpucore_t;
 
-#define CPU_DTRACE_BADADDR  RT_BIT(0)
-#define CPU_DTRACE_BADALIGN RT_BIT(1)
-#define CPU_DTRACE_NOFAULT  RT_BIT(2)
-#define CPU_DTRACE_FAULT    RT_BIT(3)
-#define CPU_DTRACE_KPRIV    RT_BIT(4)
-#define CPU_DTRACE_DROP     RT_BIT(5)
+#define CPU_DTRACE_BADADDR      RT_BIT(0)
+#define CPU_DTRACE_BADALIGN     RT_BIT(1)
+#define CPU_DTRACE_BADSTACK     RT_BIT(2)
+#define CPU_DTRACE_KPRIV        RT_BIT(3)
+#define CPU_DTRACE_DIVZERO      RT_BIT(4)
+#define CPU_DTRACE_ILLOP        RT_BIT(5)
+#define CPU_DTRACE_NOSCRATCH    RT_BIT(6)
+#define CPU_DTRACE_UPRIV        RT_BIT(7)
+#define CPU_DTRACE_TUPOFLOW     RT_BIT(8)
+#define CPU_DTRACE_ENTRY        RT_BIT(9)
+#define CPU_DTRACE_FAULT        UINT16_C(0x03ff)
+#define CPU_DTRACE_DROP         RT_BIT(12)
+#define CPU_DTRACE_ERROR        UINT16_C(0x13ff)
+#define CPU_DTRACE_NOFAULT      RT_BIT(15)
 
-extern cpucore_t  g_aVBoxDtCpuCores[RTCPUSET_MAX_CPUS];
-#define cpu_core (g_aVBoxDtCpuCores)
+extern cpucore_t                g_aVBoxDtCpuCores[RTCPUSET_MAX_CPUS];
+#define cpu_core                (g_aVBoxDtCpuCores)
+
+cred_t *VBoxDtGetCurrentCreds(void);
+#define CRED()                  VBoxDtGetCurrentCreds()
+
+proc_t *VBoxDtThreadToProc(kthread_t *);
+
+
+#define ASSERT(a_Expr)          Assert(a_Expr)
 
 #if 1 /* */
 
-typedef RTUID               uid_t;
-typedef RTPROCESS           pid_t;
-typedef RTDEV               dev_t;
+typedef RTUID                   uid_t;
+typedef RTPROCESS               pid_t;
+typedef RTDEV                   dev_t;
 #endif
 
-#define NANOSEC             RT_NS_1SEC
-#define MILLISEC            RT_MS_1SEC
-#define NBBY                8
+#define NANOSEC                 RT_NS_1SEC
+#define MILLISEC                RT_MS_1SEC
+#define NBBY                    8
+#define NCPU                    RTCPUSET_MAX_CPUS
+#define P2ROUNDUP(uWhat, uAlign) ( ((uWhat) + (uAlign) - 1) & ~(uAlign - 1) )
+#define CPU_ON_INTR(a_pCpu)     (false)
 
+
+#if defined(RT_ARCH_X86)
+# ifndef __i386
+#  define __i386            1
+# endif
+
+#elif defined(RT_ARCH_AMD64)
+# ifndef __x86_64
+#  define __x86_64          1
+# endif
+
+#else
+# error "unsupported arch!"
+#endif
+
+/** Mark a cast added when porting the code to VBox.
+ * Avoids lots of \#ifdef VBOX otherwise needed to mark up the changes. */
+#define VBDTCAST(a_Type)        (a_Type)
 
 RT_C_DECLS_END
Index: /trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dtrace.c
===================================================================
--- /trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dtrace.c	(revision 53639)
+++ /trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/dtrace/dtrace.c	(revision 53640)
@@ -94,7 +94,12 @@
 
 #else  /* VBOX */
-# include <iprt/types.h>
 # include <sys/dtrace_impl.h>
+# include <iprt/assert.h>
 # include <iprt/mp.h>
+# include <iprt/process.h>
+# include <iprt/thread.h>
+
+# undef NULL
+# define NULL (0)
 #endif /* VBOX */
 
@@ -340,4 +345,5 @@
  * signature.
  */
+#ifndef VBOX
 #define	DTRACE_TLS_THRKEY(where) { \
 	uint_t intr = 0; \
@@ -349,4 +355,10 @@
 	    (((uint64_t)1 << 61) - 1)) | ((uint64_t)intr << 61); \
 }
+#else
+#define	DTRACE_TLS_THRKEY(where) do { \
+	(where) = (((uintptr_t)RTThreadNativeSelf() + DIF_VARIABLE_MAX) & (RT_BIT_64(61) - 1)) \
+			| (RTThreadIsInInterrupt(NIL_RTTHREAD) ? RT_BIT_64(61) : 0); \
+} while (0)
+#endif
 
 #define	DT_BSWAP_8(x)	((x) & 0xff)
@@ -1105,5 +1117,5 @@
 	proc_t *proc;
 
-	if ((proc = ttoproc(curthread)) != NULL &&
+	if ((proc = VBDT_GET_PROC()) != NULL &&
 	    !(proc->p_flag & SNOCD))
 		return (1);
@@ -2235,5 +2247,5 @@
 		return;
 
-	if (which > state->dts_nspeculations) {
+	if (which > VBDTCAST(unsigned)state->dts_nspeculations) {
 		cpu_core[cpu].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
 		return;
@@ -2371,5 +2383,5 @@
 		return;
 
-	if (which > state->dts_nspeculations) {
+	if (which > VBDTCAST(unsigned)state->dts_nspeculations) {
 		cpu_core[cpu].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
 		return;
@@ -2434,5 +2446,5 @@
 	}
 
-	for (i = 0; i < state->dts_nspeculations; i++) {
+	for (i = 0; i < VBDTCAST(unsigned)state->dts_nspeculations; i++) {
 		dtrace_speculation_t *spec = &state->dts_speculations[i];
 		dtrace_buffer_t *src = &spec->dtsp_buffer[cpu];
@@ -2472,5 +2484,5 @@
 	dtrace_specid_t i;
 
-	for (i = 0; i < state->dts_nspeculations; i++) {
+	for (i = 0; i < VBDTCAST(unsigned)state->dts_nspeculations; i++) {
 		dtrace_speculation_t *spec = &state->dts_speculations[i];
 
@@ -2496,5 +2508,5 @@
 	 * to inactive.
 	 */
-	for (i = 0; i < state->dts_nspeculations; i++) {
+	for (i = 0; i < VBDTCAST(unsigned)state->dts_nspeculations; i++) {
 		dtrace_speculation_t *spec = &state->dts_speculations[i];
 		dtrace_speculation_state_t current, new;
@@ -2533,5 +2545,5 @@
 		return (NULL);
 
-	if (which > state->dts_nspeculations) {
+	if (which > VBDTCAST(unsigned)state->dts_nspeculations) {
 		cpu_core[cpuid].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
 		return (NULL);
@@ -2682,4 +2694,5 @@
 
 	case DIF_VAR_UREGS: {
+#ifndef VBOX
 		klwp_t *lwp;
 
@@ -2694,4 +2707,8 @@
 
 		return (dtrace_getreg(lwp->lwp_regs, ndx));
+#else
+		cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
+		return (0);
+#endif
 	}
 
@@ -2699,5 +2716,9 @@
 		if (!dtrace_priv_kernel(state))
 			return (0);
+#ifndef VBOX
 		return ((uint64_t)(uintptr_t)curthread);
+#else
+		return ((uintptr_t)RTThreadNativeSelf());
+#endif
 
 	case DIF_VAR_TIMESTAMP:
@@ -2854,4 +2875,5 @@
 			return (0);
 
+#ifndef VBOX
 		/*
 		 * Note that we are assuming that an unanchored probe is
@@ -2871,4 +2893,7 @@
 		 */
 		return ((uint64_t)curthread->t_procp->p_pidp->pid_id);
+#else
+		return (RTProcSelf());
+#endif
 
 	case DIF_VAR_PPID:
@@ -2876,4 +2901,5 @@
 			return (0);
 
+#ifndef VBOX
 		/*
 		 * See comment in DIF_VAR_PID.
@@ -2889,6 +2915,11 @@
 		 */
 		return ((uint64_t)curthread->t_procp->p_ppid);
+#else
+		cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
+		return (0); /** @todo parent pid? */
+#endif
 
 	case DIF_VAR_TID:
+#ifndef VBOX
 		/*
 		 * See comment in DIF_VAR_PID.
@@ -2898,4 +2929,7 @@
 
 		return ((uint64_t)curthread->t_tid);
+#else
+		return (RTThreadNativeSelf()); /** @todo proper tid? */
+#endif
 
 	case DIF_VAR_EXECNAME:
@@ -2903,4 +2937,5 @@
 			return (0);
 
+#ifndef VBOX
 		/*
 		 * See comment in DIF_VAR_PID.
@@ -2918,4 +2953,8 @@
 		    (uintptr_t)curthread->t_procp->p_user.u_comm,
 		    state, mstate));
+#else
+		cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
+		return (0); /** @todo execname */
+#endif
 
 	case DIF_VAR_ZONENAME:
@@ -2923,4 +2962,5 @@
 			return (0);
 
+#ifndef VBOX
 		/*
 		 * See comment in DIF_VAR_PID.
@@ -2938,4 +2978,8 @@
 		    (uintptr_t)curthread->t_procp->p_zone->zone_name,
 		    state, mstate));
+#else
+		cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
+		return (0);
+#endif
 
 	case DIF_VAR_UID:
@@ -2943,4 +2987,5 @@
 			return (0);
 
+#ifndef VBOX
 		/*
 		 * See comment in DIF_VAR_PID.
@@ -2959,4 +3004,8 @@
 		 */
 		return ((uint64_t)curthread->t_procp->p_cred->cr_uid);
+#else
+		cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
+		return (0);
+#endif
 
 	case DIF_VAR_GID:
@@ -2964,4 +3013,5 @@
 			return (0);
 
+#ifndef VBOX
 		/*
 		 * See comment in DIF_VAR_PID.
@@ -2980,10 +3030,17 @@
 		 */
 		return ((uint64_t)curthread->t_procp->p_cred->cr_gid);
+#else
+		cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
+		return (0);
+#endif
 
 	case DIF_VAR_ERRNO: {
+#ifndef VBOX
 		klwp_t *lwp;
+#endif
 		if (!dtrace_priv_proc(state))
 			return (0);
 
+#ifndef VBOX
 		/*
 		 * See comment in DIF_VAR_PID.
@@ -3002,4 +3059,8 @@
 
 		return ((uint64_t)lwp->lwp_errno);
+#else
+		cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags |= CPU_DTRACE_ILLOP;
+		return (0);
+#endif
 	}
 	default:
@@ -3025,4 +3086,5 @@
 	dtrace_vstate_t *vstate = &state->dts_vstate;
 
+#ifndef VBOX
 	union {
 		mutex_impl_t mi;
@@ -3034,4 +3096,5 @@
 		uintptr_t rw;
 	} r;
+#endif
 
 	switch (subr) {
@@ -3041,4 +3104,5 @@
 
 	case DIF_SUBR_MUTEX_OWNED:
+#ifndef VBOX
 		if (!dtrace_canload(tupregs[0].dttk_value, sizeof (kmutex_t),
 		    mstate, vstate)) {
@@ -3052,7 +3116,12 @@
 		else
 			regs[rd] = LOCK_HELD(&m.mi.m_spin.m_spinlock);
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
 		break;
 
 	case DIF_SUBR_MUTEX_OWNER:
+#ifndef VBOX
 		if (!dtrace_canload(tupregs[0].dttk_value, sizeof (kmutex_t),
 		    mstate, vstate)) {
@@ -3067,7 +3136,12 @@
 		else
 			regs[rd] = 0;
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
 		break;
 
 	case DIF_SUBR_MUTEX_TYPE_ADAPTIVE:
+#ifndef VBOX
 		if (!dtrace_canload(tupregs[0].dttk_value, sizeof (kmutex_t),
 		    mstate, vstate)) {
@@ -3078,7 +3152,12 @@
 		m.mx = dtrace_load64(tupregs[0].dttk_value);
 		regs[rd] = MUTEX_TYPE_ADAPTIVE(&m.mi);
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
 		break;
 
 	case DIF_SUBR_MUTEX_TYPE_SPIN:
+#ifndef VBOX
 		if (!dtrace_canload(tupregs[0].dttk_value, sizeof (kmutex_t),
 		    mstate, vstate)) {
@@ -3089,7 +3168,12 @@
 		m.mx = dtrace_load64(tupregs[0].dttk_value);
 		regs[rd] = MUTEX_TYPE_SPIN(&m.mi);
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
 		break;
 
 	case DIF_SUBR_RW_READ_HELD: {
+#ifndef VBOX
 		uintptr_t tmp;
 
@@ -3102,8 +3186,13 @@
 		r.rw = dtrace_loadptr(tupregs[0].dttk_value);
 		regs[rd] = _RW_READ_HELD(&r.ri, tmp);
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
 		break;
 	}
 
 	case DIF_SUBR_RW_WRITE_HELD:
+#ifndef VBOX
 		if (!dtrace_canload(tupregs[0].dttk_value, sizeof (krwlock_t),
 		    mstate, vstate)) {
@@ -3114,7 +3203,12 @@
 		r.rw = dtrace_loadptr(tupregs[0].dttk_value);
 		regs[rd] = _RW_WRITE_HELD(&r.ri);
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
 		break;
 
 	case DIF_SUBR_RW_ISWRITER:
+#ifndef VBOX
 		if (!dtrace_canload(tupregs[0].dttk_value, sizeof (krwlock_t),
 		    mstate, vstate)) {
@@ -3125,4 +3219,8 @@
 		r.rw = dtrace_loadptr(tupregs[0].dttk_value);
 		regs[rd] = _RW_ISWRITER(&r.ri);
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
 		break;
 
@@ -3237,4 +3335,5 @@
 	case DIF_SUBR_MSGSIZE:
 	case DIF_SUBR_MSGDSIZE: {
+#ifndef VBOX
 		uintptr_t baddr = tupregs[0].dttk_value, daddr;
 		uintptr_t wptr, rptr;
@@ -3290,8 +3389,13 @@
 			regs[rd] = count;
 
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
 		break;
 	}
 
 	case DIF_SUBR_PROGENYOF: {
+#ifndef VBOX
 		pid_t pid = tupregs[0].dttk_value;
 		proc_t *p;
@@ -3310,4 +3414,8 @@
 
 		regs[rd] = rval;
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
 		break;
 	}
@@ -3505,5 +3613,5 @@
 					}
 
-					if (pos > len)
+					if (VBDTCAST(uint64_t)pos > len)
 						pos = len;
 				} else {
@@ -3511,5 +3619,5 @@
 						pos = 0;
 
-					if (pos >= len) {
+					if (VBDTCAST(uint64_t)pos >= len) {
 						if (sublen == 0)
 							regs[rd] = len;
@@ -3689,9 +3797,9 @@
 		}
 
-		if (index >= len || index < 0) {
+		if (VBDTCAST(uint64_t)index >= len || index < 0) {
 			remaining = 0;
 		} else if (remaining < 0) {
 			remaining += len - index;
-		} else if (index + remaining > size) {
+		} else if (VBDTCAST(uint64_t)index + remaining > size) {
 			remaining = size - index;
 		}
@@ -3710,4 +3818,5 @@
 
 	case DIF_SUBR_GETMAJOR:
+#ifndef VBOX
 #ifdef _LP64
 		regs[rd] = (tupregs[0].dttk_value >> NBITSMINOR64) & MAXMAJ64;
@@ -3715,7 +3824,12 @@
 		regs[rd] = (tupregs[0].dttk_value >> NBITSMINOR) & MAXMAJ;
 #endif
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
 		break;
 
 	case DIF_SUBR_GETMINOR:
+#ifndef VBOX
 #ifdef _LP64
 		regs[rd] = tupregs[0].dttk_value & MAXMIN64;
@@ -3723,7 +3837,12 @@
 		regs[rd] = tupregs[0].dttk_value & MAXMIN;
 #endif
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
 		break;
 
 	case DIF_SUBR_DDI_PATHNAME: {
+#ifndef VBOX
 		/*
 		 * This one is a galactic mess.  We are going to roughly
@@ -3915,4 +4034,8 @@
 		}
 
+#else
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
 		break;
 	}
@@ -4030,5 +4153,5 @@
 		uint64_t size = state->dts_options[DTRACEOPT_STRSIZE];
 		uintptr_t src = tupregs[0].dttk_value;
-		int i, j, len = dtrace_strlen((char *)src, size);
+		int i, j, len = VBDTCAST(int)dtrace_strlen((char *)src, size);
 		int lastbase = -1, firstbase = -1, lastdir = -1;
 		int start, end;
@@ -4267,4 +4390,5 @@
 	case DIF_SUBR_INET_NTOA6:
 	case DIF_SUBR_INET_NTOP: {
+#ifndef VBOX
 		size_t size;
 		int af, argi, i;
@@ -4465,4 +4589,8 @@
 inetout:	regs[rd] = (uintptr_t)end + 1;
 		mstate->dtms_scratch_ptr += size;
+#else  /* VBOX */
+		regs[rd] = 0;
+		DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif /* VBOX */
 		break;
 	}
@@ -4869,5 +4997,5 @@
 			id -= DIF_VAR_OTHER_UBASE;
 
-			ASSERT(id < vstate->dtvs_nlocals);
+			ASSERT(VBDTCAST(int64_t)id < vstate->dtvs_nlocals);
 			ASSERT(vstate->dtvs_locals != NULL);
 
@@ -4908,5 +5036,5 @@
 			ASSERT(id >= DIF_VAR_OTHER_UBASE);
 			id -= DIF_VAR_OTHER_UBASE;
-			ASSERT(id < vstate->dtvs_nlocals);
+			ASSERT(VBDTCAST(int64_t)id < vstate->dtvs_nlocals);
 
 			ASSERT(vstate->dtvs_locals != NULL);
@@ -5262,4 +5390,6 @@
 }
 
+#ifndef VBOX /* no destructive stuff */
+
 static void
 dtrace_action_breakpoint(dtrace_ecb_t *ecb)
@@ -5433,4 +5563,6 @@
 }
 
+#endif /* !VBOX */
+
 static void
 dtrace_action_ustack(dtrace_mstate_t *mstate, dtrace_state_t *state,
@@ -5443,5 +5575,9 @@
 	int size, offs = 0, i, j;
 	uintptr_t old = mstate->dtms_scratch_ptr, saved;
+#ifndef VBOX
 	uint16_t *flags = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags;
+#else
+	uint16_t volatile *flags = &cpu_core[VBDT_GET_CPUID()].cpuc_dtrace_flags;
+#endif
 	char *sym;
 
@@ -5839,16 +5975,26 @@
 			switch (act->dta_kind) {
 			case DTRACEACT_STOP:
+#ifndef VBOX
 				if (dtrace_priv_proc_destructive(state))
 					dtrace_action_stop();
+#else
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
 				continue;
 
 			case DTRACEACT_BREAKPOINT:
+#ifndef VBOX
 				if (dtrace_priv_kernel_destructive(state))
 					dtrace_action_breakpoint(ecb);
+#else
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
 				continue;
 
 			case DTRACEACT_PANIC:
+#ifndef VBOX
 				if (dtrace_priv_kernel_destructive(state))
 					dtrace_action_panic(ecb);
+#endif
 				continue;
 
@@ -5947,11 +6093,19 @@
 
 			case DTRACEACT_CHILL:
+#ifndef VBOX
 				if (dtrace_priv_kernel_destructive(state))
 					dtrace_action_chill(&mstate, val);
+#else
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
 				continue;
 
 			case DTRACEACT_RAISE:
+#ifndef VBOX
 				if (dtrace_priv_proc_destructive(state))
 					dtrace_action_raise(val);
+#else
+				DTRACE_CPUFLAG_SET(CPU_DTRACE_ILLOP);
+#endif
 				continue;
 
Index: /trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/dtrace.h
===================================================================
--- /trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/dtrace.h	(revision 53639)
+++ /trunk/src/VBox/ExtPacks/VBoxDTrace/onnv/uts/common/sys/dtrace.h	(revision 53640)
@@ -2236,8 +2236,10 @@
 #ifndef VBOX
 # define VBDT_GET_CPUID()		(CPU->cpu_id)
+# define VBDT_GET_PROC()		(ttoproc(curthread))
 #else
 # define VBDT_GET_CPUID()		(RTMpCpuId())
+# define VBDT_GET_PROC()		(VBoxDtGetCurrentProc())
+proc_t *VBoxDtGetCurrentProc(void);
 #endif
-
 
 #define	DTRACE_CPUFLAG_ISSET(flag) \
