VBoxDTraceTypes.h revision 49b97135c86693da9b34e628ff4c5d8809768f4b
/* $Id$ */
/** @file
* VBoxDTraceTypes.h - Fake a bunch of Solaris types.
*/
/*
* Copyright (c) 2012 bird
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef ___VBoxDTraceTypes_h___
#define ___VBoxDTraceTypes_h___
struct modctl;
typedef unsigned char uchar_t;
typedef unsigned int uint_t;
typedef char *caddr_t;
typedef RTCPUID processorid_t;
typedef RTCCUINTREG greg_t;
typedef unsigned int model_t;
typedef struct VBoxDtCred
{
} cred_t;
#define priv_isequalset(a, b) (true)
typedef struct RTTIMER *cyclic_id_t;
typedef struct VBoxDtThread
{
} kthread_t;
extern kthread_t *VBoxDtGetCurrentThread(void);
#define curthread (VBoxDtGetCurrentThread())
typedef struct VBoxDtProcess
{
struct dtrace_helpers *p_dtrace_helpers;
} proc_t;
proc_t *VBoxDtGetCurrentProc(void);
#define curproc (VBoxDtGetCurrentProc())
typedef struct VBoxDtTaskQueue taskq_t;
typedef struct VBoxDtMutex
{
} kmutex_t;
#define mutex_enter VBoxDtMutexEnter
#define mutex_exit VBoxDtMutexExit
#define mod_lock g_DummyMtx
#define cpu_lock g_DummyMtx
extern struct VBoxDtMutex g_DummyMtx;
typedef struct VBoxDtCpuCore
{
uint16_t volatile cpuc_dtrace_flags;
} cpucore_t;
#define CPU_DTRACE_BADADDR RT_BIT(0)
#define cpu_core (g_aVBoxDtCpuCores)
cred_t *VBoxDtGetCurrentCreds(void);
#define CRED() VBoxDtGetCurrentCreds()
#define panic VBoxDtPanic
void VBoxDtPanic(const char *psz, ...);
#define cmn_err VBoxDtCmnErr
#define CE_WARN 10
#define CE_NOTE 11
#define uprintf VBoxDtUPrintf
#define vuprintf VBoxDtUPrintfV
void VBoxDtUPrintf(const char *pszFormat, ...);
#if 1 /* */
#endif
#define B_FALSE (0)
#define B_TRUE (1)
#define NANOSEC RT_NS_1SEC
#define MILLISEC RT_MS_1SEC
#define NBBY 8
#define NCPU RTCPUSET_MAX_CPUS
#define CPU_ON_INTR(a_pCpu) (false)
#define KERNELBASE VBoxDtGetKernelBase()
uintptr_t VBoxDtGetKernelBase(void);
#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. */
/** Mark a type change made when porting the code to VBox.
* This is usually signed -> unsigned type changes that avoids a whole lot of
* comparsion warnings. */
/** Mark missing void in a parameter list. */
#define VBDTVOID void
/** Mark missing static in a function definition. */
#define VBDTSTATIC static
/*
* Memory allocation wrappers.
*/
#define kmem_alloc VBoxDtKMemAlloc
#define kmem_zalloc VBoxDtKMemAllocZ
#define kmem_free VBoxDtKMemFree
typedef struct VBoxDtMemCache kmem_cache_t;
#define kmem_cache_alloc VBoxDtKMemCacheAlloc
#define kmem_cache_free VBoxDtKMemCacheFree
typedef struct VBoxDtVMem
{
void *pvTodo;
} vmem_t;
#define vmem_create VBoxDtVMemCreate
#define vmem_destroy VBoxDtVMemDestroy
#define vmem_alloc VBoxDtVMemAlloc
#define vmem_free VBoxDtVMemFree
/*
* Errno defines compatible with the CRT of the given host...
*/
#define EINVAL (22)
#define EBUSY (16)
#define EFBIG (27)
#define ENOMEM (12)
#define ENOSPC (28)
#define ENOENT (2)
#define EFAULT (14)
#define E2BIG (7)
#define EACCES (13)
#define EALREADY (114)
#define ENXIO (6)
#define EAGAIN (11)
#define ENOTTY (25)
#define ESRCH (3)
/*
* string
*/
#define snprintf RTStrPrintf
/*
*/
#define copyin VBoxDtCopyIn
#define copyout VBoxDtCopyOut
/*
* Device numbers.
*/
/*
* DDI
*/
#define DDI_SUCCESS (0)
#define DDI_FAILURE (-1)
int VBoxDtDdiSoftStateTerm(void **ppvSoftStates);
typedef struct VBoxDtDevInfo dev_info_t;
typedef enum { DDI_ATT_CMD_DUMMY } ddi_attach_cmd_t;
#define ddi_driver_major VBoxDtDdiDriverMajor
#define ddi_report_dev VBoxDtDdiReportDev
/*
* CTF - probably needs to be ported wholesale or smth.
*/
#define CTF_MODEL_NATIVE 1
#endif