Author: aandrejevic
Date: Tue Jul 23 21:43:57 2013
New Revision: 59566
URL:
http://svn.reactos.org/svn/reactos?rev=59566&view=rev
Log:
[NTVDM]
Modify the flags on the stack instead of the flags register directly.
The flags register is restored during IRET so changing it directly does nothing.
Modified:
branches/ntvdm/subsystems/ntvdm/bios.c
branches/ntvdm/subsystems/ntvdm/bios.h
branches/ntvdm/subsystems/ntvdm/dos.c
branches/ntvdm/subsystems/ntvdm/dos.h
branches/ntvdm/subsystems/ntvdm/emulator.c
branches/ntvdm/subsystems/ntvdm/emulator.h
Modified: branches/ntvdm/subsystems/ntvdm/bios.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/bios.c?r…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/bios.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/bios.c [iso-8859-1] Tue Jul 23 21:43:57 2013
@@ -57,7 +57,7 @@
/* PRIVATE FUNCTIONS **********************************************************/
-static DWORD BiosGetVideoPageSize()
+static DWORD BiosGetVideoPageSize(VOID)
{
INT i;
DWORD BufferSize = VideoModes[CurrentVideoMode].Width
@@ -135,7 +135,7 @@
return TRUE;
}
-static BOOLEAN BiosKbdBufferPop()
+static BOOLEAN BiosKbdBufferPop(VOID)
{
/* If it's empty, fail */
if (Bda->KeybdBufferHead == Bda->KeybdBufferTail) return FALSE;
@@ -214,7 +214,7 @@
return TRUE;
}
-static VOID BiosDestroyGraphicsBuffer()
+static VOID BiosDestroyGraphicsBuffer(VOID)
{
CloseHandle(ConsoleMutex);
CloseHandle(BiosGraphicsOutput);
@@ -222,7 +222,7 @@
/* PUBLIC FUNCTIONS ***********************************************************/
-BYTE BiosGetVideoMode()
+BYTE BiosGetVideoMode(VOID)
{
return CurrentVideoMode;
}
@@ -335,12 +335,12 @@
return TRUE;
}
-inline DWORD BiosGetVideoMemoryStart()
+inline DWORD BiosGetVideoMemoryStart(VOID)
{
return (VideoModes[CurrentVideoMode].Segment << 4);
}
-inline VOID BiosVerticalRefresh()
+inline VOID BiosVerticalRefresh(VOID)
{
/* Ignore if we're in text mode */
if (VideoModes[CurrentVideoMode].Text) return;
@@ -355,7 +355,7 @@
VideoNeedsUpdate = FALSE;
}
-BOOLEAN BiosInitialize()
+BOOLEAN BiosInitialize(VOID)
{
INT i;
WORD Offset = 0;
@@ -458,7 +458,7 @@
return TRUE;
}
-VOID BiosCleanup()
+VOID BiosCleanup(VOID)
{
/* Restore the old screen buffer */
SetConsoleActiveScreenBuffer(BiosConsoleOutput);
@@ -611,7 +611,7 @@
}
}
-WORD BiosPeekCharacter()
+WORD BiosPeekCharacter(VOID)
{
WORD CharacterData;
@@ -624,7 +624,7 @@
return CharacterData;
}
-WORD BiosGetCharacter()
+WORD BiosGetCharacter(VOID)
{
WORD CharacterData;
INPUT_RECORD InputRecord;
@@ -660,7 +660,7 @@
return CharacterData;
}
-VOID BiosVideoService()
+VOID BiosVideoService(LPWORD Stack)
{
INT i, CursorHeight;
BOOLEAN Invisible = FALSE;
@@ -811,7 +811,8 @@
*((LPWORD)((ULONG_PTR)BaseAddress + Address)));
break;
- }
+ } EmulatorSetFlag(EMULATOR_FLAG_ZF);
+
/* Write Character And Attribute At Cursor Position */
case 0x09:
@@ -927,7 +928,7 @@
}
}
-VOID BiosKeyboardService()
+VOID BiosKeyboardService(LPWORD Stack)
{
DWORD Eax = EmulatorGetRegister(EMULATOR_REG_AX);
@@ -949,12 +950,12 @@
{
/* There is a character, clear ZF and return it */
EmulatorSetRegister(EMULATOR_REG_AX, Data);
- EmulatorClearFlag(EMULATOR_FLAG_ZF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_ZF;
}
else
{
/* No character, set ZF */
- EmulatorSetFlag(EMULATOR_FLAG_ZF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_ZF;
}
break;
@@ -968,7 +969,7 @@
}
}
-VOID BiosTimeService()
+VOID BiosTimeService(LPWORD Stack)
{
DWORD Eax = EmulatorGetRegister(EMULATOR_REG_AX);
DWORD Ecx = EmulatorGetRegister(EMULATOR_REG_CX);
@@ -1012,19 +1013,19 @@
}
}
-VOID BiosSystemTimerInterrupt()
+VOID BiosSystemTimerInterrupt(LPWORD Stack)
{
/* Increase the system tick count */
Bda->TickCounter++;
}
-VOID BiosEquipmentService()
+VOID BiosEquipmentService(LPWORD Stack)
{
/* Return the equipment list */
EmulatorSetRegister(EMULATOR_REG_AX, Bda->EquipmentList);
}
-VOID BiosHandleIrq(BYTE IrqNumber)
+VOID BiosHandleIrq(BYTE IrqNumber, LPWORD Stack)
{
switch (IrqNumber)
{
Modified: branches/ntvdm/subsystems/ntvdm/bios.h
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/bios.h?r…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/bios.h [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/bios.h [iso-8859-1] Tue Jul 23 21:43:57 2013
@@ -97,19 +97,19 @@
/* FUNCTIONS ******************************************************************/
-BOOLEAN BiosInitialize();
-VOID BiosCleanup();
+BOOLEAN BiosInitialize(VOID);
+VOID BiosCleanup(VOID);
VOID BiosUpdateConsole(ULONG StartAddress, ULONG EndAddress);
VOID BiosUpdateVideoMemory(ULONG StartAddress, ULONG EndAddress);
-inline DWORD BiosGetVideoMemoryStart();
-inline VOID BiosVerticalRefresh();
-WORD BiosPeekCharacter();
-WORD BiosGetCharacter();
-VOID BiosVideoService();
-VOID BiosEquipmentService();
-VOID BiosKeyboardService();
-VOID BiosTimeService();
-VOID BiosHandleIrq(BYTE IrqNumber);
-VOID BiosSystemTimerInterrupt();
+inline DWORD BiosGetVideoMemoryStart(VOID);
+inline VOID BiosVerticalRefresh(VOID);
+WORD BiosPeekCharacter(VOID);
+WORD BiosGetCharacter(VOID);
+VOID BiosVideoService(LPWORD Stack);
+VOID BiosEquipmentService(LPWORD Stack);
+VOID BiosKeyboardService(LPWORD Stack);
+VOID BiosTimeService(LPWORD Stack);
+VOID BiosHandleIrq(BYTE IrqNumber, LPWORD Stack);
+VOID BiosSystemTimerInterrupt(LPWORD Stack);
#endif
Modified: branches/ntvdm/subsystems/ntvdm/dos.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/dos.c?re…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/dos.c [iso-8859-1] Tue Jul 23 21:43:57 2013
@@ -1161,15 +1161,15 @@
DosWriteFile(DOS_OUTPUT_HANDLE, &Character, sizeof(CHAR), &BytesWritten);
}
-VOID DosHandleIoctl(BYTE ControlCode, WORD FileHandle)
+BOOLEAN DosHandleIoctl(BYTE ControlCode, WORD FileHandle)
{
HANDLE Handle = DosGetRealHandle(FileHandle);
if (Handle == INVALID_HANDLE_VALUE)
{
/* Doesn't exist */
- EmulatorSetFlag(EMULATOR_FLAG_CF);
- EmulatorSetRegister(EMULATOR_REG_AX, ERROR_FILE_NOT_FOUND);
+ DosLastError = ERROR_FILE_NOT_FOUND;
+ return FALSE;
}
switch (ControlCode)
@@ -1194,10 +1194,9 @@
InfoWord |= 1 << 7;
/* Return the device information word */
- EmulatorClearFlag(EMULATOR_FLAG_CF);
EmulatorSetRegister(EMULATOR_REG_DX, InfoWord);
- break;
+ return TRUE;
}
/* Unsupported control code */
@@ -1205,19 +1204,19 @@
{
DPRINT1("Unsupported IOCTL: 0x%02X\n", ControlCode);
- EmulatorSetFlag(EMULATOR_FLAG_CF);
- EmulatorSetRegister(EMULATOR_REG_AX, ERROR_INVALID_PARAMETER);
- }
- }
-}
-
-VOID DosInt20h(WORD CodeSegment)
+ DosLastError = ERROR_INVALID_PARAMETER;
+ return FALSE;
+ }
+ }
+}
+
+VOID DosInt20h(LPWORD Stack)
{
/* This is the exit interrupt */
- DosTerminateProcess(CodeSegment, 0);
-}
-
-VOID DosInt21h(WORD CodeSegment)
+ DosTerminateProcess(Stack[STACK_CS], 0);
+}
+
+VOID DosInt21h(LPWORD Stack)
{
INT i;
CHAR Character;
@@ -1237,7 +1236,7 @@
/* Terminate Program */
case 0x00:
{
- DosTerminateProcess(CodeSegment, 0);
+ DosTerminateProcess(Stack[STACK_CS], 0);
break;
}
@@ -1432,11 +1431,11 @@
if (CreateDirectoryA(String, NULL))
{
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
}
else
{
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
EmulatorSetRegister(EMULATOR_REG_AX,
(Eax & 0xFFFF0000) | LOWORD(GetLastError()));
}
@@ -1452,11 +1451,11 @@
if (RemoveDirectoryA(String))
{
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
}
else
{
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
EmulatorSetRegister(EMULATOR_REG_AX,
(Eax & 0xFFFF0000) | LOWORD(GetLastError()));
}
@@ -1473,11 +1472,11 @@
if (SetCurrentDirectoryA(String))
{
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
}
else
{
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
EmulatorSetRegister(EMULATOR_REG_AX,
(Eax & 0xFFFF0000) | LOWORD(GetLastError()));
}
@@ -1497,7 +1496,7 @@
if (ErrorCode == 0)
{
/* Clear CF */
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
/* Return the handle in AX */
EmulatorSetRegister(EMULATOR_REG_AX,
@@ -1506,7 +1505,7 @@
else
{
/* Set CF */
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
/* Return the error code in AX */
EmulatorSetRegister(EMULATOR_REG_AX,
@@ -1528,7 +1527,7 @@
if (ErrorCode == 0)
{
/* Clear CF */
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
/* Return the handle in AX */
EmulatorSetRegister(EMULATOR_REG_AX,
@@ -1537,7 +1536,7 @@
else
{
/* Set CF */
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
/* Return the error code in AX */
EmulatorSetRegister(EMULATOR_REG_AX,
@@ -1553,12 +1552,12 @@
if (DosCloseHandle(LOWORD(Ebx)))
{
/* Clear CF */
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
}
else
{
/* Set CF */
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
/* Return the error code in AX */
EmulatorSetRegister(EMULATOR_REG_AX,
@@ -1581,7 +1580,7 @@
if (ErrorCode == 0)
{
/* Clear CF */
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
/* Return the number of bytes read in AX */
EmulatorSetRegister(EMULATOR_REG_AX,
@@ -1590,7 +1589,7 @@
else
{
/* Set CF */
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
/* Return the error code in AX */
EmulatorSetRegister(EMULATOR_REG_AX,
@@ -1612,7 +1611,7 @@
if (ErrorCode == 0)
{
/* Clear CF */
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
/* Return the number of bytes written in AX */
EmulatorSetRegister(EMULATOR_REG_AX,
@@ -1621,7 +1620,7 @@
else
{
/* Set CF */
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
/* Return the error code in AX */
EmulatorSetRegister(EMULATOR_REG_AX,
@@ -1637,10 +1636,10 @@
LPSTR FileName = (LPSTR)((ULONG_PTR)BaseAddress + TO_LINEAR(DataSegment,
Edx));
/* Call the API function */
- if (DeleteFileA(FileName)) EmulatorClearFlag(EMULATOR_FLAG_CF);
+ if (DeleteFileA(FileName)) Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
else
{
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
EmulatorSetRegister(EMULATOR_REG_AX, GetLastError());
}
@@ -1659,7 +1658,7 @@
if (ErrorCode == 0)
{
/* Clear CF */
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
/* Return the new offset in DX:AX */
EmulatorSetRegister(EMULATOR_REG_DX,
@@ -1670,7 +1669,7 @@
else
{
/* Set CF */
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
/* Return the error code in AX */
EmulatorSetRegister(EMULATOR_REG_AX,
@@ -1694,14 +1693,14 @@
/* Check if it failed */
if (Attributes == INVALID_FILE_ATTRIBUTES)
{
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
EmulatorSetRegister(EMULATOR_REG_AX, GetLastError());
break;
}
/* Return the attributes that DOS can understand */
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
EmulatorSetRegister(EMULATOR_REG_CX,
(Ecx & 0xFFFFFF00) | LOBYTE(Attributes));
}
@@ -1710,17 +1709,17 @@
/* Try to set the attributes */
if (SetFileAttributesA(FileName, LOBYTE(Ecx)))
{
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
}
else
{
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
EmulatorSetRegister(EMULATOR_REG_AX, GetLastError());
}
}
else
{
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
EmulatorSetRegister(EMULATOR_REG_AX, ERROR_INVALID_FUNCTION);
}
@@ -1730,7 +1729,15 @@
/* IOCTL */
case 0x44:
{
- DosHandleIoctl(LOBYTE(Eax), LOWORD(Ebx));
+ if (DosHandleIoctl(LOBYTE(Eax), LOWORD(Ebx)))
+ {
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
+ }
+ else
+ {
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
+ EmulatorSetRegister(EMULATOR_REG_AX, DosLastError);
+ }
break;
}
@@ -1744,7 +1751,7 @@
if (Handle != INVALID_HANDLE_VALUE)
{
/* The handle is invalid */
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
EmulatorSetRegister(EMULATOR_REG_AX, ERROR_INVALID_HANDLE);
break;
@@ -1756,14 +1763,14 @@
if (NewHandle == INVALID_DOS_HANDLE)
{
/* Too many files open */
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
EmulatorSetRegister(EMULATOR_REG_AX, ERROR_TOO_MANY_OPEN_FILES);
break;
}
/* Return the result */
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
EmulatorSetRegister(EMULATOR_REG_AX, NewHandle);
break;
@@ -1774,11 +1781,11 @@
{
if (DosDuplicateHandle(LOWORD(Ebx), LOWORD(Ecx)))
{
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
}
else
{
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
EmulatorSetRegister(EMULATOR_REG_AX, ERROR_INVALID_HANDLE);
}
@@ -1794,13 +1801,13 @@
if (Segment != 0)
{
EmulatorSetRegister(EMULATOR_REG_AX, Segment);
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
}
else
{
EmulatorSetRegister(EMULATOR_REG_AX, DosLastError);
EmulatorSetRegister(EMULATOR_REG_BX, MaxAvailable);
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
}
break;
@@ -1811,12 +1818,12 @@
{
if (DosFreeMemory(ExtSegment))
{
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
}
else
{
EmulatorSetRegister(EMULATOR_REG_AX, ERROR_ARENA_TRASHED);
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
}
break;
@@ -1829,12 +1836,12 @@
if (DosResizeMemory(ExtSegment, LOWORD(Ebx), &Size))
{
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
}
else
{
EmulatorSetRegister(EMULATOR_REG_AX, DosLastError);
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
EmulatorSetRegister(EMULATOR_REG_BX, Size);
}
@@ -1864,7 +1871,7 @@
/* Get allocation strategy */
EmulatorSetRegister(EMULATOR_REG_AX, DosAllocStrategy);
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
}
else if (LOBYTE(Eax) == 0x01)
{
@@ -1875,7 +1882,7 @@
{
/* Can't set both */
EmulatorSetRegister(EMULATOR_REG_AX, ERROR_INVALID_PARAMETER);
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
break;
}
@@ -1883,12 +1890,12 @@
{
/* Invalid allocation strategy */
EmulatorSetRegister(EMULATOR_REG_AX, ERROR_INVALID_PARAMETER);
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
break;
}
DosAllocStrategy = LOBYTE(Ebx);
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
}
else if (LOBYTE(Eax) == 0x02)
{
@@ -1897,7 +1904,7 @@
Eax &= 0xFFFFFF00;
if (DosUmbLinked) Eax |= 1;
EmulatorSetRegister(EMULATOR_REG_AX, Eax);
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
}
else if (LOBYTE(Eax) == 0x03)
{
@@ -1905,13 +1912,13 @@
if (Ebx) DosLinkUmb();
else DosUnlinkUmb();
- EmulatorClearFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
}
else
{
/* Invalid or unsupported function */
- EmulatorSetFlag(EMULATOR_FLAG_CF);
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
EmulatorSetRegister(EMULATOR_REG_AX, ERROR_INVALID_FUNCTION);
}
@@ -1922,12 +1929,12 @@
default:
{
DPRINT1("DOS Function INT 0x21, AH = 0x%02X NOT IMPLEMENTED!\n",
HIBYTE(Eax));
- EmulatorSetFlag(EMULATOR_FLAG_CF);
- }
- }
-}
-
-VOID DosBreakInterrupt(VOID)
+ Stack[STACK_FLAGS] |= EMULATOR_FLAG_CF;
+ }
+ }
+}
+
+VOID DosBreakInterrupt(LPWORD Stack)
{
VdmRunning = FALSE;
}
Modified: branches/ntvdm/subsystems/ntvdm/dos.h
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/dos.h?re…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/dos.h [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/dos.h [iso-8859-1] Tue Jul 23 21:43:57 2013
@@ -117,9 +117,10 @@
VOID DosTerminateProcess(WORD Psp, BYTE ReturnCode);
CHAR DosReadCharacter(VOID);
VOID DosPrintCharacter(CHAR Character);
-VOID DosInt20h(WORD CodeSegment);
-VOID DosInt21h(WORD CodeSegment);
-VOID DosBreakInterrupt(VOID);
+BOOLEAN DosHandleIoctl(BYTE ControlCode, WORD FileHandle);
+VOID DosInt20h(LPWORD Stack);
+VOID DosInt21h(LPWORD Stack);
+VOID DosBreakInterrupt(LPWORD Stack);
BOOLEAN DosInitialize(VOID);
#endif
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] Tue Jul 23 21:43:57 2013
@@ -114,6 +114,11 @@
*Buffer = KeyboardReadData();
break;
}
+
+ default:
+ {
+ DPRINT1("Read from unknown port: 0x%X\n", Address);
+ }
}
}
@@ -162,6 +167,11 @@
KeyboardWriteData(Byte);
break;
}
+
+ default:
+ {
+ DPRINT1("Write to unknown port: 0x%X\n", Address);
+ }
}
}
@@ -186,11 +196,11 @@
if (Code == EMULATOR_INT_BOP)
{
/* Get the interrupt number */
- IntNum = LOBYTE(Stack[0]);
+ IntNum = LOBYTE(Stack[STACK_INT_NUM]);
/* Get the CS:IP */
- InstructionPointer = Stack[1];
- CodeSegment = Stack[2];
+ InstructionPointer = Stack[STACK_IP];
+ CodeSegment = Stack[STACK_CS];
/* Check if this was an exception */
if (IntNum < 8)
@@ -210,13 +220,13 @@
if (IntNum >= BIOS_PIC_MASTER_INT && IntNum < BIOS_PIC_MASTER_INT +
8)
{
/* It was an IRQ from the master PIC */
- BiosHandleIrq(IntNum - BIOS_PIC_MASTER_INT);
+ BiosHandleIrq(IntNum - BIOS_PIC_MASTER_INT, Stack);
return;
}
else if (IntNum >= BIOS_PIC_SLAVE_INT && IntNum <
BIOS_PIC_SLAVE_INT + 8)
{
/* It was an IRQ from the slave PIC */
- BiosHandleIrq(IntNum - BIOS_PIC_SLAVE_INT + 8);
+ BiosHandleIrq(IntNum - BIOS_PIC_SLAVE_INT + 8, Stack);
return;
}
@@ -225,46 +235,46 @@
case BIOS_VIDEO_INTERRUPT:
{
/* This is the video BIOS interrupt, call the BIOS */
- BiosVideoService();
+ BiosVideoService(Stack);
break;
}
case BIOS_EQUIPMENT_INTERRUPT:
{
/* This is the BIOS "get equipment" command, call the BIOS */
- BiosEquipmentService();
+ BiosEquipmentService(Stack);
break;
}
case BIOS_KBD_INTERRUPT:
{
/* This is the keyboard BIOS interrupt, call the BIOS */
- BiosKeyboardService();
+ BiosKeyboardService(Stack);
break;
}
case BIOS_TIME_INTERRUPT:
{
/* This is the time BIOS interrupt, call the BIOS */
- BiosTimeService();
+ BiosTimeService(Stack);
break;
}
case BIOS_SYS_TIMER_INTERRUPT:
{
/* BIOS timer update */
- BiosSystemTimerInterrupt();
+ BiosSystemTimerInterrupt(Stack);
break;
}
case 0x20:
{
- DosInt20h(CodeSegment);
+ DosInt20h(Stack);
break;
}
case 0x21:
{
- DosInt21h(CodeSegment);
+ DosInt21h(Stack);
break;
}
case 0x23:
{
- DosBreakInterrupt();
+ DosBreakInterrupt(Stack);
break;
}
default:
@@ -273,13 +283,6 @@
break;
}
}
-
- /* Update the flags on the stack */
-#ifndef NEW_EMULATOR
- Stack[3] = EmulatorContext.state->reg_flags.val;
-#else
- Stack[3] = EmulatorContext.Flags.LowWord;
-#endif
}
}
Modified: branches/ntvdm/subsystems/ntvdm/emulator.h
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/emulator…
==============================================================================
--- branches/ntvdm/subsystems/ntvdm/emulator.h [iso-8859-1] (original)
+++ branches/ntvdm/subsystems/ntvdm/emulator.h [iso-8859-1] Tue Jul 23 21:43:57 2013
@@ -72,6 +72,10 @@
#define MAX_GDT_ENTRIES 8192
#define EMULATOR_BOP 0xC4C4
#define EMULATOR_INT_BOP 0xBEEF
+#define STACK_INT_NUM 0
+#define STACK_IP 1
+#define STACK_CS 2
+#define STACK_FLAGS 3
enum
{