VirtualBox

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

Last change on this file since 2333 was 2046, checked in by vboxsync, 18 years ago

Corrections and activation of mov gpr,ss patch.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.8 KB
Line 
1/* $Id: PATMPatch.h 2046 2007-04-12 13:23:27Z 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 patmPatchGenMovFromSS(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTGCPTR pCurInstrGC);
33int patmPatchGenRelJump(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t *)pTargetGC, uint32_t opcode, bool fSizeOverride);
34int patmPatchGenLoop(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t *)pTargetGC, uint32_t opcode, bool fSizeOverride);
35int patmPatchGenPushf(PVM pVM, PPATCHINFO pPatch, bool fSizeOverride);
36int patmPatchGenPopf(PVM pVM, PPATCHINFO pPatch, GCPTRTYPE(uint8_t *)pReturnAddrGC, bool fSizeOverride, bool fGenJumpBack);
37int patmPatchGenSti(PVM pVM, PPATCHINFO pPatch, RTGCPTR pCurInstrGC, RTGCPTR pNextInstrGC);
38
39int patmPatchGenCli(PVM pVM, PPATCHINFO pPatch);
40int patmPatchGenIret(PVM pVM, PPATCHINFO pPatch, RTGCPTR pCurInstrGC, bool fSizeOverride);
41int patmPatchGenDuplicate(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, GCPTRTYPE(uint8_t *) pCurInstrGC);
42int patmPatchGenPushCS(PVM pVM, PPATCHINFO pPatch);
43
44int patmPatchGenStats(PVM pVM, PPATCHINFO pPatch, RTGCPTR pInstrGC);
45
46int patmPatchGenCall(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, RTGCPTR pInstrGC, RTGCPTR pTargetGC, bool fIndirect);
47int patmPatchGenRet(PVM pVM, PPATCHINFO pPatch, DISCPUSTATE *pCpu, GCPTRTYPE(uint8_t *) pCurInstrGC);
48
49int patmPatchGenPatchJump(PVM pVM, PPATCHINFO pPatch, RTGCPTR pCurInstrGC, GCPTRTYPE(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, RTGCPTR 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, RTGCPTR 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, RTGCPTR 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, GCPTRTYPE(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, RTGCPTR 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, RTGCPTR 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, RTGCPTR 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, RTGCPTR 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 //__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