VirtualBox

source: vbox/trunk/src/VBox/VMM/PATM/PATMPatch.h@ 14605

Last change on this file since 14605 was 9228, checked in by vboxsync, 17 years ago

More updates for 64 bits guest pointers. Introduced AVLOU32TREE.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.7 KB
Line 
1/* $Id: PATMPatch.h 9228 2008-05-29 15:23:15Z vboxsync $ */
2/** @file
3 * PATMPatch - Internal header file.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
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
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.
16 *
17 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21#ifndef ___PATMPATCH_H
22#define ___PATMPATCH_H
23
24int patmPatchAddReloc32(PVM pVM, PPATCHINFO pPatch, uint8_t *pRelocHC, uint32_t uType, RTRCPTR pSource = 0, RTRCPTR pDest = 0);
25int patmPatchAddJump(PVM pVM, PPATCHINFO pPatch, uint8_t *pJumpHC, uint32_t offset, RTRCPTR pTargetGC, uint32_t opcode);
26
27int patmPatchGenCpuid(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC);
28int patmPatchGenSxDT(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCurInstrGC);
29int patmPatchGenSldtStr(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCurInstrGC);
30int patmPatchGenMovControl(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu);
31int patmPatchGenMovDebug(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu);
32int patmPatchGenMovFromSS(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCurInstrGC);
33int patmPatchGenRelJump(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pTargetGC, uint32_t opcode, bool fSizeOverride);
34int patmPatchGenLoop(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pTargetGC, uint32_t opcode, bool fSizeOverride);
35int patmPatchGenPushf(PVM pVM, PPATCHINFO pPatch, bool fSizeOverride);
36int patmPatchGenPopf(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pReturnAddrGC, bool fSizeOverride, bool fGenJumpBack);
37int patmPatchGenSti(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC, RTRCPTR pNextInstrGC);
38
39int patmPatchGenCli(PVM pVM, PPATCHINFO pPatch);
40int patmPatchGenIret(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC, bool fSizeOverride);
41int patmPatchGenDuplicate(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RCPTRTYPE(uint8_t *) pCurInstrGC);
42int patmPatchGenPushCS(PVM pVM, PPATCHINFO pPatch);
43
44int patmPatchGenStats(PVM pVM, PPATCHINFO pPatch, RTRCPTR pInstrGC);
45
46int patmPatchGenCall(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pInstrGC, RTRCPTR pTargetGC, bool fIndirect);
47int patmPatchGenRet(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RCPTRTYPE(uint8_t *) pCurInstrGC);
48
49int patmPatchGenPatchJump(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC, RCPTRTYPE(uint8_t *) pPatchAddrGC, bool fAddLookupRecord = true);
50
51/**
52 * Generate indirect jump to unknown destination
53 *
54 * @returns VBox status code.
55 * @param pVM The VM to operate on.
56 * @param pPatch Patch record
57 * @param pCpu Disassembly state
58 * @param pCurInstrGC Current instruction address
59 */
60int patmPatchGenJump(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTRCPTR pCurInstrGC);
61
62/**
63 * Generate a trap handler entrypoint
64 *
65 * @returns VBox status code.
66 * @param pVM The VM to operate on.
67 * @param pPatch Patch record
68 * @param pTrapHandlerGC IDT handler address
69 */
70int patmPatchGenTrapEntry(PVM pVM, PPATCHINFO pPatch, RTRCPTR pTrapHandlerGC);
71
72/**
73 * Generate an interrupt handler entrypoint
74 *
75 * @returns VBox status code.
76 * @param pVM The VM to operate on.
77 * @param pPatch Patch record
78 * @param pIntHandlerGC IDT handler address
79 */
80int patmPatchGenIntEntry(PVM pVM, PPATCHINFO pPatch, RTRCPTR pIntHandlerGC);
81
82/**
83 * Generate the jump from guest to patch code
84 *
85 * @returns VBox status code.
86 * @param pVM The VM to operate on.
87 * @param pPatch Patch record
88 * @param pTargetGC Guest target jump
89 * @param fClearInhibitIRQs Clear inhibit irq flag
90 */
91int patmPatchGenJumpToGuest(PVM pVM, PPATCHINFO pPatch, RCPTRTYPE(uint8_t *) pReturnAddrGC, bool fClearInhibitIRQs = false);
92
93/**
94 * Generate illegal instruction (int 3)
95 *
96 * @returns VBox status code.
97 * @param pVM The VM to operate on.
98 * @param pPatch Patch structure
99 *
100 */
101int patmPatchGenIllegalInstr(PVM pVM, PPATCHINFO pPatch);
102
103/**
104 * Set PATM interrupt flag
105 *
106 * @returns VBox status code.
107 * @param pVM The VM to operate on.
108 * @param pPatch Patch structure
109 * @param pInstrGC Corresponding guest instruction
110 *
111 */
112int patmPatchGenSetPIF(PVM pVM, PPATCHINFO pPatch, RTRCPTR pInstrGC);
113
114/**
115 * Clear PATM interrupt flag
116 *
117 * @returns VBox status code.
118 * @param pVM The VM to operate on.
119 * @param pPatch Patch structure
120 * @param pInstrGC Corresponding guest instruction
121 *
122 */
123int patmPatchGenClearPIF(PVM pVM, PPATCHINFO pPatch, RTRCPTR pInstrGC);
124
125/**
126 * Clear PATM inhibit irq flag
127 *
128 * @returns VBox status code.
129 * @param pVM The VM to operate on.
130 * @param pPatch Patch structure
131 * @param pNextInstrGC Next guest instruction
132 */
133int patmPatchGenClearInhibitIRQ(PVM pVM, PPATCHINFO pPatch, RTRCPTR pNextInstrGC);
134
135/**
136 * Check virtual IF flag and jump back to original guest code if set
137 *
138 * @returns VBox status code.
139 * @param pVM The VM to operate on.
140 * @param pPatch Patch structure
141 * @param pCurInstrGC Guest context pointer to the current instruction
142 *
143 */
144int patmPatchGenCheckIF(PVM pVM, PPATCHINFO pPatch, RTRCPTR pCurInstrGC);
145
146/**
147 * Generate all global patm functions
148 *
149 * @returns VBox status code.
150 * @param pVM The VM to operate on.
151 * @param pPatch Patch structure
152 *
153 */
154int patmPatchGenGlobalFunctions(PVM pVM, PPATCHINFO pPatch);
155
156#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette