#include "ntvdm.h"
#include <debug.h>
#include "emulator.h"
#include "io.h"
Go to the source code of this file.
|
UCHAR | IOReadB (USHORT Port) |
|
VOID | IOReadStrB (USHORT Port, PUCHAR Buffer, ULONG Count) |
|
VOID | IOWriteB (USHORT Port, UCHAR Buffer) |
|
VOID | IOWriteStrB (USHORT Port, PUCHAR Buffer, ULONG Count) |
|
USHORT | IOReadW (USHORT Port) |
|
VOID | IOReadStrW (USHORT Port, PUSHORT Buffer, ULONG Count) |
|
VOID | IOWriteW (USHORT Port, USHORT Buffer) |
|
VOID | IOWriteStrW (USHORT Port, PUSHORT Buffer, ULONG Count) |
|
ULONG | IOReadD (USHORT Port) |
|
VOID | IOReadStrD (USHORT Port, PULONG Buffer, ULONG Count) |
|
VOID | IOWriteD (USHORT Port, ULONG Buffer) |
|
VOID | IOWriteStrD (USHORT Port, PULONG Buffer, ULONG Count) |
|
VOID | RegisterIoPort (USHORT Port, EMULATOR_INB_PROC InHandler, EMULATOR_OUTB_PROC OutHandler) |
|
VOID | UnregisterIoPort (USHORT Port) |
|
VOID FASTCALL | EmulatorReadIo (PFAST486_STATE State, USHORT Port, PVOID Buffer, ULONG DataCount, UCHAR DataSize) |
|
VOID FASTCALL | EmulatorWriteIo (PFAST486_STATE State, USHORT Port, PVOID Buffer, ULONG DataCount, UCHAR DataSize) |
|
BOOL WINAPI | VDDInstallIOHook (IN HANDLE hVdd, IN WORD cPortRange, IN PVDD_IO_PORTRANGE pPortRange, IN PVDD_IO_HANDLERS IoHandlers) |
|
VOID WINAPI | VDDDeInstallIOHook (IN HANDLE hVdd, IN WORD cPortRange, IN PVDD_IO_PORTRANGE pPortRange) |
|
◆ NDEBUG
Definition at line 14 of file io.c.
◆ EMULATOR_IO_HANDLERS
◆ EMULATOR_IOPORT_HANDLERS
◆ PEMULATOR_IO_HANDLERS
◆ PEMULATOR_IOPORT_HANDLERS
◆ EmulatorReadIo()
Definition at line 349 of file io.c.
354{
356
357 if (
DataSize == 0 || DataCount == 0)
return;
358
360 {
361 if (DataCount == 1)
363 else
365 }
367 {
368 if (DataCount == 1)
370 else
372 }
374 {
375 if (DataCount == 1)
377 else
379 }
380 else
381 {
383
384 while (DataCount--)
385 {
389
390
391 Count = NewDataSize >> 2;
392 NewDataSize = NewDataSize & 3;
394 {
396 CurrentPort +=
sizeof(
ULONG);
398 }
399
400
401 Count = NewDataSize >> 1;
402 NewDataSize = NewDataSize & 1;
404 {
406 CurrentPort +=
sizeof(
USHORT);
408 }
409
410
412
414 {
416 CurrentPort +=
sizeof(
UCHAR);
418 }
419 }
420 }
421}
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
#define UNREFERENCED_PARAMETER(P)
ULONG IOReadD(USHORT Port)
VOID IOReadStrB(USHORT Port, PUCHAR Buffer, ULONG Count)
USHORT IOReadW(USHORT Port)
VOID IOReadStrW(USHORT Port, PUSHORT Buffer, ULONG Count)
VOID IOReadStrD(USHORT Port, PULONG Buffer, ULONG Count)
UCHAR IOReadB(USHORT Port)
Referenced by CpuInitialize().
◆ EmulatorWriteIo()
Definition at line 424 of file io.c.
429{
431
432 if (
DataSize == 0 || DataCount == 0)
return;
433
435 {
436 if (DataCount == 1)
438 else
440 }
442 {
443 if (DataCount == 1)
445 else
447 }
449 {
450 if (DataCount == 1)
452 else
454 }
455 else
456 {
458
459 while (DataCount--)
460 {
464
465
466 Count = NewDataSize >> 2;
467 NewDataSize = NewDataSize & 3;
469 {
471 CurrentPort +=
sizeof(
ULONG);
473 }
474
475
476 Count = NewDataSize >> 1;
477 NewDataSize = NewDataSize & 1;
479 {
481 CurrentPort +=
sizeof(
USHORT);
483 }
484
485
487
489 {
491 CurrentPort +=
sizeof(
UCHAR);
493 }
494 }
495 }
496}
VOID IOWriteB(USHORT Port, UCHAR Buffer)
VOID IOWriteW(USHORT Port, USHORT Buffer)
VOID IOWriteD(USHORT Port, ULONG Buffer)
VOID IOWriteStrW(USHORT Port, PUSHORT Buffer, ULONG Count)
VOID IOWriteStrD(USHORT Port, PULONG Buffer, ULONG Count)
VOID IOWriteStrB(USHORT Port, PUCHAR Buffer, ULONG Count)
Referenced by CpuInitialize().
◆ IOReadB()
Definition at line 64 of file io.c.
65{
68 {
70 }
73 {
78 }
79 else
80 {
81
82 DPRINT(
"Read from unknown port: 0x%X\n",
Port);
83 return 0xFF;
84 }
85}
#define INVALID_HANDLE_VALUE
VDD_IO_HANDLERS VddIoHandlers
EMULATOR_IO_HANDLERS IoHandlers
EMULATOR_IOPORT_HANDLERS IoPortProc[EMULATOR_MAX_IOPORTS_NUM]
Referenced by Bios32Post(), BiosBootstrapLoader(), BiosHandleMasterPicIRQ(), BiosHandleSlavePicIRQ(), BiosKeyboardIrq(), BiosMiscService(), BiosTimeService(), DisableMouseInt(), DosMouseIrq(), EmulatorReadIo(), EnableMouseInt(), EraseMouseCursor(), InitializeBiosData(), IOReadStrB(), IOReadW(), PaintMouseCursor(), PicSetIRQMask(), ReadMouseData(), VbeInitialize(), VbeResetExtendedRegisters(), VbeService(), VbeSetExtendedRegisters(), VgaSetRegisters(), VgaSetSinglePaletteRegister(), VidBiosClearScreen(), VidBiosDrawGlyph(), VidBiosSyncCursorPosition(), and VidBiosVideoService().
◆ IOReadD()
◆ IOReadStrB()
Definition at line 88 of file io.c.
91{
94 {
96 }
99 {
103 }
104 else
105 {
107 }
108}
Referenced by EmulatorReadIo().
◆ IOReadStrD()
◆ IOReadStrW()
Definition at line 183 of file io.c.
186{
189 {
191 }
194 {
198 }
199 else
200 {
202 }
203}
Referenced by EmulatorReadIo().
◆ IOReadW()
◆ IOWriteB()
Definition at line 111 of file io.c.
113{
116 {
118 }
121 {
124 }
125 else
126 {
127
128 DPRINT(
"Write to unknown port: 0x%X\n",
Port);
129 }
130}
Referenced by Bios32Post(), BiosBootstrapLoader(), BiosHandleMasterPicIRQ(), BiosHandleSlavePicIRQ(), BiosHwSetup(), BiosMiscService(), BiosTimeService(), DisableMouseInt(), EmulatorWriteIo(), EnableMouseInt(), EraseMouseCursor(), InitializeBiosData(), IOWriteStrB(), IOWriteW(), MouseBios32Post(), PaintMouseCursor(), PicIRQComplete(), PicSetIRQMask(), SendMouseCommand(), VbeInitialize(), VbeResetExtendedRegisters(), VbeService(), VbeSetExtendedRegisters(), VgaSetPalette(), VgaSetRegisters(), VgaSetSinglePaletteRegister(), VidBiosClearScreen(), VidBiosDrawGlyph(), VidBiosSetCursorPosition(), VidBiosSetCursorShape(), VidBiosSetVideoMode(), VidBiosSetVideoPage(), VidBiosSyncCursorPosition(), and VidBiosVideoService().
◆ IOWriteD()
◆ IOWriteStrB()
Definition at line 133 of file io.c.
136{
139 {
141 }
144 {
148 }
149 else
150 {
152 }
153}
EMULATOR_OUTSB_PROC OutsB
PFNVDD_OUTSB outsb_handler
Referenced by EmulatorWriteIo().
◆ IOWriteStrD()
Definition at line 304 of file io.c.
307{
310 {
312 }
313 else
314 {
316 }
317}
EMULATOR_OUTSD_PROC OutsD
Referenced by EmulatorWriteIo().
◆ IOWriteStrW()
Definition at line 229 of file io.c.
232{
235 {
237 }
240 {
244 }
245 else
246 {
248 }
249}
EMULATOR_OUTSW_PROC OutsW
PFNVDD_OUTSW outsw_handler
Referenced by EmulatorWriteIo().
◆ IOWriteW()
◆ RegisterIoPort()
◆ UnregisterIoPort()
Definition at line 338 of file io.c.
339{
340
341
342
343
344
346}
#define RtlZeroMemory(Destination, Length)
Referenced by VgaWritePort().
◆ VDDDeInstallIOHook()
Definition at line 565 of file io.c.
568{
570
571
573 {
575 return;
576 }
577
578
579 while (cPortRange--)
580 {
581
582 for (
i = pPortRange->First; i <= pPortRange->Last; ++
i)
583 {
584
585
586
588 {
589 DPRINT1(
"IoPortProc[0x%X] owned by somebody else\n",
i);
590 continue;
591 }
592
593
594
595
596
597
599 }
600
601
602 ++pPortRange;
603 }
604}
#define ERROR_INVALID_PARAMETER
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
◆ VDDInstallIOHook()
Definition at line 502 of file io.c.
506{
508
509
511 {
514 }
515
516
517 while (cPortRange--)
518 {
519
520 for (
i = pPortRange->First; i <= pPortRange->Last; ++
i)
521 {
522
523
524
525
527 {
528 DPRINT1(
"IoPortProc[0x%X] already registered\n",
i);
529 continue;
530 }
531
532
534
535
539
543
547
551
552
554 }
555
556
557 ++pPortRange;
558 }
559
561}
◆ IoPortProc
Definition at line 59 of file io.c.
Referenced by IOReadB(), IOReadD(), IOReadStrB(), IOReadStrD(), IOReadStrW(), IOReadW(), IOWriteB(), IOWriteD(), IOWriteStrB(), IOWriteStrD(), IOWriteStrW(), IOWriteW(), RegisterIoPort(), UnregisterIoPort(), VDDDeInstallIOHook(), and VDDInstallIOHook().