/* PUBLIC FUNCTIONS ***********************************************************/
UCHAR
-IOReadB(ULONG Port)
+IOReadB(USHORT Port)
{
if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE &&
IoPortProc[Port].IoHandlers.InB)
}
VOID
-IOReadStrB(ULONG Port,
+IOReadStrB(USHORT Port,
PUCHAR Buffer,
ULONG Count)
{
}
else
{
- while (Count--)
- *Buffer++ = IOReadB(Port);
+ while (Count--) *Buffer++ = IOReadB(Port);
}
}
VOID
-IOWriteB(ULONG Port,
+IOWriteB(USHORT Port,
UCHAR Buffer)
{
if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE &&
}
VOID
-IOWriteStrB(ULONG Port,
+IOWriteStrB(USHORT Port,
PUCHAR Buffer,
ULONG Count)
{
}
USHORT
-IOReadW(ULONG Port)
+IOReadW(USHORT Port)
{
if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE &&
IoPortProc[Port].IoHandlers.InW)
}
VOID
-IOReadStrW(ULONG Port,
+IOReadStrW(USHORT Port,
PUSHORT Buffer,
ULONG Count)
{
}
else
{
- while (Count--)
- *Buffer++ = IOReadW(Port);
+ while (Count--) *Buffer++ = IOReadW(Port);
}
}
VOID
-IOWriteW(ULONG Port,
+IOWriteW(USHORT Port,
USHORT Buffer)
{
if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE &&
}
VOID
-IOWriteStrW(ULONG Port,
+IOWriteStrW(USHORT Port,
PUSHORT Buffer,
ULONG Count)
{
}
ULONG
-IOReadD(ULONG Port)
+IOReadD(USHORT Port)
{
if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE &&
IoPortProc[Port].IoHandlers.InD)
}
VOID
-IOReadStrD(ULONG Port,
+IOReadStrD(USHORT Port,
PULONG Buffer,
ULONG Count)
{
}
else
{
- while (Count--)
- *Buffer++ = IOReadD(Port);
+ while (Count--) *Buffer++ = IOReadD(Port);
}
}
VOID
-IOWriteD(ULONG Port,
+IOWriteD(USHORT Port,
ULONG Buffer)
{
if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE &&
}
VOID
-IOWriteStrD(ULONG Port,
+IOWriteStrD(USHORT Port,
PULONG Buffer,
ULONG Count)
{
}
-VOID RegisterIoPort(ULONG Port,
+VOID RegisterIoPort(USHORT Port,
EMULATOR_INB_PROC InHandler,
EMULATOR_OUTB_PROC OutHandler)
{
IoPortProc[Port].hVdd = INVALID_HANDLE_VALUE;
}
-VOID UnregisterIoPort(ULONG Port)
+VOID UnregisterIoPort(USHORT Port)
{
/*
* Put automagically all the fields to zero:
* the hVdd gets unregistered as well as all the handlers.
*/
// IoPortProc[Port] = {NULL};
- ZeroMemory(&IoPortProc[Port], sizeof(IoPortProc[Port]));
+ RtlZeroMemory(&IoPortProc[Port], sizeof(IoPortProc[Port]));
}
VOID WINAPI
EmulatorReadIo(PFAST486_STATE State,
- ULONG Port,
+ USHORT Port,
PVOID Buffer,
ULONG DataCount,
UCHAR DataSize)
}
else
{
- PBYTE Address = (PBYTE)Buffer;
+ PUCHAR Address = (PUCHAR)Buffer;
while (DataCount--)
{
UCHAR NewDataSize = DataSize;
/* Read dword */
- Count = NewDataSize / sizeof(ULONG);
- NewDataSize = NewDataSize % sizeof(ULONG);
+ Count = NewDataSize >> 2; // NewDataSize / sizeof(ULONG);
+ NewDataSize = NewDataSize & 3; // NewDataSize % sizeof(ULONG);
while (Count--)
{
*(PULONG)Address = IOReadD(CurrentPort);
}
/* Read word */
- Count = NewDataSize / sizeof(USHORT);
- NewDataSize = NewDataSize % sizeof(USHORT);
+ Count = NewDataSize >> 1; // NewDataSize / sizeof(USHORT);
+ NewDataSize = NewDataSize & 1; // NewDataSize % sizeof(USHORT);
while (Count--)
{
*(PUSHORT)Address = IOReadW(CurrentPort);
}
/* Read byte */
- Count = NewDataSize / sizeof(UCHAR);
- NewDataSize = NewDataSize % sizeof(UCHAR);
+ Count = NewDataSize; // NewDataSize / sizeof(UCHAR);
+ // NewDataSize = NewDataSize % sizeof(UCHAR);
while (Count--)
{
*(PUCHAR)Address = IOReadB(CurrentPort);
CurrentPort += sizeof(UCHAR);
Address += sizeof(UCHAR);
}
-
- ASSERT(Count == 0);
- ASSERT(NewDataSize == 0);
}
}
}
VOID WINAPI
EmulatorWriteIo(PFAST486_STATE State,
- ULONG Port,
+ USHORT Port,
PVOID Buffer,
ULONG DataCount,
UCHAR DataSize)
}
else
{
- PBYTE Address = (PBYTE)Buffer;
+ PUCHAR Address = (PUCHAR)Buffer;
while (DataCount--)
{
UCHAR NewDataSize = DataSize;
/* Write dword */
- Count = NewDataSize / sizeof(ULONG);
- NewDataSize = NewDataSize % sizeof(ULONG);
+ Count = NewDataSize >> 2; // NewDataSize / sizeof(ULONG);
+ NewDataSize = NewDataSize & 3; // NewDataSize % sizeof(ULONG);
while (Count--)
{
IOWriteD(CurrentPort, *(PULONG)Address);
}
/* Write word */
- Count = NewDataSize / sizeof(USHORT);
- NewDataSize = NewDataSize % sizeof(USHORT);
+ Count = NewDataSize >> 1; // NewDataSize / sizeof(USHORT);
+ NewDataSize = NewDataSize & 1; // NewDataSize % sizeof(USHORT);
while (Count--)
{
IOWriteW(CurrentPort, *(PUSHORT)Address);
}
/* Write byte */
- Count = NewDataSize / sizeof(UCHAR);
- NewDataSize = NewDataSize % sizeof(UCHAR);
+ Count = NewDataSize; // NewDataSize / sizeof(UCHAR);
+ // NewDataSize = NewDataSize % sizeof(UCHAR);
while (Count--)
{
IOWriteB(CurrentPort, *(PUCHAR)Address);
CurrentPort += sizeof(UCHAR);
Address += sizeof(UCHAR);
}
-
- ASSERT(Count == 0);
- ASSERT(NewDataSize == 0);
}
}
}
* the hVdd gets unregistered as well as all the handlers.
*/
// IoPortProc[i] = {NULL};
- ZeroMemory(&IoPortProc[i], sizeof(IoPortProc[i]));
+ RtlZeroMemory(&IoPortProc[i], sizeof(IoPortProc[i]));
}
/* Go to the next range */