TRPMR0.cpp revision 4ca9552b3be9ce15c5c33f07c0146b287411d306
/* $Id$ */
/** @file
* TRPM - The Trap Monitor - HC Ring 0
*/
/*
* Copyright (C) 2006 InnoTek Systemberatung GmbH
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* 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.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#define LOG_GROUP LOG_GROUP_TRPM
#include "TRPMInternal.h"
/**
* Dispatches an interrupt that arrived while we were in the guest context.
*
* @param pVM The VM handle.
* @remark Must be called with interrupts disabled.
*/
{
AssertMsgReturnVoid(uActiveVector < 256, ("uActiveVector=%#x is invalid! (More assertions to come, please enjoy!)\n", uActiveVector));
/*
* Check if we're in long mode or not.
*/
{
return;
}
#endif
/*
* Get the handler pointer (16:32 ptr) / (16:48 ptr).
*/
ASMGetIDTR(&Idtr);
#if HC_ARCH_BITS == 32
#else
#endif
("The IDT entry (%d) is not 32-bit int gate! type1=%#x type2=%#x\n",
#if HC_ARCH_BITS == 32
#else /* 64-bit: */
{
return;
}
#endif
/*
* Dispatch it.
*/
}
#ifndef VBOX_WITHOUT_IDT_PATCHING
# ifdef VBOX_WITH_HYBIRD_32BIT_KERNEL
# error "VBOX_WITH_HYBIRD_32BIT_KERNEL without VBOX_WITHOUT_IDT_PATCHING isn't supported"
# endif
/**
* Changes the VMMR0Entry() call frame and stack used by the IDT patch code
* so that we'll dispatch an interrupt rather than returning directly to Ring-3
* when VMMR0Entry() returns.
*
* @param pVM Pointer to the VM.
* @param pvRet Pointer to the return address of VMMR0Entry() on the stack.
*/
{
AssertMsgReturnVoid(uActiveVector < 256, ("uActiveVector=%#x is invalid! (More assertions to come, please enjoy!)\n", uActiveVector));
#if HC_ARCH_BITS == 32
/*
* Get the handler pointer (16:32 ptr).
*/
ASMGetIDTR(&Idtr);
("The IDT entry (%d) is not 32-bit int gate! type1=%#x type2=%#x\n",
/*
* The stack frame is as follows:
*
* 1c iret frame
* 18 fs
* 14 ds
* 10 es
* c uArg
* 8 uOperation
* 4 pVM
* 0 return address (pvRet points here)
*
* We'll change the stackframe so that we will not return
* to the caller but to a interrupt dispatcher. We'll also
* setup the frame so that ds and es are moved to give room
* to a far return (to the handler).
*/
#else /* 64-bit: */
/*
* Get the handler pointer (16:48 ptr).
*/
ASMGetIDTR(&Idtr);
("The IDT entry (%d) is not 64-bit int gate! type1=%#x type2=%#x\n",
{
/** @todo implement IST */
}
/*
* The stack frame is as follows:
*
* 28 iret frame
* 20 dummy
* 14 uArg
* 10 uOperation
* 8 pVM
* 0 return address (pvRet points here)
*
* We'll change the stackframe so that we will not return
* to the caller but to a interrupt dispatcher. And we'll create
* a 64-bit far return frame where dummy and uArg is.
*/
#endif
}
#endif /* !VBOX_WITHOUT_IDT_PATCHING */