ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
October 2013
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
14 participants
325 discussions
Start a n
N
ew thread
[aandrejevic] 60761: [FAST486] Separate external interrupts from interrupt signals (which are interrupts whose number is not known until they can be serviced, just like hardware interrupts on a rea...
by aandrejevic@svn.reactos.org
Author: aandrejevic Date: Sun Oct 27 00:37:01 2013 New Revision: 60761 URL:
http://svn.reactos.org/svn/reactos?rev=60761&view=rev
Log: [FAST486] Separate external interrupts from interrupt signals (which are interrupts whose number is not known until they can be serviced, just like hardware interrupts on a real CPU). [NTVDM] Improve the PIC emulation code (IRQ priorities, etc...). Instead of checking for interrupts in the main loop, move the PS/2 input parsing to a different thread. Improve BIOS keyboard IRQ handling. 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/bios.c branches/ntvdm/subsystems/ntvdm/emulator.c branches/ntvdm/subsystems/ntvdm/emulator.h branches/ntvdm/subsystems/ntvdm/ntvdm.c branches/ntvdm/subsystems/ntvdm/pic.c branches/ntvdm/subsystems/ntvdm/pic.h branches/ntvdm/subsystems/ntvdm/ps2.c branches/ntvdm/subsystems/ntvdm/ps2.h 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] Sun Oct 27 00:37:01 2013 @@ -145,6 +145,13 @@ FAST486_EXCEPTION_MC = 0x12 } FAST486_EXCEPTIONS, *PFAST486_EXCEPTIONS; +typedef enum _FAST486_INT_STATUS +{ + FAST486_INT_NONE = 0, + FAST486_INT_EXECUTE = 1, + FAST486_INT_SIGNAL = 2 +} FAST486_INT_STATUS, *PFAST486_INT_STATUS; + typedef BOOLEAN (NTAPI *FAST486_MEM_READ_PROC) @@ -198,6 +205,13 @@ ( PFAST486_STATE State, USHORT BopCode +); + +typedef +UCHAR +(NTAPI *FAST486_INT_ACK_PROC) +( + PFAST486_STATE State ); typedef union _FAST486_REG @@ -352,6 +366,7 @@ FAST486_IO_WRITE_PROC IoWriteCallback; FAST486_IDLE_PROC IdleCallback; FAST486_BOP_PROC BopCallback; + FAST486_INT_ACK_PROC IntAckCallback; FAST486_REG GeneralRegs[FAST486_NUM_GEN_REGS]; FAST486_SEG_REG SegmentRegs[FAST486_NUM_SEG_REGS]; FAST486_REG InstPtr, SavedInstPtr; @@ -362,7 +377,7 @@ ULONG ExceptionCount; ULONG PrefixFlags; FAST486_SEG_REGS SegmentOverride; - BOOLEAN HardwareInt; + FAST486_INT_STATUS IntStatus; UCHAR PendingIntNum; }; @@ -398,6 +413,10 @@ VOID NTAPI +Fast486InterruptSignal(PFAST486_STATE State); + +VOID +NTAPI Fast486ExecuteAt(PFAST486_STATE State, USHORT Segment, ULONG Offset); VOID 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] Sun Oct 27 00:37:01 2013 @@ -61,10 +61,22 @@ { State->SavedInstPtr = State->InstPtr; - /* Check if interrupts are enabled and there is an interrupt pending */ - if (State->Flags.If && State->HardwareInt) + /* + * Check if there is an interrupt to execute, or a hardware interrupt signal + * while interrupts are enabled. + */ + if ((State->IntStatus == FAST486_INT_EXECUTE) + || (State->Flags.If + && (State->IntAckCallback != NULL) + && (State->IntStatus == FAST486_INT_SIGNAL))) { FAST486_IDT_ENTRY IdtEntry; + + if (State->IntStatus == FAST486_INT_SIGNAL) + { + /* Acknowledge the interrupt to get the number */ + State->PendingIntNum = State->IntAckCallback(State); + } /* Get the interrupt vector */ if (Fast486GetIntVector(State, State->PendingIntNum, &IdtEntry)) @@ -76,8 +88,8 @@ IdtEntry.Type); } - /* Clear the interrupt pending flag */ - State->HardwareInt = FALSE; + /* Clear the interrupt status */ + State->IntStatus = FAST486_INT_NONE; } } @@ -243,6 +255,7 @@ FAST486_IO_WRITE_PROC IoWriteCallback = State->IoWriteCallback; FAST486_IDLE_PROC IdleCallback = State->IdleCallback; FAST486_BOP_PROC BopCallback = State->BopCallback; + FAST486_INT_ACK_PROC IntAckCallback = State->IntAckCallback; /* Clear the entire structure */ RtlZeroMemory(State, sizeof(*State)); @@ -278,15 +291,24 @@ State->IoWriteCallback = IoWriteCallback; State->IdleCallback = IdleCallback; State->BopCallback = BopCallback; + State->IntAckCallback = IntAckCallback; } VOID NTAPI Fast486Interrupt(PFAST486_STATE State, UCHAR Number) { - /* Set the hardware interrupt flag */ - State->HardwareInt = TRUE; + /* Set the interrupt status and the number */ + State->IntStatus = FAST486_INT_EXECUTE; State->PendingIntNum = Number; +} + +VOID +NTAPI +Fast486InterruptSignal(PFAST486_STATE State) +{ + /* Set the interrupt status */ + State->IntStatus = FAST486_INT_SIGNAL; } 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] Sun Oct 27 00:37:01 2013 @@ -876,7 +876,7 @@ } /* Halt */ - while (!State->HardwareInt) State->IdleCallback(State); + while (State->IntStatus != FAST486_INT_SIGNAL) State->IdleCallback(State); /* Return success */ return TRUE; 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] Sun Oct 27 00:37:01 2013 @@ -1092,39 +1092,40 @@ BYTE ScanCode, VirtualKey; WORD Character; - /* Check if there is a scancode available */ - if (!(KeyboardReadStatus() & 1)) break; - - /* Get the scan code and virtual key code */ - ScanCode = KeyboardReadData(); - VirtualKey = MapVirtualKey(ScanCode & 0x7F, MAPVK_VSC_TO_VK); - - /* Check if this is a key press or release */ - if (!(ScanCode & (1 << 7))) + /* Loop while there is a scancode available */ + while (KeyboardReadStatus() & 1) { - /* Key press */ - if (VirtualKey == VK_NUMLOCK - || VirtualKey == VK_CAPITAL - || VirtualKey == VK_SCROLL) + /* Get the scan code and virtual key code */ + ScanCode = KeyboardReadData(); + VirtualKey = MapVirtualKey(ScanCode & 0x7F, MAPVK_VSC_TO_VK); + + /* Check if this is a key press or release */ + if (!(ScanCode & (1 << 7))) { - /* For toggle keys, toggle the lowest bit in the keyboard map */ - BiosKeyboardMap[VirtualKey] ^= ~(1 << 0); + /* Key press */ + if (VirtualKey == VK_NUMLOCK + || VirtualKey == VK_CAPITAL + || VirtualKey == VK_SCROLL) + { + /* For toggle keys, toggle the lowest bit in the keyboard map */ + BiosKeyboardMap[VirtualKey] ^= ~(1 << 0); + } + + /* Set the highest bit */ + BiosKeyboardMap[VirtualKey] |= (1 << 7); + + /* Find out which character this is */ + if (ToAscii(VirtualKey, ScanCode, BiosKeyboardMap, &Character, 0) > 0) + { + /* Push it onto the BIOS keyboard queue */ + BiosKbdBufferPush((ScanCode << 8) | (Character & 0xFF)); + } } - - /* Set the highest bit */ - BiosKeyboardMap[VirtualKey] |= (1 << 7); - - /* Find out which character this is */ - if (ToAscii(VirtualKey, ScanCode, BiosKeyboardMap, &Character, 0) > 0) + else { - /* Push it onto the BIOS keyboard queue */ - BiosKbdBufferPush((ScanCode << 8) | (Character & 0xFF)); + /* Key release, unset the highest bit */ + BiosKeyboardMap[VirtualKey] &= ~(1 << 7); } - } - else - { - /* Key release, unset the highest bit */ - BiosKeyboardMap[VirtualKey] &= ~(1 << 7); } break; 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 Oct 27 00:37:01 2013 @@ -329,6 +329,14 @@ } } +static BYTE WINAPI EmulatorIntAcknowledge(PFAST486_STATE State) +{ + UNREFERENCED_PARAMETER(State); + + /* Get the interrupt number from the PIC */ + return PicGetInterrupt(); +} + /* PUBLIC FUNCTIONS ***********************************************************/ BOOLEAN EmulatorInitialize() @@ -342,7 +350,8 @@ EmulatorContext.MemWriteCallback = (FAST486_MEM_WRITE_PROC)EmulatorWriteMemory; EmulatorContext.IoReadCallback = (FAST486_IO_READ_PROC)EmulatorReadIo; EmulatorContext.IoWriteCallback = (FAST486_IO_WRITE_PROC)EmulatorWriteIo; - EmulatorContext.BopCallback = (FAST486_BOP_PROC)EmulatorBiosOperation; + EmulatorContext.BopCallback = EmulatorBiosOperation; + EmulatorContext.IntAckCallback = EmulatorIntAcknowledge; /* Reset the CPU */ Fast486Reset(&EmulatorContext); @@ -371,10 +380,10 @@ Fast486Interrupt(&EmulatorContext, Number); } -VOID EmulatorExternalInterrupt(BYTE Number) +VOID EmulatorInterruptSignal(VOID) { /* Call the Fast486 API */ - Fast486Interrupt(&EmulatorContext, Number); + Fast486InterruptSignal(&EmulatorContext); } ULONG EmulatorGetRegister(ULONG Register) 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] Sun Oct 27 00:37:01 2013 @@ -88,7 +88,7 @@ VOID EmulatorSetStack(WORD Segment, DWORD Offset); VOID EmulatorExecute(WORD Segment, WORD Offset); VOID EmulatorInterrupt(BYTE Number); -VOID EmulatorExternalInterrupt(BYTE Number); +VOID EmulatorInterruptSignal(VOID); ULONG EmulatorGetRegister(ULONG Register); ULONG EmulatorGetProgramCounter(VOID); VOID EmulatorSetRegister(ULONG Register, ULONG Value); Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.c URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.c?…
============================================================================== --- branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/ntvdm.c [iso-8859-1] Sun Oct 27 00:37:01 2013 @@ -79,12 +79,12 @@ INT i; CHAR CommandLine[DOS_CMDLINE_LENGTH]; DWORD CurrentTickCount; - DWORD LastTickCount = GetTickCount(); DWORD Cycles = 0; DWORD LastCyclePrintout = GetTickCount(); DWORD LastVerticalRefresh = GetTickCount(); LARGE_INTEGER Frequency, LastTimerTick, Counter; LONGLONG TimerTicks; + HANDLE InputThread = NULL; /* Set the handler routine */ SetConsoleCtrlHandler(ConsoleCtrlHandler, TRUE); @@ -141,6 +141,9 @@ DisplayMessage(L"Could not start program: %S", CommandLine); return -1; } + + /* Start the input thread */ + InputThread = CreateThread(NULL, 0, &InputThreadProc, NULL, 0, NULL); /* Set the last timer tick to the current time */ QueryPerformanceCounter(&LastTimerTick); @@ -162,13 +165,6 @@ for (i = 0; i < TimerTicks; i++) PitDecrementCount(); LastTimerTick = Counter; - /* Check for console input events every millisecond */ - if (CurrentTickCount != LastTickCount) - { - CheckForInputEvents(); - LastTickCount = CurrentTickCount; - } - /* Check for vertical retrace */ if ((CurrentTickCount - LastVerticalRefresh) >= 16) { @@ -198,6 +194,7 @@ VgaRefreshDisplay(); Cleanup: + if (InputThread != NULL) CloseHandle(InputThread); BiosCleanup(); EmulatorCleanup(); Modified: branches/ntvdm/subsystems/ntvdm/pic.c URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/pic.c?re…
============================================================================== --- branches/ntvdm/subsystems/ntvdm/pic.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/pic.c [iso-8859-1] Sun Oct 27 00:37:01 2013 @@ -35,8 +35,8 @@ } else { - /* The IRR is always 0, as the emulated CPU receives the interrupt instantly */ - return 0; + /* Read the interrupt request register */ + return Pic->IntRequestRegister; } } @@ -167,9 +167,9 @@ /* Check if the interrupt is masked */ if (MasterPic.MaskRegister & (1 << Number)) return; - /* Set the appropriate bit in the ISR and interrupt the CPU */ - if (!MasterPic.AutoEoi) MasterPic.InServiceRegister |= 1 << Number; - EmulatorExternalInterrupt(MasterPic.IntOffset + Number); + /* Set the appropriate bit in the IRR and interrupt the CPU */ + MasterPic.IntRequestRegister |= 1 << Number; + EmulatorInterruptSignal(); } else if (Number >= 8 && Number < 16) { @@ -187,7 +187,7 @@ /* Check if any of the higher-priorirty interrupts are busy */ if (MasterPic.InServiceRegister != 0) return; - for (i = 0; i <= Number ; i++) + for (i = 0; i <= Number; i++) { if (SlavePic.InServiceRegister & (1 << Number)) return; } @@ -196,12 +196,57 @@ if (SlavePic.MaskRegister & (1 << Number)) return; /* Set the IRQ 2 bit in the master ISR */ - if (!MasterPic.AutoEoi) MasterPic.InServiceRegister |= 1 << 2; - - /* Set the appropriate bit in the ISR and interrupt the CPU */ - if (!SlavePic.AutoEoi) SlavePic.InServiceRegister |= 1 << Number; - EmulatorExternalInterrupt(SlavePic.IntOffset + Number); - } + if (!MasterPic.AutoEoi) MasterPic.InServiceRegister |= (1 << 2); + + /* Set the appropriate bit in the IRR and interrupt the CPU */ + SlavePic.IntRequestRegister |= 1 << Number; + EmulatorInterruptSignal(); + } +} + +BYTE PicGetInterrupt(VOID) +{ + INT i, j; + + /* Search interrupts by priority */ + for (i = 0; i < 8; i++) + { + /* Check if this line is cascaded to the slave PIC */ + if ((i == 2) + && MasterPic.CascadeRegister & (1 << 2) + && SlavePic.Slave + && (SlavePic.CascadeRegister == 2)) + { + /* Search the slave PIC interrupts by priority */ + for (j = 0; j < 8; j++) if ((j != 1) && SlavePic.IntRequestRegister & (1 << j)) + { + /* Clear the IRR flag */ + SlavePic.IntRequestRegister &= ~(1 << j); + + /* Set the ISR flag, unless AEOI is enabled */ + if (!SlavePic.AutoEoi) SlavePic.InServiceRegister |= (1 << j); + + /* Return the interrupt number */ + return SlavePic.IntOffset + j; + } + } + + if (MasterPic.IntRequestRegister & (1 << i)) + { + /* Clear the IRR flag */ + MasterPic.IntRequestRegister &= ~(1 << i); + + /* Set the ISR flag, unless AEOI is enabled */ + if (!MasterPic.AutoEoi) MasterPic.InServiceRegister |= (1 << i); + + /* Return the interrupt number */ + return MasterPic.IntOffset + i; + } + } + + /* Spurious interrupt */ + if (MasterPic.InServiceRegister & (1 << 2)) return SlavePic.IntOffset + 7; + else return MasterPic.IntOffset + 7; } /* EOF */ Modified: branches/ntvdm/subsystems/ntvdm/pic.h URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/pic.h?re…
============================================================================== --- branches/ntvdm/subsystems/ntvdm/pic.h [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/pic.h [iso-8859-1] Sun Oct 27 00:37:01 2013 @@ -34,6 +34,7 @@ { BOOLEAN Initialization; BYTE MaskRegister; + BYTE IntRequestRegister; BYTE InServiceRegister; BYTE IntOffset; BYTE ConfigRegister; @@ -51,6 +52,7 @@ BYTE PicReadData(BYTE Port); VOID PicWriteData(BYTE Port, BYTE Value); VOID PicInterruptRequest(BYTE Number); +BYTE PicGetInterrupt(VOID); #endif // _PIC_H_ Modified: branches/ntvdm/subsystems/ntvdm/ps2.c URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ps2.c?re…
============================================================================== --- branches/ntvdm/subsystems/ntvdm/ps2.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/ps2.c [iso-8859-1] Sun Oct 27 00:37:01 2013 @@ -265,49 +265,64 @@ // TODO: Implement PS/2 device commands } -VOID CheckForInputEvents() -{ - PINPUT_RECORD Buffer; +DWORD WINAPI InputThreadProc(LPVOID Parameter) +{ + INT i; HANDLE ConsoleInput = GetStdHandle(STD_INPUT_HANDLE); - DWORD i, j, Count, TotalEvents; - BYTE ScanCode; - BOOLEAN Interrupt = FALSE; - - /* Get the number of input events */ - if (!GetNumberOfConsoleInputEvents(ConsoleInput, &Count)) return; - if (Count == 0) return; - - /* Allocate the buffer */ - Buffer = (PINPUT_RECORD)HeapAlloc(GetProcessHeap(), 0, Count * sizeof(INPUT_RECORD)); - if (Buffer == NULL) return; - - /* Peek the input events */ - if (!ReadConsoleInput(ConsoleInput, Buffer, Count, &TotalEvents)) goto Cleanup; - - for (i = 0; i < TotalEvents; i++) - { - /* Check if this is a key event */ - if (Buffer[i].EventType != KEY_EVENT) continue; - - /* Get the scan code */ - ScanCode = (BYTE)Buffer[i].Event.KeyEvent.wVirtualScanCode; - - /* If this is a key release, set the highest bit in the scan code */ - if (!Buffer[i].Event.KeyEvent.bKeyDown) ScanCode |= 0x80; - - /* Push the scan code onto the keyboard queue */ - for (j = 0; j < Buffer[i].Event.KeyEvent.wRepeatCount; j++) - { - KeyboardQueuePush(ScanCode); - } - - Interrupt = TRUE; - } - - if (Interrupt) PicInterruptRequest(1); - -Cleanup: - HeapFree(GetProcessHeap(), 0, Buffer); + INPUT_RECORD InputRecord; + DWORD Count; + + while (VdmRunning) + { + /* Wait for an input record */ + if (!ReadConsoleInput(ConsoleInput, &InputRecord, 1, &Count)) + { + DPRINT1("Error reading console input\n"); + return GetLastError(); + + } + + ASSERT(Count != 0); + + /* Check the event type */ + switch (InputRecord.EventType) + { + case KEY_EVENT: + { + BYTE ScanCode = (BYTE)InputRecord.Event.KeyEvent.wVirtualScanCode; + + /* If this is a key release, set the highest bit in the scan code */ + if (!InputRecord.Event.KeyEvent.bKeyDown) ScanCode |= 0x80; + + /* Push the scan code onto the keyboard queue */ + for (i = 0; i < InputRecord.Event.KeyEvent.wRepeatCount; i++) + { + KeyboardQueuePush(ScanCode); + } + + /* Keyboard IRQ */ + PicInterruptRequest(1); + + break; + } + + case MOUSE_EVENT: + { + // TODO: NOT IMPLEMENTED + UNIMPLEMENTED; + + break; + } + + default: + { + /* Ignored */ + break; + } + } + } + + return 0; } /* EOF */ Modified: branches/ntvdm/subsystems/ntvdm/ps2.h URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ps2.h?re…
============================================================================== --- branches/ntvdm/subsystems/ntvdm/ps2.h [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/ps2.h [iso-8859-1] Sun Oct 27 00:37:01 2013 @@ -28,7 +28,7 @@ VOID KeyboardWriteCommand(BYTE Command); BYTE KeyboardReadData(); VOID KeyboardWriteData(BYTE Data); -VOID CheckForInputEvents(); +DWORD WINAPI InputThreadProc(LPVOID Parameter); #endif // _PS2_H_
11 years, 1 month
1
0
0
0
[hbelusca] 60760: Add the definition for WriteConsoleInputVDM too.
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sat Oct 26 21:30:44 2013 New Revision: 60760 URL:
http://svn.reactos.org/svn/reactos?rev=60760&view=rev
Log: Add the definition for WriteConsoleInputVDM too. Modified: trunk/reactos/include/psdk/wincon.h Modified: trunk/reactos/include/psdk/wincon.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/wincon.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/wincon.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/wincon.h [iso-8859-1] Sat Oct 26 21:30:44 2013 @@ -695,6 +695,7 @@ #define SetConsoleTitle SetConsoleTitleW #define WriteConsole WriteConsoleW #define WriteConsoleInput WriteConsoleInputW +#define WriteConsoleInputVDM WriteConsoleInputVDMW #define WriteConsoleOutput WriteConsoleOutputW #define FillConsoleOutputCharacter FillConsoleOutputCharacterW #define WriteConsoleOutputCharacter WriteConsoleOutputCharacterW @@ -715,6 +716,7 @@ #define SetConsoleTitle SetConsoleTitleA #define WriteConsole WriteConsoleA #define WriteConsoleInput WriteConsoleInputA +#define WriteConsoleInputVDM WriteConsoleInputVDMA #define WriteConsoleOutput WriteConsoleOutputA #define FillConsoleOutputCharacter FillConsoleOutputCharacterA #define WriteConsoleOutputCharacter WriteConsoleOutputCharacterA
11 years, 1 month
1
0
0
0
[akhaldi] 60759: [WBEMPROX] * Sync with Wine 1.7.2. Hello LocalDateTime.
by akhaldi@svn.reactos.org
Author: akhaldi Date: Sat Oct 26 21:29:03 2013 New Revision: 60759 URL:
http://svn.reactos.org/svn/reactos?rev=60759&view=rev
Log: [WBEMPROX] * Sync with Wine 1.7.2. Hello LocalDateTime. Modified: trunk/reactos/dll/win32/wbemprox/builtin.c trunk/reactos/media/doc/README.WINE Modified: trunk/reactos/dll/win32/wbemprox/builtin.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wbemprox/builtin…
============================================================================== --- trunk/reactos/dll/win32/wbemprox/builtin.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/wbemprox/builtin.c [iso-8859-1] Sat Oct 26 21:29:03 2013 @@ -166,6 +166,8 @@ {'I','n','t','e','g','e','r','V','a','l','u','e',0}; static const WCHAR prop_lastbootuptimeW[] = {'L','a','s','t','B','o','o','t','U','p','T','i','m','e',0}; +static const WCHAR prop_localdatetimeW[] = + {'L','o','c','a','l','D','a','t','e','T','i','m','e',0}; static const WCHAR prop_localeW[] = {'L','o','c','a','l','e',0}; static const WCHAR prop_macaddressW[] = @@ -345,6 +347,7 @@ { prop_countrycodeW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_csdversionW, CIM_STRING }, { prop_lastbootuptimeW, CIM_DATETIME|COL_FLAG_DYNAMIC }, + { prop_localdatetimeW, CIM_DATETIME|COL_FLAG_DYNAMIC }, { prop_localeW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_osarchitectureW, CIM_STRING }, { prop_oslanguageW, CIM_UINT32, VT_I4 }, @@ -597,6 +600,7 @@ const WCHAR *countrycode; const WCHAR *csdversion; const WCHAR *lastbootuptime; + const WCHAR *localdatetime; const WCHAR *locale; const WCHAR *osarchitecture; UINT32 oslanguage; @@ -1787,6 +1791,31 @@ sprintfW( ret, fmtW, tf.Year, tf.Month, tf.Day, tf.Hour, tf.Minute, tf.Second, tf.Milliseconds * 1000 ); return ret; } +static WCHAR *get_localdatetime(void) +{ + static const WCHAR fmtW[] = + {'%','0','4','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u','%','0','2','u', + '.','%','0','6','u','%','+','0','3','d',0}; + TIME_ZONE_INFORMATION tzi; + SYSTEMTIME st; + WCHAR *ret; + DWORD Status; + LONG Bias; + + Status = GetTimeZoneInformation(&tzi); + + if(Status == TIME_ZONE_ID_INVALID) return NULL; + Bias = tzi.Bias; + if(Status == TIME_ZONE_ID_DAYLIGHT) + Bias+= tzi.DaylightBias; + else + Bias+= tzi.StandardBias; + if (!(ret = heap_alloc( 26 * sizeof(WCHAR) ))) return NULL; + + GetLocalTime(&st); + sprintfW( ret, fmtW, st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds * 1000, -Bias); + return ret; +} static WCHAR *get_systemdirectory(void) { void *redir; @@ -1832,6 +1861,7 @@ rec->countrycode = get_countrycode(); rec->csdversion = os_csdversionW; rec->lastbootuptime = get_lastbootuptime(); + rec->localdatetime = get_localdatetime(); rec->locale = get_locale(); rec->osarchitecture = get_osarchitecture(); rec->oslanguage = GetSystemDefaultLangID(); Modified: trunk/reactos/media/doc/README.WINE URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=…
============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Sat Oct 26 21:29:03 2013 @@ -199,7 +199,7 @@ reactos/dll/win32/uxtheme # Forked reactos/dll/win32/vbscript # Synced to Wine-1.7.1 reactos/dll/win32/version # Autosync -reactos/dll/win32/wbemprox # Synced to Wine-1.7.1 +reactos/dll/win32/wbemprox # Synced to Wine-1.7.2 reactos/dll/win32/wer # Autosync reactos/dll/win32/windowscodecs # Synced to Wine-1.7.1 reactos/dll/win32/windowscodecsext # Synced to Wine-1.7.1
11 years, 1 month
1
0
0
0
[hbelusca] 60758: [SOFTX86] Remove the now-unneeded headers. Bye-bye SoftX86 !
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sat Oct 26 21:26:28 2013 New Revision: 60758 URL:
http://svn.reactos.org/svn/reactos?rev=60758&view=rev
Log: [SOFTX86] Remove the now-unneeded headers. Bye-bye SoftX86 ! Removed: branches/ntvdm/include/reactos/libs/softx86/
11 years, 1 month
1
0
0
0
[aandrejevic] 60757: [SOFTX86] Remove softx86, as it is no longer used by anything.
by aandrejevic@svn.reactos.org
Author: aandrejevic Date: Sat Oct 26 20:53:33 2013 New Revision: 60757 URL:
http://svn.reactos.org/svn/reactos?rev=60757&view=rev
Log: [SOFTX86] Remove softx86, as it is no longer used by anything. Removed: branches/ntvdm/lib/3rdparty/softx86/ Modified: branches/ntvdm/lib/3rdparty/CMakeLists.txt branches/ntvdm/subsystems/ntvdm/CMakeLists.txt Modified: branches/ntvdm/lib/3rdparty/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/3rdparty/CMakeLists.t…
============================================================================== --- branches/ntvdm/lib/3rdparty/CMakeLists.txt [iso-8859-1] (original) +++ branches/ntvdm/lib/3rdparty/CMakeLists.txt [iso-8859-1] Sat Oct 26 20:53:33 2013 @@ -8,7 +8,6 @@ add_subdirectory(libsamplerate) add_subdirectory(libwine) add_subdirectory(libxml2) -add_subdirectory(softx86) if(MSVC) add_subdirectory(stlport) endif() Modified: branches/ntvdm/subsystems/ntvdm/CMakeLists.txt URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/CMakeLis…
============================================================================== --- branches/ntvdm/subsystems/ntvdm/CMakeLists.txt [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/CMakeLists.txt [iso-8859-1] Sat Oct 26 20:53:33 2013 @@ -1,5 +1,4 @@ -include_directories(${REACTOS_SOURCE_DIR}/include/reactos/libs/softx86) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/libs/fast486) spec2def(ntvdm.exe ntvdm.spec) @@ -19,7 +18,7 @@ add_executable(ntvdm ${SOURCE}) set_module_type(ntvdm win32cui UNICODE) -target_link_libraries(ntvdm softx86 softx87 fast486) +target_link_libraries(ntvdm fast486) add_importlibs(ntvdm msvcrt user32 gdi32 kernel32 ntdll) -add_dependencies(ntvdm softx86 softx87) +add_dependencies(ntvdm fast486) add_cd_file(TARGET ntvdm DESTINATION reactos/system32 FOR all)
11 years, 1 month
1
0
0
0
[hbelusca] 60756: [KERNEL32][CONSRV] Implement WriteConsoleInputVDMA/W, its only purpose being putting console input events at the beginning of the console input event list instead of putting them ...
by hbelusca@svn.reactos.org
Author: hbelusca Date: Sat Oct 26 20:53:05 2013 New Revision: 60756 URL:
http://svn.reactos.org/svn/reactos?rev=60756&view=rev
Log: [KERNEL32][CONSRV] Implement WriteConsoleInputVDMA/W, its only purpose being putting console input events at the beginning of the console input event list instead of putting them at the end, as it is done with WriteConsoleInputA/W . Modified: trunk/reactos/dll/win32/kernel32/client/console/console.c trunk/reactos/dll/win32/kernel32/client/console/readwrite.c trunk/reactos/include/psdk/wincon.h trunk/reactos/include/reactos/subsys/win/conmsg.h trunk/reactos/win32ss/user/winsrv/consrv/condrv/coninput.c trunk/reactos/win32ss/user/winsrv/consrv/coninput.c trunk/reactos/win32ss/user/winsrv/consrv/include/conio.h Modified: trunk/reactos/dll/win32/kernel32/client/console/console.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/console/console.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/console/console.c [iso-8859-1] Sat Oct 26 20:53:05 2013 @@ -801,38 +801,6 @@ } return TRUE; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -WriteConsoleInputVDMA(DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2, - DWORD Unknown3) -{ - DPRINT1("WriteConsoleInputVDMA(0x%x, 0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1, Unknown2, Unknown3); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - - -/* - * @unimplemented - */ -DWORD -WINAPI -WriteConsoleInputVDMW(DWORD Unknown0, - DWORD Unknown1, - DWORD Unknown2, - DWORD Unknown3) -{ - DPRINT1("WriteConsoleInputVDMW(0x%x, 0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", Unknown0, Unknown1, Unknown2, Unknown3); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; } Modified: trunk/reactos/dll/win32/kernel32/client/console/readwrite.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/…
============================================================================== --- trunk/reactos/dll/win32/kernel32/client/console/readwrite.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/kernel32/client/console/readwrite.c [iso-8859-1] Sat Oct 26 20:53:05 2013 @@ -460,7 +460,8 @@ PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsWritten, - BOOL bUnicode) + BOOL bUnicode, + BOOL bAppendToEnd) { CONSOLE_API_MESSAGE ApiMessage; PCONSOLE_WRITEINPUT WriteInputRequest = &ApiMessage.Data.WriteInputRequest; @@ -488,8 +489,9 @@ /* Set up the data to send to the Console Server */ WriteInputRequest->InputHandle = hConsoleInput; + WriteInputRequest->Length = nLength; WriteInputRequest->Unicode = bUnicode; - WriteInputRequest->Length = nLength; + WriteInputRequest->AppendToEnd = bAppendToEnd; /* Call the server */ CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage, @@ -1086,6 +1088,7 @@ (PINPUT_RECORD)lpBuffer, nLength, lpNumberOfEventsWritten, + TRUE, TRUE); } @@ -1106,6 +1109,49 @@ (PINPUT_RECORD)lpBuffer, nLength, lpNumberOfEventsWritten, + FALSE, + TRUE); +} + + +/*-------------------------------------------------------------- + * WriteConsoleInputVDMW + * + * @implemented + */ +BOOL +WINAPI +WriteConsoleInputVDMW(HANDLE hConsoleInput, + CONST INPUT_RECORD *lpBuffer, + DWORD nLength, + LPDWORD lpNumberOfEventsWritten) +{ + return IntWriteConsoleInput(hConsoleInput, + (PINPUT_RECORD)lpBuffer, + nLength, + lpNumberOfEventsWritten, + TRUE, + FALSE); +} + + +/*-------------------------------------------------------------- + * WriteConsoleInputVDMA + * + * @implemented + */ +BOOL +WINAPI +WriteConsoleInputVDMA(HANDLE hConsoleInput, + CONST INPUT_RECORD *lpBuffer, + DWORD nLength, + LPDWORD lpNumberOfEventsWritten) +{ + return IntWriteConsoleInput(hConsoleInput, + (PINPUT_RECORD)lpBuffer, + nLength, + lpNumberOfEventsWritten, + FALSE, FALSE); } Modified: trunk/reactos/include/psdk/wincon.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/wincon.h?rev=…
============================================================================== --- trunk/reactos/include/psdk/wincon.h [iso-8859-1] (original) +++ trunk/reactos/include/psdk/wincon.h [iso-8859-1] Sat Oct 26 20:53:05 2013 @@ -611,6 +611,22 @@ BOOL WINAPI WriteConsoleInputW( + _In_ HANDLE hConsoleInput, + _In_reads_(nLength) CONST INPUT_RECORD *lpBuffer, + _In_ DWORD nLength, + _Out_ LPDWORD lpNumberOfEventsWritten); + +BOOL +WINAPI +WriteConsoleInputVDMA( + _In_ HANDLE hConsoleInput, + _In_reads_(nLength) CONST INPUT_RECORD *lpBuffer, + _In_ DWORD nLength, + _Out_ LPDWORD lpNumberOfEventsWritten); + +BOOL +WINAPI +WriteConsoleInputVDMW( _In_ HANDLE hConsoleInput, _In_reads_(nLength) CONST INPUT_RECORD *lpBuffer, _In_ DWORD nLength, Modified: trunk/reactos/include/reactos/subsys/win/conmsg.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/win…
============================================================================== --- trunk/reactos/include/reactos/subsys/win/conmsg.h [iso-8859-1] (original) +++ trunk/reactos/include/reactos/subsys/win/conmsg.h [iso-8859-1] Sat Oct 26 20:53:05 2013 @@ -492,9 +492,10 @@ typedef struct { HANDLE InputHandle; - BOOL Unicode; DWORD Length; INPUT_RECORD* InputRecord; + BOOL Unicode; + BOOL AppendToEnd; } CONSOLE_WRITEINPUT, *PCONSOLE_WRITEINPUT; typedef struct Modified: trunk/reactos/win32ss/user/winsrv/consrv/condrv/coninput.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
============================================================================== --- trunk/reactos/win32ss/user/winsrv/consrv/condrv/coninput.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/winsrv/consrv/condrv/coninput.c [iso-8859-1] Sat Oct 26 20:53:05 2013 @@ -60,8 +60,9 @@ } NTSTATUS FASTCALL -ConioProcessInputEvent(PCONSOLE Console, - PINPUT_RECORD InputEvent) +ConioAddInputEvent(PCONSOLE Console, + PINPUT_RECORD InputEvent, + BOOLEAN AppendToEnd) { ConsoleInput *ConInRec; @@ -97,7 +98,17 @@ if (ConInRec == NULL) return STATUS_INSUFFICIENT_RESOURCES; ConInRec->InputEvent = *InputEvent; - InsertTailList(&Console->InputBuffer.InputEvents, &ConInRec->ListEntry); + + if (AppendToEnd) + { + /* Append the event to the end of the queue */ + InsertTailList(&Console->InputBuffer.InputEvents, &ConInRec->ListEntry); + } + else + { + /* Append the event to the beginning of the queue */ + InsertHeadList(&Console->InputBuffer.InputEvents, &ConInRec->ListEntry); + } SetEvent(Console->InputBuffer.ActiveEvent); CsrNotifyWait(&Console->InputBuffer.ReadWaitQueue, @@ -110,6 +121,13 @@ } return STATUS_SUCCESS; +} + +NTSTATUS FASTCALL +ConioProcessInputEvent(PCONSOLE Console, + PINPUT_RECORD InputEvent) +{ + return ConioAddInputEvent(Console, InputEvent, TRUE); } VOID FASTCALL @@ -429,6 +447,7 @@ ConDrvWriteConsoleInput(IN PCONSOLE Console, IN PCONSOLE_INPUT_BUFFER InputBuffer, IN BOOLEAN Unicode, + IN BOOLEAN AppendToEnd, IN PINPUT_RECORD InputRecord, IN ULONG NumEventsToWrite, OUT PULONG NumEventsWritten OPTIONAL) @@ -457,7 +476,7 @@ &AsciiChar); } - Status = ConioProcessInputEvent(Console, InputRecord++); + Status = ConioAddInputEvent(Console, InputRecord++, AppendToEnd); } if (NumEventsWritten) *NumEventsWritten = i; Modified: trunk/reactos/win32ss/user/winsrv/consrv/coninput.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
============================================================================== --- trunk/reactos/win32ss/user/winsrv/consrv/coninput.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/winsrv/consrv/coninput.c [iso-8859-1] Sat Oct 26 20:53:05 2013 @@ -391,6 +391,7 @@ ConDrvWriteConsoleInput(IN PCONSOLE Console, IN PCONSOLE_INPUT_BUFFER InputBuffer, IN BOOLEAN Unicode, + IN BOOLEAN AppendToEnd, IN PINPUT_RECORD InputRecord, IN ULONG NumEventsToWrite, OUT PULONG NumEventsWritten OPTIONAL); @@ -420,6 +421,7 @@ Status = ConDrvWriteConsoleInput(InputBuffer->Header.Console, InputBuffer, WriteInputRequest->Unicode, + WriteInputRequest->AppendToEnd, WriteInputRequest->InputRecord, WriteInputRequest->Length, &NumEventsWritten); Modified: trunk/reactos/win32ss/user/winsrv/consrv/include/conio.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/winsrv/consrv…
============================================================================== --- trunk/reactos/win32ss/user/winsrv/consrv/include/conio.h [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/winsrv/consrv/include/conio.h [iso-8859-1] Sat Oct 26 20:53:05 2013 @@ -348,6 +348,9 @@ /* coninput.c */ VOID NTAPI ConioProcessKey(PCONSOLE Console, MSG* msg); +NTSTATUS FASTCALL ConioAddInputEvent(PCONSOLE Console, + PINPUT_RECORD InputEvent, + BOOLEAN AppendToEnd); NTSTATUS FASTCALL ConioProcessInputEvent(PCONSOLE Console, PINPUT_RECORD InputEvent);
11 years, 1 month
1
0
0
0
[aandrejevic] 60755: [NTVDM] Remove softx86 support, and use only fast486, since it is now sufficiently functional.
by aandrejevic@svn.reactos.org
Author: aandrejevic Date: Sat Oct 26 20:48:31 2013 New Revision: 60755 URL:
http://svn.reactos.org/svn/reactos?rev=60755&view=rev
Log: [NTVDM] Remove softx86 support, and use only fast486, since it is now sufficiently functional. Modified: branches/ntvdm/subsystems/ntvdm/emulator.c branches/ntvdm/subsystems/ntvdm/emulator.h branches/ntvdm/subsystems/ntvdm/ntvdm.h branches/ntvdm/subsystems/ntvdm/registers.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] Sat Oct 26 20:48:31 2013 @@ -20,18 +20,13 @@ /* PRIVATE VARIABLES **********************************************************/ -#ifndef NEW_EMULATOR -softx86_ctx EmulatorContext; -softx87_ctx FpuEmulatorContext; -#else FAST486_STATE EmulatorContext; -#endif static BOOLEAN A20Line = FALSE; /* PRIVATE FUNCTIONS **********************************************************/ -static VOID NTVDMCALL EmulatorReadMemory(PVOID Context, UINT Address, LPBYTE Buffer, INT Size) +static VOID WINAPI EmulatorReadMemory(PVOID Context, UINT Address, LPBYTE Buffer, INT Size) { UNREFERENCED_PARAMETER(Context); @@ -56,7 +51,7 @@ } } -static VOID NTVDMCALL EmulatorWriteMemory(PVOID Context, UINT Address, LPBYTE Buffer, INT Size) +static VOID WINAPI EmulatorWriteMemory(PVOID Context, UINT Address, LPBYTE Buffer, INT Size) { UNREFERENCED_PARAMETER(Context); @@ -84,7 +79,7 @@ } } -static VOID NTVDMCALL EmulatorReadIo(PVOID Context, UINT Address, LPBYTE Buffer, INT Size) +static VOID WINAPI EmulatorReadIo(PVOID Context, UINT Address, LPBYTE Buffer, INT Size) { UNREFERENCED_PARAMETER(Context); UNREFERENCED_PARAMETER(Size); @@ -152,7 +147,7 @@ } } -static VOID NTVDMCALL EmulatorWriteIo(PVOID Context, UINT Address, LPBYTE Buffer, INT Size) +static VOID WINAPI EmulatorWriteIo(PVOID Context, UINT Address, LPBYTE Buffer, INT Size) { BYTE Byte = *Buffer; @@ -228,20 +223,15 @@ } } -static VOID EmulatorBop(WORD Code) +static VOID WINAPI EmulatorBiosOperation(PFAST486_STATE State, WORD Code) { WORD StackSegment, StackPointer, CodeSegment, InstructionPointer; BYTE IntNum; LPWORD Stack; /* Get the SS:SP */ -#ifndef NEW_EMULATOR - StackSegment = EmulatorContext.state->segment_reg[SX86_SREG_SS].val; - StackPointer = EmulatorContext.state->general_reg[SX86_REG_SP].val; -#else - StackSegment = EmulatorContext.SegmentRegs[FAST486_REG_SS].Selector; - StackPointer = EmulatorContext.GeneralRegs[FAST486_REG_ESP].LowWord; -#endif + StackSegment = State->SegmentRegs[FAST486_REG_SS].Selector; + StackPointer = State->GeneralRegs[FAST486_REG_ESP].LowWord; /* Get the stack */ Stack = (LPWORD)((ULONG_PTR)BaseAddress + TO_LINEAR(StackSegment, StackPointer)); @@ -339,47 +329,6 @@ } } -#ifdef NEW_EMULATOR -static VOID WINAPI EmulatorBiosOperation(PFAST486_STATE State, WORD Code) -{ - /* - * HACK: To maintain softx86 compatbility, just call the old EmulatorBop here. - * Later on, when softx86 is no longer needed, the code from EmulatorBop should - * be moved here and should use the "State" variable. - */ - EmulatorBop(Code); -} - -#endif - -#ifndef NEW_EMULATOR - -static VOID EmulatorSoftwareInt(PVOID Context, BYTE Number) -{ - UNREFERENCED_PARAMETER(Context); - UNREFERENCED_PARAMETER(Number); - - /* Do nothing */ -} - -static VOID EmulatorHardwareInt(PVOID Context, BYTE Number) -{ - UNREFERENCED_PARAMETER(Context); - UNREFERENCED_PARAMETER(Number); - - /* Do nothing */ -} - -static VOID EmulatorHardwareIntAck(PVOID Context, BYTE Number) -{ - UNREFERENCED_PARAMETER(Context); - UNREFERENCED_PARAMETER(Number); - - /* Do nothing */ -} - -#endif - /* PUBLIC FUNCTIONS ***********************************************************/ BOOLEAN EmulatorInitialize() @@ -388,38 +337,6 @@ BaseAddress = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, MAX_ADDRESS); if (BaseAddress == NULL) return FALSE; -#ifndef NEW_EMULATOR - /* Initialize the softx86 CPU emulator */ - if (!softx86_init(&EmulatorContext, SX86_CPULEVEL_80286)) - { - HeapFree(GetProcessHeap(), 0, BaseAddress); - return FALSE; - } - - /* Initialize the softx87 FPU emulator*/ - if(!softx87_init(&FpuEmulatorContext, SX87_FPULEVEL_8087)) - { - softx86_free(&EmulatorContext); - HeapFree(GetProcessHeap(), 0, BaseAddress); - return FALSE; - } - - /* Set memory read/write callbacks */ - EmulatorContext.callbacks->on_read_memory = EmulatorReadMemory; - EmulatorContext.callbacks->on_write_memory = EmulatorWriteMemory; - - /* Set MMIO read/write callbacks */ - EmulatorContext.callbacks->on_read_io = EmulatorReadIo; - EmulatorContext.callbacks->on_write_io = EmulatorWriteIo; - - /* Set interrupt callbacks */ - EmulatorContext.callbacks->on_sw_int = EmulatorSoftwareInt; - EmulatorContext.callbacks->on_hw_int = EmulatorHardwareInt; - EmulatorContext.callbacks->on_hw_int_ack = EmulatorHardwareIntAck; - - /* Connect the emulated FPU to the emulated CPU */ - softx87_connect_to_CPU(&EmulatorContext, &FpuEmulatorContext); -#else /* Set the callbacks */ EmulatorContext.MemReadCallback = (FAST486_MEM_READ_PROC)EmulatorReadMemory; EmulatorContext.MemWriteCallback = (FAST486_MEM_WRITE_PROC)EmulatorWriteMemory; @@ -429,7 +346,6 @@ /* Reset the CPU */ Fast486Reset(&EmulatorContext); -#endif /* Enable interrupts */ EmulatorSetFlag(EMULATOR_FLAG_IF); @@ -439,184 +355,83 @@ VOID EmulatorSetStack(WORD Segment, DWORD Offset) { -#ifndef NEW_EMULATOR - /* Call the softx86 API */ - softx86_set_stack_ptr(&EmulatorContext, Segment, Offset); -#else Fast486SetStack(&EmulatorContext, Segment, Offset); -#endif } // FIXME: This function assumes 16-bit mode!!! VOID EmulatorExecute(WORD Segment, WORD Offset) { -#ifndef NEW_EMULATOR - /* Call the softx86 API */ - softx86_set_instruction_ptr(&EmulatorContext, Segment, Offset); -#else /* Tell Fast486 to move the instruction pointer */ Fast486ExecuteAt(&EmulatorContext, Segment, Offset); -#endif } VOID EmulatorInterrupt(BYTE Number) { -#ifndef NEW_EMULATOR - LPDWORD IntVecTable = (LPDWORD)((ULONG_PTR)BaseAddress); - UINT Segment, Offset; - - /* Get the segment and offset */ - Segment = HIWORD(IntVecTable[Number]); - Offset = LOWORD(IntVecTable[Number]); - - /* Call the softx86 API */ - softx86_make_simple_interrupt_call(&EmulatorContext, &Segment, &Offset); -#else /* Call the Fast486 API */ Fast486Interrupt(&EmulatorContext, Number); -#endif } VOID EmulatorExternalInterrupt(BYTE Number) { -#ifndef NEW_EMULATOR - /* Call the softx86 API */ - softx86_ext_hw_signal(&EmulatorContext, Number); -#else /* Call the Fast486 API */ Fast486Interrupt(&EmulatorContext, Number); -#endif } ULONG EmulatorGetRegister(ULONG Register) { -#ifndef NEW_EMULATOR if (Register < EMULATOR_REG_ES) { - return EmulatorContext.state->general_reg[Register].val; + return EmulatorContext.GeneralRegs[Register].Long; } else { - return EmulatorContext.state->segment_reg[Register - EMULATOR_REG_ES].val; - } -#else + return EmulatorContext.SegmentRegs[Register - EMULATOR_REG_ES].Selector; + } +} + +ULONG EmulatorGetProgramCounter(VOID) +{ + return EmulatorContext.InstPtr.Long; +} + +VOID EmulatorSetRegister(ULONG Register, ULONG Value) +{ if (Register < EMULATOR_REG_ES) { - return EmulatorContext.GeneralRegs[Register].Long; + EmulatorContext.GeneralRegs[Register].Long = Value; } else { - return EmulatorContext.SegmentRegs[Register - EMULATOR_REG_ES].Selector; - } -#endif -} - -ULONG EmulatorGetProgramCounter(VOID) -{ -#ifndef NEW_EMULATOR - return EmulatorContext.state->reg_ip; -#else - return EmulatorContext.InstPtr.Long; -#endif -} - -VOID EmulatorSetRegister(ULONG Register, ULONG Value) -{ -#ifndef NEW_EMULATOR - if (Register < EMULATOR_REG_ES) - { - EmulatorContext.state->general_reg[Register].val = Value; - } - else - { - EmulatorContext.state->segment_reg[Register - EMULATOR_REG_ES].val = (USHORT)Value; - } -#else - if (Register < EMULATOR_REG_ES) - { - EmulatorContext.GeneralRegs[Register].Long = Value; - } - else - { Fast486SetSegment(&EmulatorContext, Register - EMULATOR_REG_ES, (USHORT)Value); } -#endif } BOOLEAN EmulatorGetFlag(ULONG Flag) { -#ifndef NEW_EMULATOR - return (EmulatorContext.state->reg_flags.val & Flag) ? TRUE : FALSE; -#else return (EmulatorContext.Flags.Long & Flag) ? TRUE : FALSE; -#endif } VOID EmulatorSetFlag(ULONG Flag) { -#ifndef NEW_EMULATOR - EmulatorContext.state->reg_flags.val |= Flag; -#else EmulatorContext.Flags.Long |= Flag; -#endif } VOID EmulatorClearFlag(ULONG Flag) { -#ifndef NEW_EMULATOR - EmulatorContext.state->reg_flags.val &= ~Flag; -#else EmulatorContext.Flags.Long &= ~Flag; -#endif } VOID EmulatorStep(VOID) { -#ifndef NEW_EMULATOR - LPWORD Instruction; - - /* Print the current position - useful for debugging */ - DPRINT("Executing at CS:IP = %04X:%04X\n", - EmulatorGetRegister(EMULATOR_REG_CS), - EmulatorContext.state->reg_ip); - - Instruction = (LPWORD)((ULONG_PTR)BaseAddress - + TO_LINEAR(EmulatorGetRegister(EMULATOR_REG_CS), - EmulatorContext.state->reg_ip)); - - /* Check for the BIOS operation (BOP) sequence */ - if (Instruction[0] == EMULATOR_BOP) - { - /* Skip the opcodes */ - EmulatorContext.state->reg_ip += 4; - - /* Call the BOP handler */ - EmulatorBop(Instruction[1]); - } - - /* Call the softx86 API */ - if (!softx86_step(&EmulatorContext)) - { - /* Invalid opcode */ - EmulatorInterrupt(EMULATOR_EXCEPTION_INVALID_OPCODE); - } -#else /* Dump the state for debugging purposes */ // Fast486DumpState(&EmulatorContext); /* Execute the next instruction */ Fast486StepInto(&EmulatorContext); -#endif } VOID EmulatorCleanup(VOID) { -#ifndef NEW_EMULATOR - /* Free the softx86 CPU and FPU emulator */ - softx87_free(&FpuEmulatorContext); - softx86_free(&EmulatorContext); -#endif - /* Free the memory allocated for the 16-bit address space */ if (BaseAddress != NULL) HeapFree(GetProcessHeap(), 0, BaseAddress); } 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] Sat Oct 26 20:48:31 2013 @@ -12,13 +12,7 @@ /* INCLUDES *******************************************************************/ #include "ntvdm.h" - -#ifndef NEW_EMULATOR -#include <softx86.h> -#include <softx87.h> -#else #include <fast486.h> -#endif /* DEFINES ********************************************************************/ @@ -86,18 +80,7 @@ EMULATOR_REG_GS }; -#ifndef NEW_EMULATOR - -#define NTVDMCALL __cdecl -extern softx86_ctx EmulatorContext; -extern softx87_ctx FpuEmulatorContext; - -#else - -#define NTVDMCALL __stdcall extern FAST486_STATE EmulatorContext; - -#endif /* FUNCTIONS ******************************************************************/ Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.h URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.h?…
============================================================================== --- branches/ntvdm/subsystems/ntvdm/ntvdm.h [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/ntvdm.h [iso-8859-1] Sat Oct 26 20:48:31 2013 @@ -27,9 +27,6 @@ #define FAR_POINTER(x) ((ULONG_PTR)BaseAddress + TO_LINEAR(HIWORD(x), LOWORD(x))) #define STEPS_PER_CYCLE 256 -// Uncomment the following to use the new Fast486 CPU emulator (EXPERIMENTAL) -#define NEW_EMULATOR - /* FUNCTIONS ******************************************************************/ extern LPVOID BaseAddress; Modified: branches/ntvdm/subsystems/ntvdm/registers.c URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/register…
============================================================================== --- branches/ntvdm/subsystems/ntvdm/registers.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/registers.c [iso-8859-1] Sat Oct 26 20:48:31 2013 @@ -18,176 +18,112 @@ CDECL getEAX(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_AX].val; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_AX].Long; -#endif } VOID CDECL setEAX(ULONG Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_AX].val = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_AX].Long = Value; -#endif } USHORT CDECL getAX(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_AX].w.lo; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_AX].LowWord; -#endif } VOID CDECL setAX(USHORT Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_AX].w.lo = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_AX].LowWord = Value; -#endif } UCHAR CDECL getAH(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_AX].b.hi; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_AX].HighByte; -#endif } VOID CDECL setAH(UCHAR Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_AX].b.hi = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_AX].HighByte = Value; -#endif } UCHAR CDECL getAL(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_AX].b.lo; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_AX].LowByte; -#endif } VOID CDECL setAL(UCHAR Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_AX].b.lo = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_AX].LowByte = Value; -#endif } ULONG CDECL getEBX(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_BX].val; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_BX].Long; -#endif } VOID CDECL setEBX(ULONG Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_BX].val = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_BX].Long = Value; -#endif } USHORT CDECL getBX(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_BX].w.lo; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_BX].LowWord; -#endif } VOID CDECL setBX(USHORT Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_BX].w.lo = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_BX].LowWord = Value; -#endif } UCHAR CDECL getBH(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_BX].b.hi; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_BX].HighByte; -#endif } VOID CDECL setBH(UCHAR Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_BX].b.hi = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_BX].HighByte = Value; -#endif } UCHAR CDECL getBL(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_BX].b.lo; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_BX].LowByte; -#endif } VOID CDECL setBL(UCHAR Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_BX].b.lo = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_BX].LowByte = Value; -#endif } @@ -196,88 +132,56 @@ CDECL getECX(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_CX].val; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_CX].Long; -#endif } VOID CDECL setECX(ULONG Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_CX].val = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_CX].Long = Value; -#endif } USHORT CDECL getCX(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_CX].w.lo; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_CX].LowWord; -#endif } VOID CDECL setCX(USHORT Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_CX].w.lo = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_CX].LowWord = Value; -#endif } UCHAR CDECL getCH(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_CX].b.hi; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_CX].HighByte; -#endif } VOID CDECL setCH(UCHAR Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_CX].b.hi = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_CX].HighByte = Value; -#endif } UCHAR CDECL getCL(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_CX].b.lo; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_CX].LowByte; -#endif } VOID CDECL setCL(UCHAR Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_CX].b.lo = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_CX].LowByte = Value; -#endif } @@ -286,88 +190,56 @@ CDECL getEDX(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_DX].val; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_DX].Long; -#endif } VOID CDECL setEDX(ULONG Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_DX].val = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_DX].Long = Value; -#endif } USHORT CDECL getDX(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_DX].w.lo; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_DX].LowWord; -#endif } VOID CDECL setDX(USHORT Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_DX].w.lo = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_DX].LowWord = Value; -#endif } UCHAR CDECL getDH(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_DX].b.hi; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_DX].HighByte; -#endif } VOID CDECL setDH(UCHAR Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_DX].b.hi = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_DX].HighByte = Value; -#endif } UCHAR CDECL getDL(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_DX].b.lo; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_DX].LowByte; -#endif } VOID CDECL setDL(UCHAR Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_DX].b.lo = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_DX].LowByte = Value; -#endif } @@ -406,44 +278,28 @@ CDECL getEBP(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_BP].val; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_BP].Long; -#endif } VOID CDECL setEBP(ULONG Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_BP].val = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_BP].Long = Value; -#endif } USHORT CDECL getBP(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_BP].w.lo; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_BP].LowWord; -#endif } VOID CDECL setBP(USHORT Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_BP].w.lo = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_BP].LowWord = Value; -#endif } @@ -452,44 +308,28 @@ CDECL getESI(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_SI].val; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_SI].Long; -#endif } VOID CDECL setESI(ULONG Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_SI].val = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_SI].Long = Value; -#endif } USHORT CDECL getSI(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_SI].w.lo; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_SI].LowWord; -#endif } VOID CDECL setSI(USHORT Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_SI].w.lo = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_SI].LowWord = Value; -#endif } @@ -498,44 +338,28 @@ CDECL getEDI(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_DI].val; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_DI].Long; -#endif } VOID CDECL setEDI(ULONG Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_DI].val = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_DI].Long = Value; -#endif } USHORT CDECL getDI(VOID) { -#ifndef NEW_EMULATOR - return EmulatorContext.state->general_reg[EMULATOR_REG_DI].w.lo; -#else return EmulatorContext.GeneralRegs[EMULATOR_REG_DI].LowWord; -#endif } VOID CDECL setDI(USHORT Value) { -#ifndef NEW_EMULATOR - EmulatorContext.state->general_reg[EMULATOR_REG_DI].w.lo = Value; -#else EmulatorContext.GeneralRegs[EMULATOR_REG_DI].LowWord = Value; -#endif }
11 years, 1 month
1
0
0
0
[tfaber] 60754: [SAMSRV] - Fix incorrect heap buffer size, CID 716678.
by tfaber@svn.reactos.org
Author: tfaber Date: Sat Oct 26 18:48:53 2013 New Revision: 60754 URL:
http://svn.reactos.org/svn/reactos?rev=60754&view=rev
Log: [SAMSRV] - Fix incorrect heap buffer size, CID 716678. Modified: trunk/reactos/dll/win32/samsrv/samrpc.c Modified: trunk/reactos/dll/win32/samsrv/samrpc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/samsrv/samrpc.c?…
============================================================================== --- trunk/reactos/dll/win32/samsrv/samrpc.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/samsrv/samrpc.c [iso-8859-1] Sat Oct 26 18:48:53 2013 @@ -3586,7 +3586,7 @@ } /* Allocate the names array */ - Names->Element = midl_user_allocate(Count * sizeof(ULONG)); + Names->Element = midl_user_allocate(Count * sizeof(*Names->Element)); if (Names->Element == NULL) { Status = STATUS_INSUFFICIENT_RESOURCES; @@ -3594,7 +3594,7 @@ } /* Allocate the use array */ - Use->Element = midl_user_allocate(Count * sizeof(ULONG)); + Use->Element = midl_user_allocate(Count * sizeof(*Use->Element)); if (Use->Element == NULL) { Status = STATUS_INSUFFICIENT_RESOURCES;
11 years, 1 month
1
0
0
0
[aandrejevic] 60753: [NTVDM] Fix the "Read Buffered Input" command and implement "Get STDIN Status".
by aandrejevic@svn.reactos.org
Author: aandrejevic Date: Sat Oct 26 18:01:40 2013 New Revision: 60753 URL:
http://svn.reactos.org/svn/reactos?rev=60753&view=rev
Log: [NTVDM] Fix the "Read Buffered Input" command and implement "Get STDIN Status". Modified: branches/ntvdm/subsystems/ntvdm/dos.c 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] Sat Oct 26 18:01:40 2013 @@ -1284,6 +1284,26 @@ return Character; } +BOOLEAN DosCheckInput(VOID) +{ + HANDLE Handle = DosGetRealHandle(DOS_INPUT_HANDLE); + + if (IsConsoleHandle(Handle)) + { + /* Call the BIOS */ + return (BiosPeekCharacter() != 0xFFFF); + } + else + { + DWORD FileSizeHigh; + DWORD FileSize = GetFileSize(Handle, &FileSizeHigh); + LONG LocationHigh = 0; + DWORD Location = SetFilePointer(Handle, 0, &LocationHigh, FILE_CURRENT); + + return ((Location != FileSize) || (LocationHigh != FileSizeHigh)); + } +} + VOID DosPrintCharacter(CHAR Character) { WORD BytesWritten; @@ -1349,7 +1369,6 @@ VOID DosInt21h(LPWORD Stack) { - INT i; CHAR Character; SYSTEMTIME SystemTime; PCHAR String; @@ -1424,21 +1443,39 @@ /* Read Buffered Input */ case 0x0A: { - DPRINT1("FIXME: This function is still not adapted to the new system!\n"); - InputBuffer = (PDOS_INPUT_BUFFER)((ULONG_PTR)BaseAddress + TO_LINEAR(DataSegment, LOWORD(Edx))); - InputBuffer->Length = 0; - for (i = 0; i < InputBuffer->MaxLength; i ++) - { + while (Stack[STACK_COUNTER] < InputBuffer->MaxLength) + { + /* Try to read a character */ Character = DosReadCharacter(); + + /* If it's not ready yet, let the BOP repeat */ + if (EmulatorGetFlag(EMULATOR_FLAG_CF)) break; + + /* Echo the character and append it to the buffer */ DosPrintCharacter(Character); - InputBuffer->Buffer[InputBuffer->Length] = Character; + InputBuffer->Buffer[Stack[STACK_COUNTER]] = Character; + if (Character == '\r') break; - InputBuffer->Length++; - } + Stack[STACK_COUNTER]++; + } + + /* Update the length */ + InputBuffer->Length = Stack[STACK_COUNTER]; + + break; + } + + /* Get STDIN Status */ + case 0x0B: + { + if (DosCheckInput()) Eax |= 0xFF; + else Eax &= 0xFFFFFF00; + + EmulatorSetRegister(EMULATOR_REG_AX, Eax); break; }
11 years, 1 month
1
0
0
0
[aandrejevic] 60752: [FAST486] Implement the CLTS instruction.
by aandrejevic@svn.reactos.org
Author: aandrejevic Date: Sat Oct 26 17:33:10 2013 New Revision: 60752 URL:
http://svn.reactos.org/svn/reactos?rev=60752&view=rev
Log: [FAST486] Implement the CLTS instruction. Modified: branches/ntvdm/lib/fast486/extraops.c branches/ntvdm/lib/fast486/extraops.h Modified: branches/ntvdm/lib/fast486/extraops.c URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/extraops.c?re…
============================================================================== --- branches/ntvdm/lib/fast486/extraops.c [iso-8859-1] (original) +++ branches/ntvdm/lib/fast486/extraops.c [iso-8859-1] Sat Oct 26 17:33:10 2013 @@ -45,7 +45,7 @@ NULL, // TODO: OPCODE 0x03 NOT IMPLEMENTED NULL, // TODO: OPCODE 0x04 NOT IMPLEMENTED NULL, // TODO: OPCODE 0x05 NOT IMPLEMENTED - NULL, // TODO: OPCODE 0x06 NOT IMPLEMENTED + Fast486ExtOpcodeClts, NULL, // TODO: OPCODE 0x07 NOT IMPLEMENTED NULL, // TODO: OPCODE 0x08 NOT IMPLEMENTED NULL, // TODO: OPCODE 0x09 NOT IMPLEMENTED @@ -299,6 +299,23 @@ /* PUBLIC FUNCTIONS ***********************************************************/ +FAST486_OPCODE_HANDLER(Fast486ExtOpcodeClts) +{ + NO_LOCK_PREFIX(); + + /* The current privilege level must be zero */ + if (Fast486GetCurrentPrivLevel(State) != 0) + { + Fast486Exception(State, FAST486_EXCEPTION_GP); + return FALSE; + } + + /* Clear the task switch bit */ + State->ControlRegisters[FAST486_REG_CR0] &= ~FAST486_CR0_TS; + + return TRUE; +} + FAST486_OPCODE_HANDLER(Fast486ExtOpcodeStoreControlReg) { BOOLEAN AddressSize = State->SegmentRegs[FAST486_REG_CS].Size; Modified: branches/ntvdm/lib/fast486/extraops.h URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/extraops.h?re…
============================================================================== --- branches/ntvdm/lib/fast486/extraops.h [iso-8859-1] (original) +++ branches/ntvdm/lib/fast486/extraops.h [iso-8859-1] Sat Oct 26 17:33:10 2013 @@ -23,6 +23,7 @@ #define _EXTRAOPS_H_ /* DEFINES ********************************************************************/ +FAST486_OPCODE_HANDLER(Fast486ExtOpcodeClts); FAST486_OPCODE_HANDLER(Fast486ExtOpcodeStoreControlReg); FAST486_OPCODE_HANDLER(Fast486ExtOpcodeStoreDebugReg); FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLoadControlReg);
11 years, 1 month
1
0
0
0
← Newer
1
2
3
4
5
6
7
8
9
...
33
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Results per page:
10
25
50
100
200