VirtualBox

source: vbox/trunk/include/VBox/rem.h@ 4172

最後變更 在這個檔案從4172是 4071,由 vboxsync 提交於 18 年 前

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

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Author Date Id Revision
檔案大小: 13.1 KB
 
1/** @file
2 * REM - The Recompiled Execution Manager.
3 */
4
5/*
6 * Copyright (C) 2006-2007 innotek GmbH
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.alldomusa.eu.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License as published by the Free Software Foundation,
12 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
13 * distribution. VirtualBox OSE is distributed in the hope that it will
14 * be useful, but WITHOUT ANY WARRANTY of any kind.
15 */
16
17#ifndef ___VBox_rem_h
18#define ___VBox_rem_h
19
20#include <VBox/cdefs.h>
21#include <VBox/types.h>
22#include <VBox/pgm.h>
23#include <VBox/vmapi.h>
24
25
26__BEGIN_DECLS
27
28/** @defgroup grp_rem The Recompiled Execution Manager API
29 * @{
30 */
31
32/** No pending interrupt. */
33#define REM_NO_PENDING_IRQ (~(uint32_t)0)
34
35
36#if defined(IN_RING0) || defined(IN_GC)
37
38/**
39 * Records a invlpg instruction for replaying upon REM entry.
40 *
41 * @returns VINF_SUCCESS on success.
42 * @returns VERR_REM_FLUSHED_PAGES_OVERFLOW if a return to HC for flushing of
43 * recorded pages is required before the call can succeed.
44 * @param pVM The VM handle.
45 * @param GCPtrPage The address of the invalidated page.
46 */
47REMDECL(int) REMNotifyInvalidatePage(PVM pVM, RTGCPTR GCPtrPage);
48
49/**
50 * Notification about a successful PGMR3HandlerPhysicalRegister() call.
51 *
52 * @param pVM VM Handle.
53 * @param enmType Handler type.
54 * @param GCPhys Handler range address.
55 * @param cb Size of the handler range.
56 * @param fHasHCHandler Set if the handler have a HC callback function.
57 */
58REMDECL(void) REMNotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler);
59
60/**
61 * Notification about a successful PGMR3HandlerPhysicalDeregister() operation.
62 *
63 * @param pVM VM Handle.
64 * @param enmType Handler type.
65 * @param GCPhys Handler range address.
66 * @param cb Size of the handler range.
67 * @param fHasHCHandler Set if the handler have a HC callback function.
68 * @param pvHCPtr The HC virtual address corresponding to GCPhys if available.
69 */
70REMDECL(void) REMNotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, RTHCPTR pvHCPtr);
71
72/**
73 * Notification about a successful PGMR3HandlerPhysicalModify() call.
74 *
75 * @param pVM VM Handle.
76 * @param enmType Handler type.
77 * @param GCPhysOld Old handler range address.
78 * @param GCPhysNew New handler range address.
79 * @param cb Size of the handler range.
80 * @param fHasHCHandler Set if the handler have a HC callback function.
81 * @param pvHCPtr The HC virtual address corresponding to GCPhys if available.
82 */
83REMDECL(void) REMNotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, RTHCPTR pvHCPtr);
84
85#endif /* IN_RING0 || IN_GC */
86
87
88#ifdef IN_RING3
89/** @defgroup grp_rem_r3 REM Host Context Ring 3 API
90 * @ingroup grp_rem
91 * @{
92 */
93
94/**
95 * Initializes the REM.
96 *
97 * @returns VBox status code.
98 * @param pVM The VM to operate on.
99 */
100REMR3DECL(int) REMR3Init(PVM pVM);
101
102/**
103 * Terminates the REM.
104 *
105 * Termination means cleaning up and freeing all resources,
106 * the VM it self is at this point powered off or suspended.
107 *
108 * @returns VBox status code.
109 * @param pVM The VM to operate on.
110 */
111REMR3DECL(int) REMR3Term(PVM pVM);
112
113/**
114 * The VM is being reset.
115 *
116 * For the REM component this means to call the cpu_reset() and
117 * reinitialize some state variables.
118 *
119 * @param pVM VM handle.
120 */
121REMR3DECL(void) REMR3Reset(PVM pVM);
122
123/**
124 * Runs code in recompiled mode.
125 *
126 * Before calling this function the REM state needs to be in sync with
127 * the VM. Call REMR3State() to perform the sync. It's only necessary
128 * (and permitted) to sync at the first call to REMR3Step()/REMR3Run()
129 * and after calling REMR3StateBack().
130 *
131 * @returns VBox status code.
132 *
133 * @param pVM VM Handle.
134 */
135REMR3DECL(int) REMR3Run(PVM pVM);
136
137/**
138 * Emulate an instruction.
139 *
140 * This function executes one instruction without letting anyone
141 * interrupt it. This is intended for being called while being in
142 * raw mode and thus will take care of all the state syncing between
143 * REM and the rest.
144 *
145 * @returns VBox status code.
146 * @param pVM VM handle.
147 */
148REMR3DECL(int) REMR3EmulateInstruction(PVM pVM);
149
150/**
151 * Single steps an instruction in recompiled mode.
152 *
153 * Before calling this function the REM state needs to be in sync with
154 * the VM. Call REMR3State() to perform the sync. It's only necessary
155 * (and permitted) to sync at the first call to REMR3Step()/REMR3Run()
156 * and after calling REMR3StateBack().
157 *
158 * @returns VBox status code.
159 *
160 * @param pVM VM Handle.
161 */
162REMR3DECL(int) REMR3Step(PVM pVM);
163
164/**
165 * Set a breakpoint using the REM facilities.
166 *
167 * @returns VBox status code.
168 * @param pVM The VM handle.
169 * @param Address The breakpoint address.
170 * @thread The emulation thread.
171 */
172REMR3DECL(int) REMR3BreakpointSet(PVM pVM, RTGCUINTPTR Address);
173
174/**
175 * Clears a breakpoint set by REMR3BreakpointSet().
176 *
177 * @returns VBox status code.
178 * @param pVM The VM handle.
179 * @param Address The breakpoint address.
180 * @thread The emulation thread.
181 */
182REMR3DECL(int) REMR3BreakpointClear(PVM pVM, RTGCUINTPTR Address);
183
184/**
185 * Syncs the internal REM state with the VM.
186 *
187 * This must be called before REMR3Run() is invoked whenever when the REM
188 * state is not up to date. Calling it several times in a row is not
189 * permitted.
190 *
191 * @returns VBox status code.
192 *
193 * @param pVM VM Handle.
194 *
195 * @remark The caller has to check for important FFs before calling REMR3Run. REMR3State will
196 * no do this since the majority of the callers don't want any unnecessary of events
197 * pending that would immediatly interrupt execution.
198 */
199REMR3DECL(int) REMR3State(PVM pVM);
200
201/**
202 * Syncs back changes in the REM state to the the VM state.
203 *
204 * This must be called after invoking REMR3Run().
205 * Calling it several times in a row is not permitted.
206 *
207 * @returns VBox status code.
208 *
209 * @param pVM VM Handle.
210 */
211REMR3DECL(int) REMR3StateBack(PVM pVM);
212
213/**
214 * Update the VMM state information if we're currently in REM.
215 *
216 * This method is used by the DBGF and PDMDevice when there is any uncertainty of whether
217 * we're currently executing in REM and the VMM state is invalid. This method will of
218 * course check that we're executing in REM before syncing any data over to the VMM.
219 *
220 * @param pVM The VM handle.
221 */
222REMR3DECL(void) REMR3StateUpdate(PVM pVM);
223
224/**
225 * Notify the recompiler about Address Gate 20 state change.
226 *
227 * This notification is required since A20 gate changes are
228 * initialized from a device driver and the VM might just as
229 * well be in REM mode as in RAW mode.
230 *
231 * @param pVM VM handle.
232 * @param fEnable True if the gate should be enabled.
233 * False if the gate should be disabled.
234 */
235REMR3DECL(void) REMR3A20Set(PVM pVM, bool fEnable);
236
237/**
238 * Enables or disables singled stepped disassembly.
239 *
240 * @returns VBox status code.
241 * @param pVM VM handle.
242 * @param fEnable To enable set this flag, to disable clear it.
243 */
244REMR3DECL(int) REMR3DisasEnableStepping(PVM pVM, bool fEnable);
245
246/**
247 * Replays the recorded invalidated pages.
248 * Called in response to VERR_REM_FLUSHED_PAGES_OVERFLOW from the RAW execution loop.
249 *
250 * @param pVM VM handle.
251 */
252REMR3DECL(void) REMR3ReplayInvalidatedPages(PVM pVM);
253
254/**
255 * Replays the recorded physical handler notifications.
256 *
257 * @param pVM VM handle.
258 */
259REMR3DECL(void) REMR3ReplayHandlerNotifications(PVM pVM);
260
261/**
262 * Notify REM about changed code page.
263 *
264 * @returns VBox status code.
265 * @param pVM VM handle.
266 * @param pvCodePage Code page address
267 */
268REMR3DECL(int) REMR3NotifyCodePageChanged(PVM pVM, RTGCPTR pvCodePage);
269
270/**
271 * Notification about a successful MMR3RamRegister() call.
272 *
273 * @param pVM VM handle.
274 * @param GCPhys The physical address the RAM.
275 * @param cb Size of the memory.
276 * @param fFlags Flags of the MM_RAM_FLAGS_* defines.
277 * @param pvRam The HC address of the RAM.
278 */
279REMR3DECL(void) REMR3NotifyPhysRamRegister(PVM pVM, RTGCPHYS GCPhys, RTUINT cb, void *pvRam, unsigned fFlags);
280
281/**
282 * Notification about a successful PGMR3PhysRegisterChunk() call.
283 *
284 * @param pVM VM handle.
285 * @param GCPhys The physical address the RAM.
286 * @param cb Size of the memory.
287 * @param pvRam The HC address of the RAM.
288 * @param fFlags Flags of the MM_RAM_FLAGS_* defines.
289 */
290REMR3DECL(void) REMR3NotifyPhysRamChunkRegister(PVM pVM, RTGCPHYS GCPhys, RTUINT cb, RTHCUINTPTR pvRam, unsigned fFlags);
291
292/**
293 * Notification about a successful MMR3PhysRomRegister() call.
294 *
295 * @param pVM VM handle.
296 * @param GCPhys The physical address of the ROM.
297 * @param cb The size of the ROM.
298 * @param pvCopy Pointer to the ROM copy.
299 */
300REMR3DECL(void) REMR3NotifyPhysRomRegister(PVM pVM, RTGCPHYS GCPhys, RTUINT cb, void *pvCopy);
301
302/**
303 * Notification about a successful MMR3PhysRegister() call.
304 *
305 * @param pVM VM Handle.
306 * @param GCPhys Start physical address.
307 * @param cb The size of the range.
308 */
309REMR3DECL(void) REMR3NotifyPhysReserve(PVM pVM, RTGCPHYS GCPhys, RTUINT cb);
310
311/**
312 * Notification about a successful PGMR3HandlerPhysicalRegister() call.
313 *
314 * @param pVM VM Handle.
315 * @param enmType Handler type.
316 * @param GCPhys Handler range address.
317 * @param cb Size of the handler range.
318 * @param fHasHCHandler Set if the handler have a HC callback function.
319 */
320REMR3DECL(void) REMR3NotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler);
321
322/**
323 * Notification about a successful PGMR3HandlerPhysicalDeregister() operation.
324 *
325 * @param pVM VM Handle.
326 * @param enmType Handler type.
327 * @param GCPhys Handler range address.
328 * @param cb Size of the handler range.
329 * @param fHasHCHandler Set if the handler have a HC callback function.
330 * @param pvHCPtr The HC virtual address corresponding to GCPhys if available.
331 */
332REMR3DECL(void) REMR3NotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, void *pvHCPtr);
333
334/**
335 * Notification about a successful PGMR3HandlerPhysicalModify() call.
336 *
337 * @param pVM VM Handle.
338 * @param enmType Handler type.
339 * @param GCPhysOld Old handler range address.
340 * @param GCPhysNew New handler range address.
341 * @param cb Size of the handler range.
342 * @param fHasHCHandler Set if the handler have a HC callback function.
343 * @param pvHCPtr The HC virtual address corresponding to GCPhys if available.
344 */
345REMR3DECL(void) REMR3NotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERTYPE enmType, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, void *pvHCPtr);
346
347/**
348 * Notification about a pending interrupt.
349 *
350 * @param pVM VM Handle.
351 * @param u8Interrupt Interrupt
352 * @thread The emulation thread.
353 */
354REMR3DECL(void) REMR3NotifyPendingInterrupt(PVM pVM, uint8_t u8Interrupt);
355
356/**
357 * Notification about a pending interrupt.
358 *
359 * @returns Pending interrupt or REM_NO_PENDING_IRQ
360 * @param pVM VM Handle.
361 * @thread The emulation thread.
362 */
363REMR3DECL(uint32_t) REMR3QueryPendingInterrupt(PVM pVM);
364
365/**
366 * Notification about the interrupt FF being set.
367 *
368 * @param pVM VM Handle.
369 * @thread The emulation thread.
370 */
371REMR3DECL(void) REMR3NotifyInterruptSet(PVM pVM);
372
373/**
374 * Notification about the interrupt FF being set.
375 *
376 * @param pVM VM Handle.
377 * @thread The emulation thread.
378 */
379REMR3DECL(void) REMR3NotifyInterruptClear(PVM pVM);
380
381/**
382 * Notification about pending timer(s).
383 *
384 * @param pVM VM Handle.
385 * @thread Any.
386 */
387REMR3DECL(void) REMR3NotifyTimerPending(PVM pVM);
388
389/**
390 * Notification about pending DMA transfers.
391 *
392 * @param pVM VM Handle.
393 * @thread Any.
394 */
395REMR3DECL(void) REMR3NotifyDmaPending(PVM pVM);
396
397/**
398 * Notification about pending timer(s).
399 *
400 * @param pVM VM Handle.
401 * @thread Any.
402 */
403REMR3DECL(void) REMR3NotifyQueuePending(PVM pVM);
404
405/**
406 * Notification about pending FF set by an external thread.
407 *
408 * @param pVM VM handle.
409 * @thread Any.
410 */
411REMR3DECL(void) REMR3NotifyFF(PVM pVM);
412
413#ifdef VBOX_STRICT
414/**
415 * Checks if we're handling access to this page or not.
416 *
417 * @returns true if we're trapping access.
418 * @returns false if we aren't.
419 * @param pVM The VM handle.
420 * @param GCPhys The physical address.
421 *
422 * @remark This function will only work correctly in VBOX_STRICT builds!
423 */
424REMDECL(bool) REMR3IsPageAccessHandled(PVM pVM, RTGCPHYS GCPhys);
425#endif
426
427/** @} */
428#endif
429
430
431/** @} */
432__END_DECLS
433
434
435#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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