SUPDRV.h revision fec6782953105e154c193c1be4a761da1c148d6f
1N/A * VirtualBox Support Driver - Internal header. 1N/A * Copyright (C) 2006-2007 innotek GmbH 1N/A * This file is part of VirtualBox Open Source Edition (OSE), as 1N/A * you can redistribute it and/or modify it under the terms of the GNU 1N/A * General Public License as published by the Free Software Foundation, * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE * distribution. VirtualBox OSE is distributed in the hope that it will * be useful, but WITHOUT ANY WARRANTY of any kind. /******************************************************************************* *******************************************************************************/ #
error "unsupported OS."/******************************************************************************* * Defined Constants And Macros * *******************************************************************************/ #
define BIRD 0x64726962 /* 'bird' */#
define BIRD_INV 0x62697264 /* 'drib' *//** Maximum number of bytes we try to lock down in one go. * This is supposed to have a limit right below 256MB, but this appears * to actually be much lower. The values here have been determined experimentally. /* check kernel version */ /* No log API in OS/2 only COM port. */ /* No log API in OS/2 only COM port. */ #
error "OS interface defines is not done for this OS!"/* bird debugging - #if (defined(DEBUG) && !defined(NO_LOGGING)) || defined(RT_OS_FREEBSD) # define dprintf(a) RTLogComPrintf a # define dprintf(a) do {} while (0) /* dprintf2 - extended logging. */ #
if 1//bird defined(RT_OS_DARWIN) || defined(RT_OS_OS2) || defined(RT_OS_FREEBSD)/** Invalid parameter. */ /** Invalid parameter. */ /** Invalid magic or cookie. */ /** Invalid loader handle. */ /** Failed to lock the address range. */ /** Invalid memory pointer. */ /** Failed to patch the IDT. */ /** Memory allocation failed. */ /** Permission denied. */ /******************************************************************************* * Structures and Typedefs * *******************************************************************************/ /** Pointer to the device extension. */ /** Interrupt Stack Table index. */ /** Reserved, ignored. */ /** IDT Type part one (not used for task gate). */ /** IDT Type part two. */ /** Descriptor Privilege level. */ /** The upper top part of the address. */ /** Reserved dword for qword (aligning the struct), ignored. */ /** The u5Type2 value for an interrupt gate. */ /** Changed IDT entry (for parnoid UnpatchIdt()). */ * We ASSUME the IDT is not re(al)located after bootup and use this as key * for the patches rather than processor number. This prevents some * stupid nesting stuff from happening in case of processors sharing the * We're fucked if the processors have different physical mapping for * the(se) page(s), but we'll find that out soon enough in VBOX_STRICT mode. /** Pointer to the IDT entry. */ /** The offset into auCode of the VMMR0Entry fixup. */ /** The offset into auCode of the stub function. */ /** Pointer to the next patch. */ * Usage record for a patch. /** Next in the chain. */ /** The patch this usage applies to. */ #
endif /* !VBOX_WITHOUT_IDT_PATCHING */ * Memory reference types. /** Locked memory (r3 mapping only). */ /** Continous memory block (r3 and r0 mapping). */ /** Low memory block (r3 and r0 mapping). */ /** Memory block (r3 and r0 mapping). */ /** Locked memory (r3 mapping only) allocated by the support driver. */ /** Blow the type up to 32-bit and mark the end. */ * Structure used for tracking memory a session * references in one way or another. /** The memory object handle. */ /** The ring-3 mapping memory object handle. */ #
else /* !USE_NEW_OS_INTERFACE_FOR_MM */ /** Pointer to the R0 mapping of the memory. /** Pointer to the R3 mapping of the memory. /** Size of the locked memory. */ /** memory type specific information. */ /** Pointer to memory descriptor list (MDL). */ #
error "Either no target was defined or we haven't ported the driver to the target yet." /** Pointer to memory descriptor list (MDL). */ #
error "Either no target was defined or we haven't ported the driver to the target yet." /** Pointer to memory descriptor list (MDL). */ /** Pointer to the array of page pointers. */ /** Number of pages in papPages. */ #
error "Either no target was defined or we haven't ported the driver to the target yet." /** The memory object handle. */ /** The ring-3 mapping memory object handle. */ #
endif /* !USE_NEW_OS_INTERFACE_FOR_MM */ * Bundle of locked memory ranges. /** Pointer to the next bundle. */ /** Referenced memory. */ /** Number of entries used. */ /** Pointer to the image. */ /** Pointer to the optional module initialization callback. */ /** Pointer to the optional module termination callback. */ /** Size of the image. */ /** The offset of the symbol table. */ /** The number of entries in the symbol table. */ /** The offset of the string table. */ /** Size of the string table. */ /** The ldr image state. (IOCtl code of last opration.) */ /** Image usage record. */ * This takes care of reference counting and tracking data for access checks. /** Magic value (SUPDRVOBJ_MAGIC). */ /** Pointer to the next in the global list. */ /** Pointer to the object destructor. */ /** The total sum of all per-session usage. */ /** The creator user id. */ /** The creator group id. */ /** The creator process id. */ /** Magic number for SUPDRVOBJ::u32Magic. (Dame Agatha Mary Clarissa Christie). */ * The per-session object usage record. /** Pointer to the next in the list. */ /** Pointer to the object we're recording usage for. */ * This is mainly for memory tracking. /** Pointer to the device extension. */ /** Load usage records. (protected by SUPDRVDEVEXT::mtxLdr) */ /** Patch usage records. (protected by SUPDRVDEVEXT::SpinLock) */ /** The VM associated with the session. */ /** List of generic usage records. (protected by SUPDRVDEVEXT::SpinLock) */ /** Spinlock protecting the bundles and the GIP members. */ /** The ring-3 mapping of the GIP (readonly). */ /** The read-only usermode mapping address of the GID. * This is NULL if the GIP hasn't been mapped. */ /** Set if the session is using the GIP. */ /** Bundle of locked memory objects. */ /** The user id of the session. (Set by the OS part.) */ /** The group id of the session. (Set by the OS part.) */ /** The process (id) of the session. (Set by the OS part.) */ /** Which process this session is associated with. */ /** The system file number of this session. */ /** Pointer to the next session with the same hash. */ /** Spinlock to serialize the initialization, * usage counting and destruction of the IDT entry override. */ /** List of patches Free. */ /** List of registered objects. */ /** List of free object usage records. */ /** The IDT entry number. * Only valid if pIdtPatches is set. */ * This protects pvVMMR0, pvVMMR0Entry, pImages and SUPDRVSESSION::pLdrUsage. */ * 0 if the code VMM isn't loaded and Idt are nops. */ /** VMMR0EntryInt() pointer. */ /** VMMR0EntryFast() pointer. */ /** VMMR0EntryEx() pointer. */ /** Linked list of loaded code. */ * Any changes to any of the GIP members requires ownership of this mutex, * except on driver init and termination. */ /** Pointer to the Global Info Page (GIP). */ /** The physical address of the GIP. */ /** Number of processes using the GIP. * (The updates are suspend while cGipUsers is 0.)*/ /** The ring-0 memory object handle for the GIP page. */ /** The GIP timer handle. */ /** If non-zero we've successfully called RTTimerRequestSystemGranularity(). */ /** The GIP timer object. */ /** The GIP DPC object associated with GipTimer. */ /** The GIP DPC objects for updating per-cpu data. */ /** Pointer to the MDL for the pGip page. */ /** GIP timer interval (ms). */ /** The last mono time stamp. */ /** Set when GIP is suspended to prevent the timers from re-registering themselves). */ /** Array of per CPU data for SUPGIPMODE_ASYNC_TSC. */ /** The last mono time stamp. */ /** The Linux Process ID. */ /** The per cpu timer. */ /******************************************************************************* * OS Specific Functions * *******************************************************************************/ /******************************************************************************* *******************************************************************************/