Author: aandrejevic
Date: Sat Nov 9 03:30:27 2013
New Revision: 60891
URL:
http://svn.reactos.org/svn/reactos?rev=60891&view=rev
Log:
[FAST486][NTVDM]
The behavior of the I/O port bus depends on the data width. In the case
of 16-bit/32-bit access, two/four adjacent ports will be accessed.
Modified:
branches/ntvdm/include/reactos/libs/fast486/fast486.h
branches/ntvdm/lib/fast486/fast486.c
branches/ntvdm/lib/fast486/opcodes.c
branches/ntvdm/subsystems/ntvdm/emulator.c
Modified: branches/ntvdm/include/reactos/libs/fast486/fast486.h
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/include/reactos/libs/fast…
==============================================================================
--- branches/ntvdm/include/reactos/libs/fast486/fast486.h [iso-8859-1] (original)
+++ branches/ntvdm/include/reactos/libs/fast486/fast486.h [iso-8859-1] Sat Nov 9 03:30:27
2013
@@ -185,7 +185,8 @@
PFAST486_STATE State,
ULONG Port,
PVOID Buffer,
- ULONG Size
+ ULONG Size,
+ UCHAR Width
);
typedef
@@ -195,7 +196,8 @@
PFAST486_STATE State,
ULONG Port,
PVOID Buffer,
- ULONG Size
+ ULONG Size,
+ UCHAR Width
);
typedef
Modified: branches/ntvdm/lib/fast486/fast486.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/fast486.c?rev…
==============================================================================
--- branches/ntvdm/lib/fast486/fast486.c [iso-8859-1] (original)
+++ branches/ntvdm/lib/fast486/fast486.c [iso-8859-1] Sat Nov 9 03:30:27 2013
@@ -146,22 +146,24 @@
static VOID
NTAPI
-Fast486IoReadCallback(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG Size)
+Fast486IoReadCallback(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG Size, UCHAR
Width)
{
UNREFERENCED_PARAMETER(State);
UNREFERENCED_PARAMETER(Port);
UNREFERENCED_PARAMETER(Buffer);
UNREFERENCED_PARAMETER(Size);
-}
-
-static VOID
-NTAPI
-Fast486IoWriteCallback(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG Size)
+ UNREFERENCED_PARAMETER(Width);
+}
+
+static VOID
+NTAPI
+Fast486IoWriteCallback(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG Size, UCHAR
Width)
{
UNREFERENCED_PARAMETER(State);
UNREFERENCED_PARAMETER(Port);
UNREFERENCED_PARAMETER(Buffer);
UNREFERENCED_PARAMETER(Size);
+ UNREFERENCED_PARAMETER(Width);
}
static VOID
Modified: branches/ntvdm/lib/fast486/opcodes.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/opcodes.c?rev…
==============================================================================
--- branches/ntvdm/lib/fast486/opcodes.c [iso-8859-1] (original)
+++ branches/ntvdm/lib/fast486/opcodes.c [iso-8859-1] Sat Nov 9 03:30:27 2013
@@ -906,7 +906,7 @@
}
/* Read a byte from the I/O port */
- State->IoReadCallback(State, Port, &Data, sizeof(UCHAR));
+ State->IoReadCallback(State, Port, &Data, 1, sizeof(UCHAR));
/* Store the result in AL */
State->GeneralRegs[FAST486_REG_EAX].LowByte = Data;
@@ -950,7 +950,7 @@
ULONG Data;
/* Read a dword from the I/O port */
- State->IoReadCallback(State, Port, &Data, sizeof(ULONG));
+ State->IoReadCallback(State, Port, &Data, 1, sizeof(ULONG));
/* Store the value in EAX */
State->GeneralRegs[FAST486_REG_EAX].Long = Data;
@@ -960,7 +960,7 @@
USHORT Data;
/* Read a word from the I/O port */
- State->IoReadCallback(State, Port, &Data, sizeof(USHORT));
+ State->IoReadCallback(State, Port, &Data, 1, sizeof(USHORT));
/* Store the value in AX */
State->GeneralRegs[FAST486_REG_EAX].LowWord = Data;
@@ -999,7 +999,7 @@
Data = State->GeneralRegs[FAST486_REG_EAX].LowByte;
/* Write the byte to the I/O port */
- State->IoWriteCallback(State, Port, &Data, sizeof(UCHAR));
+ State->IoWriteCallback(State, Port, &Data, 1, sizeof(UCHAR));
return TRUE;
}
@@ -1041,7 +1041,7 @@
ULONG Data = State->GeneralRegs[FAST486_REG_EAX].Long;
/* Write a dword to the I/O port */
- State->IoReadCallback(State, Port, &Data, sizeof(ULONG));
+ State->IoReadCallback(State, Port, &Data, 1, sizeof(ULONG));
}
else
{
@@ -1049,7 +1049,7 @@
USHORT Data = State->GeneralRegs[FAST486_REG_EAX].LowWord;
/* Write a word to the I/O port */
- State->IoWriteCallback(State, Port, &Data, sizeof(USHORT));
+ State->IoWriteCallback(State, Port, &Data, 1, sizeof(USHORT));
}
return TRUE;
@@ -5997,7 +5997,8 @@
State->IoReadCallback(State,
State->GeneralRegs[FAST486_REG_EDX].LowWord,
Block,
- Processed * DataSize);
+ Processed,
+ DataSize);
if (State->Flags.Df)
{
@@ -6059,6 +6060,7 @@
State->IoReadCallback(State,
State->GeneralRegs[FAST486_REG_EDX].LowWord,
&Data,
+ 1,
DataSize);
/* Write to the destination operand */
@@ -6174,7 +6176,8 @@
State->IoWriteCallback(State,
State->GeneralRegs[FAST486_REG_EDX].LowWord,
Block,
- Processed * DataSize);
+ Processed,
+ DataSize);
if (!State->Flags.Df)
{
@@ -6212,6 +6215,7 @@
State->IoWriteCallback(State,
State->GeneralRegs[FAST486_REG_EDX].LowWord,
&Data,
+ 1,
DataSize);
/* Increment/decrement ESI */
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] Sat Nov 9 03:30:27 2013
@@ -82,28 +82,30 @@
}
}
-static VOID WINAPI EmulatorReadIo(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG
Size)
-{
- INT i;
+static VOID WINAPI EmulatorReadIo(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG
Size, UCHAR Width)
+{
+ INT i, j;
LPBYTE Address = (LPBYTE)Buffer;
UNREFERENCED_PARAMETER(State);
- for (i = 0; i < Size; i++)
- {
- switch (Port)
+ for (i = 0; i < Size; i++) for (j = 0; j < Width; j++)
+ {
+ ULONG CurrentPort = Port + j;
+
+ switch (CurrentPort)
{
case PIC_MASTER_CMD:
case PIC_SLAVE_CMD:
{
- *(Address++) = PicReadCommand(Port);
+ *(Address++) = PicReadCommand(CurrentPort);
break;
}
case PIC_MASTER_DATA:
case PIC_SLAVE_DATA:
{
- *(Address++) = PicReadData(Port);
+ *(Address++) = PicReadData(CurrentPort);
break;
}
@@ -111,7 +113,7 @@
case PIT_DATA_PORT(1):
case PIT_DATA_PORT(2):
{
- *(Address++) = PitReadData(Port - PIT_DATA_PORT(0));
+ *(Address++) = PitReadData(CurrentPort - PIT_DATA_PORT(0));
break;
}
@@ -155,28 +157,30 @@
case VGA_STAT_MONO:
case VGA_STAT_COLOR:
{
- *(Address++) = VgaReadPort(Port);
+ *(Address++) = VgaReadPort(CurrentPort);
break;
}
default:
{
- DPRINT1("Read from unknown port: 0x%X\n", Port);
+ DPRINT1("Read from unknown port: 0x%X\n", CurrentPort);
}
}
}
}
-static VOID WINAPI EmulatorWriteIo(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG
Size)
-{
- INT i;
+static VOID WINAPI EmulatorWriteIo(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG
Size, UCHAR Width)
+{
+ INT i, j;
LPBYTE Address = (LPBYTE)Buffer;
UNREFERENCED_PARAMETER(State);
- for (i = 0; i < Size; i++)
- {
- switch (Port)
+ for (i = 0; i < Size; i++) for (j = 0; j < Width; j++)
+ {
+ ULONG CurrentPort = Port + j;
+
+ switch (CurrentPort)
{
case PIT_COMMAND_PORT:
{
@@ -188,21 +192,21 @@
case PIT_DATA_PORT(1):
case PIT_DATA_PORT(2):
{
- PitWriteData(Port - PIT_DATA_PORT(0), *(Address++));
+ PitWriteData(CurrentPort - PIT_DATA_PORT(0), *(Address++));
break;
}
case PIC_MASTER_CMD:
case PIC_SLAVE_CMD:
{
- PicWriteCommand(Port, *(Address++));
+ PicWriteCommand(CurrentPort, *(Address++));
break;
}
case PIC_MASTER_DATA:
case PIC_SLAVE_DATA:
{
- PicWriteData(Port, *(Address++));
+ PicWriteData(CurrentPort, *(Address++));
break;
}
@@ -252,13 +256,13 @@
case VGA_STAT_MONO:
case VGA_STAT_COLOR:
{
- VgaWritePort(Port, *(Address++));
+ VgaWritePort(CurrentPort, *(Address++));
break;
}
default:
{
- DPRINT1("Write to unknown port: 0x%X\n", Port);
+ DPRINT1("Write to unknown port: 0x%X\n", CurrentPort);
}
}
}