initterm-r0drv-nt.cpp revision c2ac210bd84591123bb8803712887e2b016cb78f
1N/A * IPRT - Initialization & Termination, R0 Driver, NT. 1N/A * Copyright (C) 2006-2007 Oracle Corporation 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 (GPL) as published by the Free Software 1N/A * Foundation, in version 2 as it comes in the "COPYING" file of the 1N/A * VirtualBox OSE distribution. VirtualBox OSE is distributed in the 1N/A * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 1N/A * The contents of this file may alternatively be used under the terms 1N/A * of the Common Development and Distribution License Version 1.0 1N/A * (CDDL) only, as it comes in the "COPYING.CDDL" file of the 1N/A * VirtualBox OSE distribution, in which case the provisions of the 1N/A * CDDL are applicable instead of those of the GPL. 1N/A * You may elect to license modified versions of this file under the 1N/A * terms and conditions of either the GPL or the CDDL or both. 1N/A/******************************************************************************* 1N/A*******************************************************************************/ 1N/A/******************************************************************************* 1N/A*******************************************************************************/ 1N/A * KeQueryActiveProcssors() cannot be called at all IRQLs and therefore we'll 1N/A * have to cache it. Fortunately, Nt doesn't really support taking CPUs offline 1N/A * or online. It's first with W2K8 that support for CPU hotplugging was added. 1N/A * Once we start caring about this, we'll simply let the native MP event callback 1N/A * and update this variable as CPUs comes online. (The code is done already.) 1N/A/** ExSetTimerResolution, introduced in W2K. */ 1N/A/** KeFlushQueuedDpcs, introduced in XP. */ 1N/A/** HalRequestIpi, introduced in ??. */ 1N/A/** HalSendSoftwareInterrupt */ 1N/A/** SendIpi handler based on Windows version */ 1N/A/** KeIpiGenericCall - Windows Server 2003+ only */ 1N/A/** Offset of the _KPRCB::QuantumEnd field. 0 if not found. */ 1N/A/** Size of the _KPRCB::QuantumEnd field. 0 if not found. */ 1N/A/** Offset of the _KPRCB::DpcQueueDepth field. 0 if not found. */ 1N/A * Init the Nt cpu set. 1N/A * Initialize the function pointers. * Get some info that might come in handy below. /* Vista or Windows Server 2008 */ /* Windows 7 or Windows Server 2008 R2 */ /* Windows XP should send always send an IPI -> VERIFY */ * HACK ALERT (and d�j� vu warning)! * Try find _KPRCB::QuantumEnd and _KPRCB::[DpcData.]DpcQueueDepth. * For purpose of verification we use the VendorString member (12+1 chars). * The offsets was initially derived by poking around with windbg * (dt _KPRCB, !prcb ++, and such like). Systematic harvesting is now done * by means of dia2dump, grep and the symbol packs. Typically: * dia2dump -type _KDPC_DATA -type _KPRCB EXE\ntkrnlmp.pdb | grep -wE "QuantumEnd|DpcData|DpcQueueDepth|VendorString" /** @todo array w/ data + script for extracting a row. (save space + readability; table will be short.) */ /* WindowsVista.6002.090410-1830.x86fre.Symbols.exe WindowsVista.6002.090410-1830.x86chk.Symbols.exe WindowsVista.6002.090130-1715.x86fre.Symbols.exe WindowsVista.6002.090130-1715.x86chk.Symbols.exe */ //pbQuantumEnd = (uint8_t volatile *)pPcr->Prcb + 0x1a41; /* WindowsVista.6002.090410-1830.amd64fre.Symbols WindowsVista.6002.090130-1715.amd64fre.Symbols WindowsVista.6002.090410-1830.amd64chk.Symbols */ /* Windows7.7600.16539.amd64fre.win7_gdr.100226-1909 */ #
ifndef IN_GUEST /** @todo fix above for all Nt versions. */ DbgPrint(
"IPRT: Neither _KPRCB::QuantumEnd nor _KPRCB::DpcQueueDepth was not found! Kernel %u.%u %u %s\n",
DbgPrint(
"IPRT: _KPRCB:{.QuantumEnd=%x/%d, .DpcQueueDepth=%x/%d} Kernel %ul.%ul %ul %s\n",