selm.h revision 677833bc953b6cb418c701facbdcf4aa18d6c44e
3261N/A * SELM - The Selector Monitor(/Manager). 0N/A * Copyright (C) 2006 InnoTek Systemberatung GmbH 0N/A * This file is part of VirtualBox Open Source Edition (OSE), as 0N/A * you can redistribute it and/or modify it under the terms of the GNU 0N/A * General Public License as published by the Free Software Foundation, 0N/A * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE 0N/A * distribution. VirtualBox OSE is distributed in the hope that it will 0N/A * be useful, but WITHOUT ANY WARRANTY of any kind. 0N/A * If you received this file as part of a commercial VirtualBox 0N/A * distribution, then only the terms of your commercial VirtualBox 0N/A * license agreement apply instead of the previous paragraph. 0N/A/** @defgroup grp_selm The Selector Monitor(/Manager) API 0N/A * Returns Hypervisor's Trap 08 (\#DF) selector. 0N/A * @returns Hypervisor's Trap 08 (\#DF) selector. 0N/A * @param pVM VM Handle. 0N/A * Sets EIP of Hypervisor's Trap 08 (\#DF) TSS. 0N/A * @param pVM VM Handle. 0N/A * @param u32EIP EIP of Trap 08 handler. 0N/A * Sets ss:esp for ring1 in main Hypervisor's TSS. 0N/A * @param pVM VM Handle. 0N/A * @param ss Ring1 SS register value. 0N/A * @param esp Ring1 ESP register value. 0N/A * Gets ss:esp for ring1 in main Hypervisor's TSS. 0N/A * @param pVM VM Handle. 0N/A * @param pSS Ring1 SS register value. 0N/A * @param pEsp Ring1 ESP register value. 0N/A * Returns Guest TSS pointer 0N/A * @param pVM VM Handle. 0N/A * Gets the hypervisor code selector (CS). 0N/A * @returns CS selector. 0N/A * @param pVM The VM handle. 0N/A * Gets the 64-mode hypervisor code selector (CS64). 2884N/A * @param pVM The VM handle. 0N/A * Gets the hypervisor data selector (DS). 0N/A * @returns DS selector. 0N/A * @param pVM The VM handle. 0N/A * Gets the hypervisor TSS selector. 0N/A * @returns TSS selector. 0N/A * @param pVM The VM handle. 0N/A * Gets the hypervisor TSS Trap 8 selector. 0N/A * @returns TSS Trap 8 selector. 0N/A * @param pVM The VM handle. * Gets the address for the hypervisor GDT. * @returns The GDT address. * @param pVM The VM handle. * @remark This is intended only for very special use, like in the world * switchers. Don't exploit this API! * Gets info about the current TSS. * @returns VBox status code. * @retval VINF_SUCCESS if we've got a TSS loaded. * @retval VERR_SELM_NO_TSS if we haven't got a TSS (rather unlikely). * @param pVM The VM handle. * @param pGCPtrTss Where to store the TSS address. * @param pcbTss Where to store the TSS size limit. * Converts a GC selector based address to a flat address. * No limit checks are done. Use the SELMToFlat*() or SELMValidate*() functions * @param Sel Selector part. * @param Addr Address part. /** Flags for SELMToFlatEx(). /** Don't check the RPL,DPL or CPL. */ /** Flags contains CPL information. */ /** Get the CPL from the flags. */ /** Allow converting using Hypervisor GDT entries. */ * Converts a GC selector based address to a flat address. * Some basic checking is done, but not all kinds yet. * @param Sel Selector part. * @param Addr Address part. * @param fFlags SELMTOFLAT_FLAGS_* * @param ppvGC Where to store the GC flat address. * @param pcb Where to store the bytes from *ppvGC which can be accessed according to * the selector. NULL is allowed. * Validates and converts a GC selector based code address to a flat address. * @param SelCPL Current privilege level. Get this from SS - CS might be conforming! * A full selector can be passed, we'll only use the RPL part. * @param SelCS Selector part. * @param pHiddenSel The hidden CS selector register. * @param Addr Address part. * @param ppvFlat Where to store the flat address. * Checks if a selector is 32-bit or 16-bit. * @returns True if it is 32-bit. * @returns False if it is 16-bit. * @param Sel The selector. * @param pHiddenSel The hidden selector register. * Returns flat address and limit of LDT by LDT selector. * Fully validate selector. * @param SelLdt LDT selector. * @param ppvLdt Where to store the flat address of LDT. * @param pcbLimit Where to store LDT limit. * Selector information structure. /** The raw descriptor. */ /** Set if the selector is used by the hypervisor. */ /** Set if the selector is a real mode segment. */ /** Pointer to a SELM selector information struct. */ /** Pointer to a const SELM selector information struct. */ * Validates a CS selector. * @returns VBox status code. * @param pSelInfo Pointer to the selector information for the CS selector. * @param SelCPL The selector defining the CPL (SS). /** @defgroup grp_selm_r3 The Selector Monitor(/Manager) API * @returns VBox status code. * @param pVM The VM to operate on. * Finalizes HMA page attributes. * @returns VBox status code. * @param pVM The VM handle. * Applies relocations to data and code managed by this * component. This function will be called at init and * whenever the VMM need to relocate it self inside the GC. * Notification callback which is called whenever there is a chance that a CR3 * value might have changed. * @param pVM The VM handle * Termination means cleaning up and freeing all resources, * the VM it self is at this point powered off or suspended. * @returns VBox status code. * @param pVM The VM to operate on. * For the SELM component this means that any GDT/LDT/TSS monitors * Sets up the virtualization of a guest GDT. * @returns VBox status code. * @param pVM The VM to operate on. * @param paGDTEs Pointer to GDT array. * @param cGDTEs Number of entries in the GDT array. * Updates the Guest GDT & LDT virtualization based on current CPU state. * @returns VBox status code. * @param pVM The VM to operate on. * Compares the Guest GDT and LDT with the shadow tables. * This is a VBOX_STRICT only function. * @returns VBox status code. * @param pVM The VM Handle. * Check if the TSS ring 0 stack selector and pointer were updated (for now) * @returns VBox status code. * @param pVM The VM to operate on. * Gets information about a selector. * Intended for the debugger mostly and will prefer the guest * descriptor tables over the shadow ones. * @returns VINF_SUCCESS on success. * @returns VERR_INVALID_SELECTOR if the selector isn't fully inside the descriptor table. * @returns VERR_SELECTOR_NOT_PRESENT if the selector wasn't present. * @returns VERR_PAGE_TABLE_NOT_PRESENT or VERR_PAGE_NOT_PRESENT if the pagetable or page * backing the selector table wasn't present. * @returns Other VBox status code on other errros. * @param Sel The selector to get info about. * @param pSelInfo Where to store the information. * Gets information about a selector from the shadow tables. * This is intended to be faster than the SELMR3GetSelectorInfo() method, but requires * that the caller ensures that the shadow tables are up to date. * @returns VINF_SUCCESS on success. * @returns VERR_INVALID_SELECTOR if the selector isn't fully inside the descriptor table. * @returns VERR_SELECTOR_NOT_PRESENT if the selector wasn't present. * @returns VERR_PAGE_TABLE_NOT_PRESENT or VERR_PAGE_NOT_PRESENT if the pagetable or page * backing the selector table wasn't present. * @returns Other VBox status code on other errors. * @param Sel The selector to get info about. * @param pSelInfo Where to store the information. * Validates the RawR0 TSS values against the one in the Guest TSS. * @returns true if it matches. * @returns false and assertions on mismatch.. * @param pVM The VM to operate on. * @param Desc Descriptor to dump. * @param Sel Selector number. * @param pszMsg Message to prepend the log entry with. * Dumps the hypervisor GDT. * Dumps the hypervisor LDT.