mirror of
https://github.com/reactos/reactos.git
synced 2024-07-22 04:08:08 +00:00
[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. svn path=/branches/ntvdm/; revision=60891
This commit is contained in:
parent
e971f67673
commit
43ee57f2f7
|
@ -185,7 +185,8 @@ VOID
|
|||
PFAST486_STATE State,
|
||||
ULONG Port,
|
||||
PVOID Buffer,
|
||||
ULONG Size
|
||||
ULONG Size,
|
||||
UCHAR Width
|
||||
);
|
||||
|
||||
typedef
|
||||
|
@ -195,7 +196,8 @@ VOID
|
|||
PFAST486_STATE State,
|
||||
ULONG Port,
|
||||
PVOID Buffer,
|
||||
ULONG Size
|
||||
ULONG Size,
|
||||
UCHAR Width
|
||||
);
|
||||
|
||||
typedef
|
||||
|
|
|
@ -146,22 +146,24 @@ Fast486MemWriteCallback(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG
|
|||
|
||||
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);
|
||||
UNREFERENCED_PARAMETER(Width);
|
||||
}
|
||||
|
||||
static VOID
|
||||
NTAPI
|
||||
Fast486IoWriteCallback(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG Size)
|
||||
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
|
||||
|
|
|
@ -906,7 +906,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeInByte)
|
|||
}
|
||||
|
||||
/* 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 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIn)
|
|||
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 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIn)
|
|||
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 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOutByte)
|
|||
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 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOut)
|
|||
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 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOut)
|
|||
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 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIns)
|
|||
State->IoReadCallback(State,
|
||||
State->GeneralRegs[FAST486_REG_EDX].LowWord,
|
||||
Block,
|
||||
Processed * DataSize);
|
||||
Processed,
|
||||
DataSize);
|
||||
|
||||
if (State->Flags.Df)
|
||||
{
|
||||
|
@ -6059,6 +6060,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeIns)
|
|||
State->IoReadCallback(State,
|
||||
State->GeneralRegs[FAST486_REG_EDX].LowWord,
|
||||
&Data,
|
||||
1,
|
||||
DataSize);
|
||||
|
||||
/* Write to the destination operand */
|
||||
|
@ -6174,7 +6176,8 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOuts)
|
|||
State->IoWriteCallback(State,
|
||||
State->GeneralRegs[FAST486_REG_EDX].LowWord,
|
||||
Block,
|
||||
Processed * DataSize);
|
||||
Processed,
|
||||
DataSize);
|
||||
|
||||
if (!State->Flags.Df)
|
||||
{
|
||||
|
@ -6212,6 +6215,7 @@ FAST486_OPCODE_HANDLER(Fast486OpcodeOuts)
|
|||
State->IoWriteCallback(State,
|
||||
State->GeneralRegs[FAST486_REG_EDX].LowWord,
|
||||
&Data,
|
||||
1,
|
||||
DataSize);
|
||||
|
||||
/* Increment/decrement ESI */
|
||||
|
|
|
@ -82,28 +82,30 @@ static VOID WINAPI EmulatorWriteMemory(PFAST486_STATE State, ULONG Address, PVOI
|
|||
}
|
||||
}
|
||||
|
||||
static VOID WINAPI EmulatorReadIo(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG Size)
|
||||
static VOID WINAPI EmulatorReadIo(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG Size, UCHAR Width)
|
||||
{
|
||||
INT i;
|
||||
INT i, j;
|
||||
LPBYTE Address = (LPBYTE)Buffer;
|
||||
|
||||
UNREFERENCED_PARAMETER(State);
|
||||
|
||||
for (i = 0; i < Size; i++)
|
||||
for (i = 0; i < Size; i++) for (j = 0; j < Width; j++)
|
||||
{
|
||||
switch (Port)
|
||||
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 @@ static VOID WINAPI EmulatorReadIo(PFAST486_STATE State, ULONG Port, PVOID Buffer
|
|||
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 @@ static VOID WINAPI EmulatorReadIo(PFAST486_STATE State, ULONG Port, PVOID Buffer
|
|||
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)
|
||||
static VOID WINAPI EmulatorWriteIo(PFAST486_STATE State, ULONG Port, PVOID Buffer, ULONG Size, UCHAR Width)
|
||||
{
|
||||
INT i;
|
||||
INT i, j;
|
||||
LPBYTE Address = (LPBYTE)Buffer;
|
||||
|
||||
UNREFERENCED_PARAMETER(State);
|
||||
|
||||
for (i = 0; i < Size; i++)
|
||||
for (i = 0; i < Size; i++) for (j = 0; j < Width; j++)
|
||||
{
|
||||
switch (Port)
|
||||
ULONG CurrentPort = Port + j;
|
||||
|
||||
switch (CurrentPort)
|
||||
{
|
||||
case PIT_COMMAND_PORT:
|
||||
{
|
||||
|
@ -188,21 +192,21 @@ static VOID WINAPI EmulatorWriteIo(PFAST486_STATE State, ULONG Port, PVOID Buffe
|
|||
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 @@ static VOID WINAPI EmulatorWriteIo(PFAST486_STATE State, ULONG Port, PVOID Buffe
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue