VirtualBox

source: vbox/trunk/include/VBox/iom.h@ 2257

Last change on this file since 2257 was 2225, checked in by vboxsync, 18 years ago

Added IOMInterpretIN & IOMInterpretOUT

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 22.6 KB
Line 
1/** @file
2 * IOM - Input / Output Monitor.
3 */
4
5/*
6 * Copyright (C) 2006 InnoTek Systemberatung GmbH
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.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 * If you received this file as part of a commercial VirtualBox
17 * distribution, then only the terms of your commercial VirtualBox
18 * license agreement apply instead of the previous paragraph.
19 */
20
21#ifndef __VBox_iom_h__
22#define __VBox_iom_h__
23
24
25#include <VBox/cdefs.h>
26#include <VBox/types.h>
27#include <VBox/cpum.h>
28#include <VBox/dis.h>
29
30__BEGIN_DECLS
31
32
33/** @defgroup grp_iom The Input / Ouput Monitor API
34 * @{
35 */
36
37/** @def IOM_NO_PDMINS_CHECKS
38 * Untill all devices have been fully adjusted to PDM style, the pPdmIns parameter
39 * is not checked by IOM.
40 */
41#define IOM_NO_PDMINS_CHECKS
42
43
44/**
45 * Port I/O Handler for IN operations.
46 *
47 * @returns VINF_SUCCESS or VINF_EM_*.
48 * @returns VERR_IOM_IOPORT_UNUSED if the port is really unused and a ~0 value should be returned.
49 *
50 * @param pDevIns The device instance.
51 * @param pvUser User argument.
52 * @param uPort Port number used for the IN operation.
53 * @param pu32 Where to store the result.
54 * @param cb Number of bytes read.
55 */
56typedef DECLCALLBACK(int) FNIOMIOPORTIN(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb);
57/** Pointer to a FNIOMIOPORTIN(). */
58typedef FNIOMIOPORTIN *PFNIOMIOPORTIN;
59
60/**
61 * Port I/O Handler for string IN operations.
62 *
63 * @returns VINF_SUCCESS or VINF_EM_*.
64 * @returns VERR_IOM_IOPORT_UNUSED if the port is really unused and a ~0 value should be returned.
65 *
66 * @param pDevIns The device instance.
67 * @param pvUser User argument.
68 * @param uPort Port number used for the IN operation.
69 * @param pGCPtrDst Pointer to the destination buffer (GC, incremented appropriately).
70 * @param pcTransfers Pointer to the number of transfer units to read, on return remaining transfer units.
71 * @param cb Size of the transfer unit (1, 2 or 4 bytes).
72 */
73typedef DECLCALLBACK(int) FNIOMIOPORTINSTRING(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, RTGCPTR *pGCPtrDst, unsigned *pcTransfers, unsigned cb);
74/** Pointer to a FNIOMIOPORTINSTRING(). */
75typedef FNIOMIOPORTINSTRING *PFNIOMIOPORTINSTRING;
76
77/**
78 * Port I/O Handler for OUT operations.
79 *
80 * @returns VINF_SUCCESS or VINF_EM_*.
81 *
82 * @param pDevIns The device instance.
83 * @param pvUser User argument.
84 * @param uPort Port number used for the OUT operation.
85 * @param u32 The value to output.
86 * @param cb The value size in bytes.
87 */
88typedef DECLCALLBACK(int) FNIOMIOPORTOUT(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb);
89/** Pointer to a FNIOMIOPORTOUT(). */
90typedef FNIOMIOPORTOUT *PFNIOMIOPORTOUT;
91
92/**
93 * Port I/O Handler for string OUT operations.
94 *
95 * @returns VINF_SUCCESS or VINF_EM_*.
96 *
97 * @param pDevIns The device instance.
98 * @param pvUser User argument.
99 * @param uPort Port number used for the OUT operation.
100 * @param pGCPtrSrc Pointer to the source buffer (GC, incremented appropriately).
101 * @param pcTransfers Pointer to the number of transfer units to write, on return remaining transfer units.
102 * @param cb Size of the transfer unit (1, 2 or 4 bytes).
103 */
104typedef DECLCALLBACK(int) FNIOMIOPORTOUTSTRING(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, RTGCPTR *pGCPtrSrc, unsigned *pcTransfers, unsigned cb);
105/** Pointer to a FNIOMIOPORTOUTSTRING(). */
106typedef FNIOMIOPORTOUTSTRING *PFNIOMIOPORTOUTSTRING;
107
108
109/**
110 * Memory mapped I/O Handler for read operations.
111 *
112 * @returns VBox status code.
113 *
114 * @param pDevIns The device instance.
115 * @param pvUser User argument.
116 * @param GCPhysAddr Physical address (in GC) where the read starts.
117 * @param pv Where to store the result.
118 * @param cb Number of bytes read.
119 *
120 * @remark wonder if we could merge the IOMMMIO* and IOMPORT* callbacks...
121 */
122typedef DECLCALLBACK(int) FNIOMMMIOREAD(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb);
123/** Pointer to a FNIOMMMIOREAD(). */
124typedef FNIOMMMIOREAD *PFNIOMMMIOREAD;
125
126/**
127 * Port I/O Handler for write operations.
128 *
129 * @returns VBox status code.
130 *
131 * @param pDevIns The device instance.
132 * @param pvUser User argument.
133 * @param GCPhysAddr Physical address (in GC) where the read starts.
134 * @param pv Where to fetch the result.
135 * @param cb Number of bytes to write.
136 *
137 * @remark wonder if we could merge the IOMMMIO* and IOMPORT* callbacks...
138 */
139typedef DECLCALLBACK(int) FNIOMMMIOWRITE(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb);
140/** Pointer to a FNIOMMMIOWRITE(). */
141typedef FNIOMMMIOWRITE *PFNIOMMMIOWRITE;
142
143/**
144 * Port I/O Handler for memset operations, actually for REP STOS* instructions handling.
145 *
146 * @returns VBox status code.
147 *
148 * @param pDevIns The device instance.
149 * @param pvUser User argument.
150 * @param GCPhysAddr Physical address (in GC) where the write starts.
151 * @param u32Item Byte/Word/Dword data to fill.
152 * @param cbItem Size of data in u32Item parameter, restricted to 1/2/4 bytes.
153 * @param cItems Number of iterations.
154 */
155typedef DECLCALLBACK(int) FNIOMMMIOFILL(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, uint32_t u32Item, unsigned cbItem, unsigned cItems);
156/** Pointer to a FNIOMMMIOFILL(). */
157typedef FNIOMMMIOFILL *PFNIOMMMIOFILL;
158
159
160
161/**
162 * Registers a Port IO GC handler.
163 *
164 * This API is called by PDM on behalf of a device. Devices must first register HC ranges
165 * using IOMR3IOPortRegisterHC() before calling this function.
166 *
167 *
168 * @returns VBox status code.
169 *
170 * @param pVM VM handle.
171 * @param pDevIns PDM device instance owning the port range.
172 * @param PortStart First port number in the range.
173 * @param cPorts Number of ports to register.
174 * @param pvUser User argument for the callbacks.
175 * @param pfnOutCallback Pointer to function which is gonna handle OUT operations in GC.
176 * @param pfnInCallback Pointer to function which is gonna handle IN operations in GC.
177 * @param pfnOutStrCallback Pointer to function which is gonna handle OUT operations in GC.
178 * @param pfnInStrCallback Pointer to function which is gonna handle IN operations in GC.
179 * @param pszDesc Pointer to description string. This must not be freed.
180 */
181IOMDECL(int) IOMIOPortRegisterGC(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts, RTGCPTR pvUser,
182 GCPTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback, GCPTRTYPE(PFNIOMIOPORTIN) pfnInCallback,
183 GCPTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback, GCPTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback,
184 const char *pszDesc);
185
186
187
188/**
189 * Registers a Memory Mapped I/O GC handler range.
190 *
191 * This API is called by PDM on behalf of a device. Devices must first register HC ranges
192 * using IOMMR3MIORegisterHC() before calling this function.
193 *
194 *
195 * @returns VBox status code.
196 *
197 * @param pVM VM handle.
198 * @param pDevIns PDM device instance owning the MMIO range.
199 * @param GCPhysStart First physical address in the range.
200 * @param cbRange The size of the range (in bytes).
201 * @param pvUser User argument for the callbacks.
202 * @param pfnWriteCallback Pointer to function which is gonna handle Write operations.
203 * @param pfnReadCallback Pointer to function which is gonna handle Read operations.
204 * @param pfnFillCallback Pointer to function which is gonna handle Fill/memset operations.
205 * @param pszDesc Pointer to description string. This must not be freed.
206 */
207IOMDECL(int) IOMMMIORegisterGC(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTGCPTR pvUser,
208 GCPTRTYPE(PFNIOMMMIOWRITE) pfnWriteCallback, GCPTRTYPE(PFNIOMMMIOREAD) pfnReadCallback,
209 GCPTRTYPE(PFNIOMMMIOFILL) pfnFillCallback, const char *pszDesc);
210
211
212/**
213 * Registers a Port IO R0 handler.
214 *
215 * This API is called by PDM on behalf of a device. Devices must first register ring-3 ranges
216 * using IOMR3IOPortRegisterR3() before calling this function.
217 *
218 *
219 * @returns VBox status code.
220 *
221 * @param pVM VM handle.
222 * @param pDevIns PDM device instance owning the port range.
223 * @param PortStart First port number in the range.
224 * @param cPorts Number of ports to register.
225 * @param pvUser User argument for the callbacks.
226 * @param pfnOutCallback Pointer to function which is gonna handle OUT operations in GC.
227 * @param pfnInCallback Pointer to function which is gonna handle IN operations in GC.
228 * @param pfnOutStrCallback Pointer to function which is gonna handle OUT operations in GC.
229 * @param pfnInStrCallback Pointer to function which is gonna handle IN operations in GC.
230 * @param pszDesc Pointer to description string. This must not be freed.
231 */
232IOMDECL(int) IOMIOPortRegisterR0(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts, RTHCPTR pvUser,
233 HCPTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback, HCPTRTYPE(PFNIOMIOPORTIN) pfnInCallback,
234 HCPTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStrCallback, HCPTRTYPE(PFNIOMIOPORTINSTRING) pfnInStrCallback,
235 const char *pszDesc);
236
237/**
238 * Registers a Memory Mapped I/O R0 handler range.
239 *
240 * This API is called by PDM on behalf of a device. Devices must first register ring-3 ranges
241 * using IOMMR3MIORegisterR3() before calling this function.
242 *
243 *
244 * @returns VBox status code.
245 *
246 * @param pVM VM handle.
247 * @param pDevIns PDM device instance owning the MMIO range.
248 * @param GCPhysStart First physical address in the range.
249 * @param cbRange The size of the range (in bytes).
250 * @param pvUser User argument for the callbacks.
251 * @param pfnWriteCallback Pointer to function which is gonna handle Write operations.
252 * @param pfnReadCallback Pointer to function which is gonna handle Read operations.
253 * @param pfnFillCallback Pointer to function which is gonna handle Fill/memset operations.
254 * @param pszDesc Pointer to description string. This must not be freed.
255 */
256IOMDECL(int) IOMMMIORegisterR0(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTHCPTR pvUser,
257 HCPTRTYPE(PFNIOMMMIOWRITE) pfnWriteCallback, HCPTRTYPE(PFNIOMMMIOREAD) pfnReadCallback,
258 HCPTRTYPE(PFNIOMMMIOFILL) pfnFillCallback, const char *pszDesc);
259
260
261/**
262 * Reads an I/O port register.
263 *
264 * @returns VBox status code.
265 *
266 * @param pVM VM handle.
267 * @param Port The port to read.
268 * @param pu32Value Where to store the value read.
269 * @param cbValue The size of the register to read in bytes. 1, 2 or 4 bytes.
270 */
271IOMDECL(int) IOMIOPortRead(PVM pVM, RTIOPORT Port, uint32_t *pu32Value, size_t cbValue);
272
273/**
274 * Writes to an I/O port register.
275 *
276 * @returns VBox status code.
277 *
278 * @param pVM VM handle.
279 * @param Port The port to write to.
280 * @param u32Value The value to write.
281 * @param cbValue The size of the register to read in bytes. 1, 2 or 4 bytes.
282 */
283IOMDECL(int) IOMIOPortWrite(PVM pVM, RTIOPORT Port, uint32_t u32Value, size_t cbValue);
284
285/**
286 * OUT <DX|imm16>, <AL|AX|EAX>
287 *
288 * @returns VBox status code.
289 *
290 * @param pVM The virtual machine (GC pointer ofcourse).
291 * @param pRegFrame Pointer to CPUMCTXCORE guest registers structure.
292 * @param pCpu Disassembler CPU state.
293 */
294IOMDECL(int) IOMInterpretOUT(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu);
295
296/**
297 * IN <AL|AX|EAX>, <DX|imm16>
298 *
299 * @returns VBox status code.
300 *
301 * @param pVM The virtual machine (GC pointer ofcourse).
302 * @param pRegFrame Pointer to CPUMCTXCORE guest registers structure.
303 * @param pCpu Disassembler CPU state.
304 */
305IOMDECL(int) IOMInterpretIN(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu);
306
307
308/**
309 * Reads the string buffer of an I/O port register.
310 *
311 * @returns VBox status code.
312 *
313 * @param pVM VM handle.
314 * @param Port The port to read.
315 * @param pGCPtrDst Pointer to the destination buffer (GC, incremented appropriately).
316 * @param pcTransfers Pointer to the number of transfer units to read, on return remaining transfer units.
317 * @param cb Size of the transfer unit (1, 2 or 4 bytes).
318 */
319IOMDECL(int) IOMIOPortReadString(PVM pVM, RTIOPORT Port, PRTGCPTR pGCPtrDst, PRTGCUINTREG pcTransfers, unsigned cb);
320
321/**
322 * Writes the string buffer of an I/O port register.
323 *
324 * @returns VBox status code.
325 *
326 * @param pVM VM handle.
327 * @param Port The port to write.
328 * @param pGCPtrSrc Pointer to the source buffer (GC, incremented appropriately).
329 * @param pcTransfer Pointer to the number of transfer units to write, on return remaining transfer units.
330 * @param cb Size of the transfer unit (1, 2 or 4 bytes).
331 */
332IOMDECL(int) IOMIOPortWriteString(PVM pVM, RTIOPORT Port, PRTGCPTR pGCPtrSrc, PRTGCUINTREG pcTransfers, unsigned cb);
333
334/**
335 * [REP*] INSB/INSW/INSD
336 * ES:EDI,DX[,ECX]
337 *
338 * @returns VBox status code.
339 *
340 * @param pVM The virtual machine (GC pointer ofcourse).
341 * @param pRegFrame Pointer to CPUMCTXCORE guest registers structure.
342 * @param pCpu Disassembler CPU state.
343 */
344IOMDECL(int) IOMInterpretINS(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu);
345
346/**
347 * [REP*] INSB/INSW/INSD
348 * ES:EDI,DX[,ECX]
349 *
350 * @note Assumes caller checked the access privileges (IOMInterpretCheckPortIOAccess)
351 *
352 * @returns VBox status code.
353 *
354 * @param pVM The virtual machine (GC pointer ofcourse).
355 * @param pRegFrame Pointer to CPUMCTXCORE guest registers structure.
356 * @param uPort IO Port
357 * @param uPrefix IO instruction prefix
358 * @param cbTransfer Size of transfer unit
359 */
360IOMDECL(int) IOMInterpretINSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, uint32_t cbTransfer);
361
362/**
363 * [REP*] OUTSB/OUTSW/OUTSD
364 * DS:ESI,DX[,ECX]
365 *
366 * @returns VBox status code.
367 *
368 * @param pVM The virtual machine (GC pointer ofcourse).
369 * @param pRegFrame Pointer to CPUMCTXCORE guest registers structure.
370 * @param pCpu Disassembler CPU state.
371 */
372IOMDECL(int) IOMInterpretOUTS(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu);
373
374/**
375 * [REP*] OUTSB/OUTSW/OUTSD
376 * DS:ESI,DX[,ECX]
377 *
378 * @note Assumes caller checked the access privileges (IOMInterpretCheckPortIOAccess)
379 *
380 * @returns VBox status code.
381 *
382 * @param pVM The virtual machine (GC pointer ofcourse).
383 * @param pRegFrame Pointer to CPUMCTXCORE guest registers structure.
384 * @param uPort IO Port
385 * @param uPrefix IO instruction prefix
386 * @param cbTransfer Size of transfer unit
387 */
388IOMDECL(int) IOMInterpretOUTSEx(PVM pVM, PCPUMCTXCORE pRegFrame, uint32_t uPort, uint32_t uPrefix, uint32_t cbTransfer);
389
390/**
391 * Flushes the IOM port & statistics lookup cache
392 *
393 * @param pVM The VM.
394 */
395IOMDECL(void) IOMFlushCache(PVM pVM);
396
397/**
398 * Reads a MMIO register.
399 *
400 * @returns VBox status code.
401 *
402 * @param pVM VM handle.
403 * @param GCPhys The physical address to read.
404 * @param pu32Value Where to store the value read.
405 * @param cbValue The size of the register to read in bytes. 1, 2 or 4 bytes.
406 */
407IOMDECL(int) IOMMMIORead(PVM pVM, RTGCPHYS GCPhys, uint32_t *pu32Value, size_t cbValue);
408
409/**
410 * Writes to a MMIO register.
411 *
412 * @returns VBox status code.
413 *
414 * @param pVM VM handle.
415 * @param GCPhys The physical address to write to.
416 * @param u32Value The value to write.
417 * @param cbValue The size of the register to read in bytes. 1, 2 or 4 bytes.
418 */
419IOMDECL(int) IOMMMIOWrite(PVM pVM, RTGCPHYS GCPhys, uint32_t u32Value, size_t cbValue);
420
421
422/**
423 * Checks that the operation is allowed according to the IOPL
424 * level and I/O bitmap.
425 *
426 * @returns VBox status code.
427 * If not VINF_SUCCESS a \#GP(0) was raised or an error occured.
428 *
429 * @param pVM VM handle.
430 * @param pCtxCore Pointer to register frame.
431 * @param Port The I/O port number.
432 * @param cb The access size.
433 */
434IOMDECL(int) IOMInterpretCheckPortIOAccess(PVM pVM, PCPUMCTXCORE pCtxCore, RTIOPORT Port, unsigned cb);
435
436
437#ifdef IN_GC
438/** @defgroup grp_iom_gc The IOM Guest Context API
439 * @ingroup grp_iom
440 * @{
441 */
442
443/**
444 * Attempts to service an IN/OUT instruction.
445 *
446 * The \#GP trap handler in GC will call this function if the opcode causing the
447 * trap is a in or out type instruction.
448 *
449 * @returns VBox status code.
450 *
451 * @param pVM The virtual machine (GC pointer ofcourse).
452 * @param pRegFrame Pointer to CPUMCTXCORE guest registers structure.
453 * @param pCpu Disassembler CPU state.
454 */
455IOMGCDECL(int) IOMGCIOPortHandler(PVM pVM, PCPUMCTXCORE pRegFrame, PDISCPUSTATE pCpu);
456
457/** @} */
458#endif
459
460
461
462#ifdef IN_RING3
463/** @defgroup grp_iom_r3 The IOM Host Context Ring-3 API
464 * @ingroup grp_iom
465 * @{
466 */
467
468/**
469 * Initializes the IOM.
470 *
471 * @returns VBox status code.
472 * @param pVM The VM to operate on.
473 */
474IOMR3DECL(int) IOMR3Init(PVM pVM);
475
476/**
477 * The VM is being reset.
478 *
479 * @param pVM VM handle.
480 */
481IOMR3DECL(void) IOMR3Reset(PVM pVM);
482
483/**
484 * Applies relocations to data and code managed by this
485 * component. This function will be called at init and
486 * whenever the VMM need to relocate it self inside the GC.
487 *
488 * The IOM will update the addresses used by the switcher.
489 *
490 * @param pVM The VM.
491 * @param offDelta Relocation delta relative to old location.
492 */
493IOMR3DECL(void) IOMR3Relocate(PVM pVM, RTGCINTPTR offDelta);
494
495/**
496 * Terminates the IOM.
497 *
498 * Termination means cleaning up and freeing all resources,
499 * the VM it self is at this point powered off or suspended.
500 *
501 * @returns VBox status code.
502 * @param pVM The VM to operate on.
503 */
504IOMR3DECL(int) IOMR3Term(PVM pVM);
505
506/**
507 * Registers a I/O port R3 handler.
508 *
509 * This API is called by PDM on behalf of a device. Devices must first register
510 * ring-3 ranges before any GC and R0 ranges can be registered using IOMIOPortRegisterGC()
511 * and IOMIOPortRegisterR0().
512 *
513 * @returns VBox status code.
514 *
515 * @param pVM VM handle.
516 * @param pDevIns PDM device instance owning the port range.
517 * @param PortStart First port number in the range.
518 * @param cPorts Number of ports to register.
519 * @param pvUser User argument for the callbacks.
520 * @param pfnOutCallback Pointer to function which is gonna handle OUT operations in R3.
521 * @param pfnInCallback Pointer to function which is gonna handle IN operations in R3.
522 * @param pfnOutStringCallback Pointer to function which is gonna handle string OUT operations in R3.
523 * @param pfnInStringCallback Pointer to function which is gonna handle string IN operations in R3.
524 * @param pszDesc Pointer to description string. This must not be freed.
525 */
526IOMR3DECL(int) IOMR3IOPortRegisterR3(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts, RTHCPTR pvUser,
527 HCPTRTYPE(PFNIOMIOPORTOUT) pfnOutCallback, HCPTRTYPE(PFNIOMIOPORTIN) pfnInCallback,
528 HCPTRTYPE(PFNIOMIOPORTOUTSTRING) pfnOutStringCallback, HCPTRTYPE(PFNIOMIOPORTINSTRING) pfnInStringCallback,
529 const char *pszDesc);
530
531/**
532 * Registers a Memory Mapped I/O R3 handler.
533 *
534 * This API is called by PDM on behalf of a device. Devices must register ring-3 ranges
535 * before any GC and R0 ranges can be registered using IOMMMIORegisterGC() and IOMMMIORegisterR0().
536 *
537 * @returns VBox status code.
538 *
539 * @param pVM VM handle.
540 * @param pDevIns PDM device instance owning the MMIO range.
541 * @param GCPhysStart First physical address in the range.
542 * @param cbRange The size of the range (in bytes).
543 * @param pvUser User argument for the callbacks.
544 * @param pfnWriteCallback Pointer to function which is gonna handle Write operations.
545 * @param pfnReadCallback Pointer to function which is gonna handle Read operations.
546 * @param pfnFillCallback Pointer to function which is gonna handle Fill/memset operations.
547 * @param pszDesc Pointer to description string. This must not be freed.
548 */
549IOMR3DECL(int) IOMR3MMIORegisterR3(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, RTHCPTR pvUser,
550 HCPTRTYPE(PFNIOMMMIOWRITE) pfnWriteCallback, HCPTRTYPE(PFNIOMMMIOREAD) pfnReadCallback,
551 HCPTRTYPE(PFNIOMMMIOFILL) pfnFillCallback, const char *pszDesc);
552
553
554
555/**
556 * Deregisters a I/O Port range.
557 *
558 * The specified range must be registered using IOMR3IOPortRegister previous to
559 * this call. The range does can be a smaller part of the range specified to
560 * IOMR3IOPortRegister, but it can never be larger.
561 *
562 * This function will remove GC, R0 and R3 context port handlers for this range.
563 *
564 * @returns VBox status code.
565 *
566 * @param pVM The virtual machine.
567 * @param pDevIns The device instance associated with the range.
568 * @param PortStart First port number in the range.
569 * @param cPorts Number of ports to remove starting at PortStart.
570 */
571IOMR3DECL(int) IOMR3IOPortDeregister(PVM pVM, PPDMDEVINS pDevIns, RTIOPORT PortStart, RTUINT cPorts);
572
573
574/**
575 * Deregisters a Memory Mapped I/O handler range.
576 *
577 * Registered GC, R0, and R3 ranges are affected.
578 *
579 * @returns VBox status code.
580 *
581 * @param pVM The virtual machine.
582 * @param pDevIns Device instance which the MMIO region is registered.
583 * @param GCPhysStart First physical address (GC) in the range.
584 * @param cbRange Number of bytes to deregister.
585 *
586 *
587 * @remark This function mainly for PCI PnP Config and will not do
588 * all the checks you might expect it to do.
589 */
590IOMR3DECL(int) IOMR3MMIODeregister(PVM pVM, PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange);
591
592
593/** @} */
594#endif
595
596
597/** @} */
598
599__END_DECLS
600
601#endif
602
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