VirtualBox

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

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

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.5 KB
Line 
1/* $Id: PATMPatch.h 4071 2007-08-07 17:07:59Z vboxsync $ */
2/** @file
3 * PATMPatch - Internal header file.
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
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 as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17#ifndef ___PATMPATCH_H
18#define ___PATMPATCH_H
19
20int patmPatchAddReloc32(PVM pVM, PPATCHINFO pPatch, uint8_t *pRelocHC, uint32_t uType, RTGCPTR pSource = 0, RTGCPTR pDest = 0);
21int patmPatchAddJump(PVM pVM, PPATCHINFO pPatch, uint8_t *pJumpHC, uint32_t offset, RTGCPTR pTargetGC, uint32_t opcode);
22
23int patmPatchGenCpuid(PVM pVM, PPATCHINFO pPatch, RTGCPTR pCurInstrGC);
24int patmPatchGenSxDT(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTGCPTR pCurInstrGC);
25int patmPatchGenSldtStr(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTGCPTR pCurInstrGC);
26int patmPatchGenMovControl(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu);
27int patmPatchGenMovDebug(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu);
28int patmPatchGenMovFromSS(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTGCPTR pCurInstrGC);
29int patmPatchGenRelJump(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t *) pTargetGC, uint32_t opcode, bool fSizeOverride);
30int patmPatchGenLoop(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t *) pTargetGC, uint32_t opcode, bool fSizeOverride);
31int patmPatchGenPushf(PVM pVM, PPATCHINFO pPatch, bool fSizeOverride);
32int patmPatchGenPopf(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t *) pReturnAddrGC, bool fSizeOverride, bool fGenJumpBack);
33int patmPatchGenSti(PVM pVM, PPATCHINFO pPatch, RTGCPTR pCurInstrGC, RTGCPTR pNextInstrGC);
34
35int patmPatchGenCli(PVM pVM, PPATCHINFO pPatch);
36int patmPatchGenIret(PVM pVM, PPATCHINFO pPatch, RTGCPTR pCurInstrGC, bool fSizeOverride);
37int patmPatchGenDuplicate(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, GCPTRTYPE(uint8_t *) pCurInstrGC);
38int patmPatchGenPushCS(PVM pVM, PPATCHINFO pPatch);
39
40int patmPatchGenStats(PVM pVM, PPATCHINFO pPatch, RTGCPTR pInstrGC);
41
42int patmPatchGenCall(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTGCPTR pInstrGC, RTGCPTR pTargetGC, bool fIndirect);
43int patmPatchGenRet(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, GCPTRTYPE(uint8_t *) pCurInstrGC);
44
45int patmPatchGenPatchJump(PVM pVM, PPATCHINFO pPatch, RTGCPTR pCurInstrGC, GCPTRTYPE(uint8_t *) pPatchAddrGC, bool fAddLookupRecord = true);
46
47/**
48 * Generate indirect jump to unknown destination
49 *
50 * @returns VBox status code.
51 * @param pVM The VM to operate on.
52 * @param pPatch Patch record
53 * @param pCpu Disassembly state
54 * @param pCurInstrGC Current instruction address
55 */
56int patmPatchGenJump(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTGCPTR pCurInstrGC);
57
58/**
59 * Generate a trap handler entrypoint
60 *
61 * @returns VBox status code.
62 * @param pVM The VM to operate on.
63 * @param pPatch Patch record
64 * @param pTrapHandlerGC IDT handler address
65 */
66int patmPatchGenTrapEntry(PVM pVM, PPATCHINFO pPatch, RTGCPTR pTrapHandlerGC);
67
68/**
69 * Generate an interrupt handler entrypoint
70 *
71 * @returns VBox status code.
72 * @param pVM The VM to operate on.
73 * @param pPatch Patch record
74 * @param pIntHandlerGC IDT handler address
75 */
76int patmPatchGenIntEntry(PVM pVM, PPATCHINFO pPatch, RTGCPTR pIntHandlerGC);
77
78/**
79 * Generate the jump from guest to patch code
80 *
81 * @returns VBox status code.
82 * @param pVM The VM to operate on.
83 * @param pPatch Patch record
84 * @param pTargetGC Guest target jump
85 * @param fClearInhibitIRQs Clear inhibit irq flag
86 */
87int patmPatchGenJumpToGuest(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t *) pReturnAddrGC, bool fClearInhibitIRQs = false);
88
89/**
90 * Generate illegal instruction (int 3)
91 *
92 * @returns VBox status code.
93 * @param pVM The VM to operate on.
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.
103 * @param pVM The VM to operate on.
104 * @param pPatch Patch structure
105 * @param pInstrGC Corresponding guest instruction
106 *
107 */
108int patmPatchGenSetPIF(PVM pVM, PPATCHINFO pPatch, RTGCPTR pInstrGC);
109
110/**
111 * Clear PATM interrupt flag
112 *
113 * @returns VBox status code.
114 * @param pVM The VM to operate on.
115 * @param pPatch Patch structure
116 * @param pInstrGC Corresponding guest instruction
117 *
118 */
119int patmPatchGenClearPIF(PVM pVM, PPATCHINFO pPatch, RTGCPTR pInstrGC);
120
121/**
122 * Clear PATM inhibit irq flag
123 *
124 * @returns VBox status code.
125 * @param pVM The VM to operate on.
126 * @param pPatch Patch structure
127 * @param pNextInstrGC Next guest instruction
128 */
129int patmPatchGenClearInhibitIRQ(PVM pVM, PPATCHINFO pPatch, RTGCPTR pNextInstrGC);
130
131/**
132 * Check virtual IF flag and jump back to original guest code if set
133 *
134 * @returns VBox status code.
135 * @param pVM The VM to operate on.
136 * @param pPatch Patch structure
137 * @param pCurInstrGC Guest context pointer to the current instruction
138 *
139 */
140int patmPatchGenCheckIF(PVM pVM, PPATCHINFO pPatch, RTGCPTR pCurInstrGC);
141
142/**
143 * Generate all global patm functions
144 *
145 * @returns VBox status code.
146 * @param pVM The VM to operate on.
147 * @param pPatch Patch structure
148 *
149 */
150int patmPatchGenGlobalFunctions(PVM pVM, PPATCHINFO pPatch);
151
152#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