VirtualBox

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

Last change on this file since 1284 was 23, checked in by vboxsync, 18 years ago

string.h & stdio.h + header cleanups.

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