VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMR3/PATMPatch.h@ 50653

Last change on this file since 50653 was 44528, checked in by vboxsync, 11 years ago

header (C) fixes

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.5 KB
RevLine 
[23]1/* $Id: PATMPatch.h 44528 2013-02-04 14:27:54Z vboxsync $ */
[1]2/** @file
3 * PATMPatch - Internal header file.
4 */
5
6/*
[44528]7 * Copyright (C) 2006-2012 Oracle Corporation
[1]8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
[5999]12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
[1]16 */
[3723]17#ifndef ___PATMPATCH_H
18#define ___PATMPATCH_H
[1]19
[9228]20int patmPatchAddReloc32(PVM pVM, PPATCHINFO pPatch, uint8_t *pRelocHC, uint32_t uType, RTRCPTR pSource = 0, RTRCPTR pDest = 0);
21int patmPatchAddJump(PVM pVM, PPATCHINFO pPatch, uint8_t *pJumpHC, uint32_t offset, RTRCPTR pTargetGC, uint32_t opcode);
[1]22
[9228]23int patmPatchGenCpuid(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC);
24int patmPatchGenSxDT(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCurInstrGC);
25int patmPatchGenSldtStr(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCurInstrGC);
[1]26int patmPatchGenMovControl(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu);
27int patmPatchGenMovDebug(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu);
[9228]28int patmPatchGenMovFromSS(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCurInstrGC);
[9212]29int patmPatchGenRelJump(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pTargetGC, uint32_t opcode, bool fSizeOverride);
30int patmPatchGenLoop(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pTargetGC, uint32_t opcode, bool fSizeOverride);
[1]31int patmPatchGenPushf(PVM pVM, PPATCHINFO pPatch, bool fSizeOverride);
[9212]32int patmPatchGenPopf(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pReturnAddrGC, bool fSizeOverride, bool fGenJumpBack);
[9228]33int patmPatchGenSti(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC, RTRCPTR pNextInstrGC);
[1]34
35int patmPatchGenCli(PVM pVM, PPATCHINFO pPatch);
[9228]36int patmPatchGenIret(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC, bool fSizeOverride);
[9212]37int patmPatchGenDuplicate(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RCPTRTYPE(uint8_t *) pCurInstrGC);
[1]38int patmPatchGenPushCS(PVM pVM, PPATCHINFO pPatch);
39
[9228]40int patmPatchGenStats(PVM pVM, PPATCHINFO pPatch, RTRCPTR pInstrGC);
[1]41
[9228]42int patmPatchGenCall(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pInstrGC, RTRCPTR pTargetGC, bool fIndirect);
[9212]43int patmPatchGenRet(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RCPTRTYPE(uint8_t *) pCurInstrGC);
[1]44
[9228]45int patmPatchGenPatchJump(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC, RCPTRTYPE(uint8_t *) pPatchAddrGC, bool fAddLookupRecord = true);
[1]46
47/**
48 * Generate indirect jump to unknown destination
49 *
50 * @returns VBox status code.
[41801]51 * @param pVM Pointer to the VM.
[1]52 * @param pPatch Patch record
53 * @param pCpu Disassembly state
54 * @param pCurInstrGC Current instruction address
55 */
[9228]56int patmPatchGenJump(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCurInstrGC);
[1]57
58/**
59 * Generate a trap handler entrypoint
60 *
61 * @returns VBox status code.
[41801]62 * @param pVM Pointer to the VM.
[1]63 * @param pPatch Patch record
64 * @param pTrapHandlerGC IDT handler address
65 */
[9228]66int patmPatchGenTrapEntry(PVM pVM, PPATCHINFO pPatch, RTRCPTR pTrapHandlerGC);
[1]67
68/**
69 * Generate an interrupt handler entrypoint
70 *
71 * @returns VBox status code.
[41801]72 * @param pVM Pointer to the VM.
[1]73 * @param pPatch Patch record
74 * @param pIntHandlerGC IDT handler address
75 */
[9228]76int patmPatchGenIntEntry(PVM pVM, PPATCHINFO pPatch, RTRCPTR pIntHandlerGC);
[1]77
78/**
79 * Generate the jump from guest to patch code
80 *
81 * @returns VBox status code.
[41801]82 * @param pVM Pointer to the VM.
[1]83 * @param pPatch Patch record
84 * @param pTargetGC Guest target jump
85 * @param fClearInhibitIRQs Clear inhibit irq flag
86 */
[9212]87int patmPatchGenJumpToGuest(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pReturnAddrGC, bool fClearInhibitIRQs = false);
[1]88
89/**
90 * Generate illegal instruction (int 3)
91 *
92 * @returns VBox status code.
[41801]93 * @param pVM Pointer to the VM.
[1]94 * @param pPatch Patch structure
95 *
96 */
97int patmPatchGenIllegalInstr(PVM pVM, PPATCHINFO pPatch);
98
99/**
100 * Set PATM interrupt flag
101 *
102 * @returns VBox status code.
[41801]103 * @param pVM Pointer to the VM.
[1]104 * @param pPatch Patch structure
105 * @param pInstrGC Corresponding guest instruction
106 *
107 */
[9228]108int patmPatchGenSetPIF(PVM pVM, PPATCHINFO pPatch, RTRCPTR pInstrGC);
[1]109
110/**
111 * Clear PATM interrupt flag
112 *
113 * @returns VBox status code.
[41801]114 * @param pVM Pointer to the VM.
[1]115 * @param pPatch Patch structure
116 * @param pInstrGC Corresponding guest instruction
117 *
118 */
[9228]119int patmPatchGenClearPIF(PVM pVM, PPATCHINFO pPatch, RTRCPTR pInstrGC);
[1]120
121/**
122 * Clear PATM inhibit irq flag
123 *
124 * @returns VBox status code.
[41801]125 * @param pVM Pointer to the VM.
[1]126 * @param pPatch Patch structure
127 * @param pNextInstrGC Next guest instruction
128 */
[9228]129int patmPatchGenClearInhibitIRQ(PVM pVM, PPATCHINFO pPatch, RTRCPTR pNextInstrGC);
[1]130
131/**
132 * Check virtual IF flag and jump back to original guest code if set
133 *
134 * @returns VBox status code.
[41801]135 * @param pVM Pointer to the VM.
[1]136 * @param pPatch Patch structure
137 * @param pCurInstrGC Guest context pointer to the current instruction
138 *
139 */
[9228]140int patmPatchGenCheckIF(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC);
[1]141
142/**
143 * Generate all global patm functions
144 *
145 * @returns VBox status code.
[41801]146 * @param pVM Pointer to the VM.
[1]147 * @param pPatch Patch structure
148 *
149 */
150int patmPatchGenGlobalFunctions(PVM pVM, PPATCHINFO pPatch);
151
[3723]152#endif
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use