Author: hbelusca
Date: Tue Jul 7 00:11:18 2015
New Revision: 68362
URL:
http://svn.reactos.org/svn/reactos?rev=68362&view=rev
Log:
[NTVDM]
- Let the mouse driver use its own 32-to-16 call scratch buffer.
- Simplify some code.
Modified:
trunk/reactos/subsystems/mvdm/ntvdm/cpu/callback.c
trunk/reactos/subsystems/mvdm/ntvdm/cpu/callback.h
trunk/reactos/subsystems/mvdm/ntvdm/dos/mouse32.c
Modified: trunk/reactos/subsystems/mvdm/ntvdm/cpu/callback.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/cpu/…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/cpu/callback.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/cpu/callback.c [iso-8859-1] Tue Jul 7 00:11:18
2015
@@ -28,8 +28,6 @@
#include <isvbop.h>
/* PRIVATE VARIABLES **********************************************************/
-
-#define TRAMPOLINE_SIZE sizeof(ULONGLONG)
static BYTE Yield[] =
{
Modified: trunk/reactos/subsystems/mvdm/ntvdm/cpu/callback.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/cpu/…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/cpu/callback.h [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/cpu/callback.h [iso-8859-1] Tue Jul 7 00:11:18
2015
@@ -20,6 +20,8 @@
*(trap) = BOP_UNSIMULATE; \
} while(0)
// #define UnSimulate16 MAKELONG(EMULATOR_BOP, BOP_UNSIMULATE) //
BOP(BOP_UNSIMULATE)
+
+#define TRAMPOLINE_SIZE sizeof(ULONGLONG)
typedef struct _CALLBACK16
{
Modified: trunk/reactos/subsystems/mvdm/ntvdm/dos/mouse32.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/mvdm/ntvdm/dos/…
==============================================================================
--- trunk/reactos/subsystems/mvdm/ntvdm/dos/mouse32.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/mvdm/ntvdm/dos/mouse32.c [iso-8859-1] Tue Jul 7 00:11:18
2015
@@ -26,7 +26,6 @@
#include "memory.h"
#include "io.h"
-#include "dos32krnl/dos.h"
#include "dos32krnl/memory.h"
/* PRIVATE VARIABLES **********************************************************/
@@ -39,6 +38,7 @@
{
CHAR Copyright[sizeof(MouseCopyright)];
WORD Version;
+ BYTE MouseContextScratch[TRAMPOLINE_SIZE];
BYTE MouseDosInt16Stub[Int16To32StubSize];
BYTE MouseIrqInt16Stub[Int16To32StubSize];
} MOUSE_DRIVER, *PMOUSE_DRIVER;
@@ -46,8 +46,9 @@
#pragma pack(pop)
/* Global data contained in guest memory */
-WORD MouseDataSegment;
-PMOUSE_DRIVER MouseData;
+static WORD MouseDataSegment;
+static PMOUSE_DRIVER MouseData;
+static CALLBACK16 MouseContext;
#define MICKEYS_PER_CELL_HORIZ 8
#define MICKEYS_PER_CELL_VERT 16
@@ -198,7 +199,7 @@
CallMask);
/* Call the callback */
- RunCallback16(&DosContext, DriverState.Handler0.Callback);
+ RunCallback16(&MouseContext, DriverState.Handler0.Callback);
setAX(AX);
setBX(BX);
@@ -241,7 +242,7 @@
CallMask);
/* Call the callback */
- RunCallback16(&DosContext, DriverState.Handlers[i].Callback);
+ RunCallback16(&MouseContext, DriverState.Handlers[i].Callback);
setAX(AX);
setBX(BX);
@@ -915,28 +916,26 @@
VOID DosMouseEnable(VOID)
{
- if (!DriverEnabled)
- {
- DriverEnabled = TRUE;
-
- /* Get the old IRQ handler */
- OldIrqHandler = ((PDWORD)BaseAddress)[MOUSE_IRQ_INT];
-
- /* Set the IRQ handler */
- RegisterInt32(MAKELONG(FIELD_OFFSET(MOUSE_DRIVER, MouseIrqInt16Stub),
MouseDataSegment),
- MOUSE_IRQ_INT, DosMouseIrq, NULL);
- }
+ if (DriverEnabled) return;
+
+ DriverEnabled = TRUE;
+
+ /* Get the old IRQ handler */
+ OldIrqHandler = ((PDWORD)BaseAddress)[MOUSE_IRQ_INT];
+
+ /* Set the IRQ handler */
+ RegisterInt32(MAKELONG(FIELD_OFFSET(MOUSE_DRIVER, MouseIrqInt16Stub),
MouseDataSegment),
+ MOUSE_IRQ_INT, DosMouseIrq, NULL);
}
VOID DosMouseDisable(VOID)
{
- if (DriverEnabled)
- {
- /* Restore the old IRQ handler */
- ((PDWORD)BaseAddress)[MOUSE_IRQ_INT] = OldIrqHandler;
-
- DriverEnabled = FALSE;
- }
+ if (!DriverEnabled) return;
+
+ /* Restore the old IRQ handler */
+ ((PDWORD)BaseAddress)[MOUSE_IRQ_INT] = OldIrqHandler;
+
+ DriverEnabled = FALSE;
}
VOID DosMouseUpdatePosition(PCOORD NewPosition)
@@ -1001,6 +1000,9 @@
if (MouseDataSegment == 0) return FALSE;
MouseData = (PMOUSE_DRIVER)SEG_OFF_TO_PTR(MouseDataSegment, 0x0000);
+ /* Initialize the callback context */
+ InitializeContext(&MouseContext, MouseDataSegment, FIELD_OFFSET(MOUSE_DRIVER,
MouseContextScratch));
+
/* Clear the state */
RtlZeroMemory(&DriverState, sizeof(DriverState));