Author: aandrejevic
Date: Sun Nov 3 14:37:30 2013
New Revision: 60849
URL:
http://svn.reactos.org/svn/reactos?rev=60849&view=rev
Log:
[NTVDM]
Improve the I/O read/write callbacks to allow multiple reads or writes
at once.
Modified:
branches/ntvdm/subsystems/ntvdm/emulator.c
Modified: branches/ntvdm/subsystems/ntvdm/emulator.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/emulator…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/emulator.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/emulator.c [iso-8859-1] Sun Nov 3 14:37:30 2013
@@ -82,146 +82,152 @@
static VOID WINAPI EmulatorReadIo(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG
Size)
{
+ INT i;
LPBYTE Address = (LPBYTE)Buffer;
UNREFERENCED_PARAMETER(State);
- UNREFERENCED_PARAMETER(Size);
-
- switch (Port)
- {
- case PIC_MASTER_CMD:
- case PIC_SLAVE_CMD:
+
+ for (i = 0; i < Size; i++)
+ {
+ switch (Port)
{
- *Address = PicReadCommand(Port);
- break;
+ case PIC_MASTER_CMD:
+ case PIC_SLAVE_CMD:
+ {
+ *(Address++) = PicReadCommand(Port);
+ break;
+ }
+
+ case PIC_MASTER_DATA:
+ case PIC_SLAVE_DATA:
+ {
+ *(Address++) = PicReadData(Port);
+ break;
+ }
+
+ case PIT_DATA_PORT(0):
+ case PIT_DATA_PORT(1):
+ case PIT_DATA_PORT(2):
+ {
+ *(Address++) = PitReadData(Port - PIT_DATA_PORT(0));
+ break;
+ }
+
+ case PS2_CONTROL_PORT:
+ {
+ *(Address++) = KeyboardReadStatus();
+ break;
+ }
+
+ case PS2_DATA_PORT:
+ {
+ *(Address++) = KeyboardReadData();
+ break;
+ }
+
+ case VGA_AC_WRITE:
+ case VGA_AC_READ:
+ case VGA_SEQ_INDEX:
+ case VGA_SEQ_DATA:
+ case VGA_DAC_READ_INDEX:
+ case VGA_DAC_WRITE_INDEX:
+ case VGA_DAC_DATA:
+ case VGA_MISC_READ:
+ case VGA_MISC_WRITE:
+ case VGA_CRTC_INDEX:
+ case VGA_CRTC_DATA:
+ case VGA_GC_INDEX:
+ case VGA_GC_DATA:
+ case VGA_STAT_MONO:
+ case VGA_STAT_COLOR:
+ {
+ *(Address++) = VgaReadPort(Port);
+ break;
+ }
+
+ default:
+ {
+ DPRINT1("Read from unknown port: 0x%X\n", Port);
+ }
}
-
- case PIC_MASTER_DATA:
- case PIC_SLAVE_DATA:
+ }
+}
+
+static VOID WINAPI EmulatorWriteIo(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG
Size)
+{
+ INT i;
+ LPBYTE Address = (LPBYTE)Buffer;
+
+ UNREFERENCED_PARAMETER(State);
+
+ for (i = 0; i < Size; i++)
+ {
+ switch (Port)
{
- *Address = PicReadData(Port);
- break;
- }
-
- case PIT_DATA_PORT(0):
- case PIT_DATA_PORT(1):
- case PIT_DATA_PORT(2):
- {
- *Address = PitReadData(Port - PIT_DATA_PORT(0));
- break;
- }
-
- case PS2_CONTROL_PORT:
- {
- *Address = KeyboardReadStatus();
- break;
- }
-
- case PS2_DATA_PORT:
- {
- *Address = KeyboardReadData();
- break;
- }
-
- case VGA_AC_WRITE:
- case VGA_AC_READ:
- case VGA_SEQ_INDEX:
- case VGA_SEQ_DATA:
- case VGA_DAC_READ_INDEX:
- case VGA_DAC_WRITE_INDEX:
- case VGA_DAC_DATA:
- case VGA_MISC_READ:
- case VGA_MISC_WRITE:
- case VGA_CRTC_INDEX:
- case VGA_CRTC_DATA:
- case VGA_GC_INDEX:
- case VGA_GC_DATA:
- case VGA_STAT_MONO:
- case VGA_STAT_COLOR:
- {
- *Address = VgaReadPort(Port);
- break;
- }
-
- default:
- {
- DPRINT1("Read from unknown port: 0x%X\n", Port);
- }
- }
-}
-
-static VOID WINAPI EmulatorWriteIo(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG
Size)
-{
- BYTE Byte = *(LPBYTE)Buffer;
-
- UNREFERENCED_PARAMETER(State);
- UNREFERENCED_PARAMETER(Size);
-
- switch (Port)
- {
- case PIT_COMMAND_PORT:
- {
- PitWriteCommand(Byte);
- break;
- }
-
- case PIT_DATA_PORT(0):
- case PIT_DATA_PORT(1):
- case PIT_DATA_PORT(2):
- {
- PitWriteData(Port - PIT_DATA_PORT(0), Byte);
- break;
- }
-
- case PIC_MASTER_CMD:
- case PIC_SLAVE_CMD:
- {
- PicWriteCommand(Port, Byte);
- break;
- }
-
- case PIC_MASTER_DATA:
- case PIC_SLAVE_DATA:
- {
- PicWriteData(Port, Byte);
- break;
- }
-
- case PS2_CONTROL_PORT:
- {
- KeyboardWriteCommand(Byte);
- break;
- }
-
- case PS2_DATA_PORT:
- {
- KeyboardWriteData(Byte);
- break;
- }
-
- case VGA_AC_WRITE:
- case VGA_AC_READ:
- case VGA_SEQ_INDEX:
- case VGA_SEQ_DATA:
- case VGA_DAC_READ_INDEX:
- case VGA_DAC_WRITE_INDEX:
- case VGA_DAC_DATA:
- case VGA_MISC_READ:
- case VGA_MISC_WRITE:
- case VGA_CRTC_INDEX:
- case VGA_CRTC_DATA:
- case VGA_GC_INDEX:
- case VGA_GC_DATA:
- case VGA_STAT_MONO:
- case VGA_STAT_COLOR:
- {
- VgaWritePort(Port, Byte);
- break;
- }
-
- default:
- {
- DPRINT1("Write to unknown port: 0x%X\n", Port);
+ case PIT_COMMAND_PORT:
+ {
+ PitWriteCommand(*(Address++));
+ break;
+ }
+
+ case PIT_DATA_PORT(0):
+ case PIT_DATA_PORT(1):
+ case PIT_DATA_PORT(2):
+ {
+ PitWriteData(Port - PIT_DATA_PORT(0), *(Address++));
+ break;
+ }
+
+ case PIC_MASTER_CMD:
+ case PIC_SLAVE_CMD:
+ {
+ PicWriteCommand(Port, *(Address++));
+ break;
+ }
+
+ case PIC_MASTER_DATA:
+ case PIC_SLAVE_DATA:
+ {
+ PicWriteData(Port, *(Address++));
+ break;
+ }
+
+ case PS2_CONTROL_PORT:
+ {
+ KeyboardWriteCommand(*(Address++));
+ break;
+ }
+
+ case PS2_DATA_PORT:
+ {
+ KeyboardWriteData(*(Address++));
+ break;
+ }
+
+ case VGA_AC_WRITE:
+ case VGA_AC_READ:
+ case VGA_SEQ_INDEX:
+ case VGA_SEQ_DATA:
+ case VGA_DAC_READ_INDEX:
+ case VGA_DAC_WRITE_INDEX:
+ case VGA_DAC_DATA:
+ case VGA_MISC_READ:
+ case VGA_MISC_WRITE:
+ case VGA_CRTC_INDEX:
+ case VGA_CRTC_DATA:
+ case VGA_GC_INDEX:
+ case VGA_GC_DATA:
+ case VGA_STAT_MONO:
+ case VGA_STAT_COLOR:
+ {
+ VgaWritePort(Port, *(Address++));
+ break;
+ }
+
+ default:
+ {
+ DPRINT1("Write to unknown port: 0x%X\n", Port);
+ }
}
}
}