Author: hbelusca Date: Tue Dec 24 15:30:59 2013 New Revision: 61372
URL: http://svn.reactos.org/svn/reactos?rev=61372&view=rev Log: [NTVDM] Implement and export (and define in vddsvc.h) call_ica_hw_interrupt and VDDSimulateInterrupt macro. ICA = Interrupt Controller Adapter (in windows terminology)
Modified: branches/ntvdm/include/ddk/vddsvc.h branches/ntvdm/subsystems/ntvdm/ntvdm.h branches/ntvdm/subsystems/ntvdm/ntvdm.spec branches/ntvdm/subsystems/ntvdm/pic.c branches/ntvdm/subsystems/ntvdm/pic.h
Modified: branches/ntvdm/include/ddk/vddsvc.h URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/include/ddk/vddsvc.h?rev=6... ============================================================================== --- branches/ntvdm/include/ddk/vddsvc.h [iso-8859-1] (original) +++ branches/ntvdm/include/ddk/vddsvc.h [iso-8859-1] Tue Dec 24 15:30:59 2013 @@ -25,6 +25,22 @@ #ifndef _NT_VDD #include <nt_vdd.h> #endif + +/* + * Interrupts services + */ +#define ICA_MASTER 0 +#define ICA_SLAVE 1 + +VOID +WINAPI +call_ica_hw_interrupt(INT ms, + BYTE line, + INT count); + +#define VDDSimulateInterrupt(ms, line, count) \ + call_ica_hw_interrupt((ms), (line), (count)) // Windows specifies a count of 1 ... +
/* * Registers manipulation
Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.h URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.h?r... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/ntvdm.h [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/ntvdm.h [iso-8859-1] Tue Dec 24 15:30:59 2013 @@ -24,7 +24,7 @@ #include <winreg.h> #include <winuser.h>
-#include <nt_vdd.h> +#include <vddsvc.h>
#include <debug.h>
Modified: branches/ntvdm/subsystems/ntvdm/ntvdm.spec URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/ntvdm.spe... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/ntvdm.spec [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/ntvdm.spec [iso-8859-1] Tue Dec 24 15:30:59 2013 @@ -175,8 +175,6 @@
- - @ stdcall MGetVdmPointer(long long long) @ stdcall Sim32pGetVDMPointer(long long)
@@ -184,5 +182,6 @@ @ stdcall VdmMapFlat(long long long) ;@ stdcall VdmUnmapFlat(long long ptr long) ; Not exported on x86
+@ stdcall call_ica_hw_interrupt(long long long) @ stdcall VDDInstallIOHook(long long ptr ptr) @ stdcall VDDDeInstallIOHook(long long ptr)
Modified: branches/ntvdm/subsystems/ntvdm/pic.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/pic.c?rev... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/pic.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/pic.c [iso-8859-1] Tue Dec 24 15:30:59 2013 @@ -3,6 +3,7 @@ * PROJECT: ReactOS Virtual DOS Machine * FILE: pic.c * PURPOSE: Programmable Interrupt Controller emulation + * (Interrupt Controller Adapter (ICA) in Windows terminology) * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org> */
@@ -200,7 +201,7 @@ if (Number >= 0 && Number < 8) { /* Check if any of the higher-priority interrupts are busy */ - for (i = 0; i <= Number ; i++) + for (i = 0; i <= Number; i++) { if (MasterPic.InServiceRegister & (1 << Number)) return; } @@ -301,4 +302,41 @@ return TRUE; }
+ + +VOID +WINAPI +call_ica_hw_interrupt(INT ms, + BYTE line, + INT count) +{ + BYTE InterruptNumber = line; + + /* Check for PIC validity */ + if (ms != ICA_MASTER || ms != ICA_SLAVE) return; + + /* + * Adjust the interrupt request number according to the parameters, + * by adding an offset == 8 to the interrupt number. + * + * Indeed VDDs calling this function usually subtracts 8 so that they give: + * + * ms | line | corresponding interrupt number + * ------------+--------+-------------------------------- + * ICA_MASTER | 0 -- 7 | 0 -- 7 + * ICA_SLAVE | 0 -- 7 | 8 -- 15 + * + * and PicInterruptRequest subtracts again 8 to the interrupt number + * if it is greater or equal than 8 (so that it determines which PIC + * to use via the interrupt number). + */ + if (ms == ICA_SLAVE) InterruptNumber += 8; + + /* Send the specified number of interrupt requests */ + while (count-- > 0) + { + PicInterruptRequest(InterruptNumber); + } +} + /* EOF */
Modified: branches/ntvdm/subsystems/ntvdm/pic.h URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/pic.h?rev... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/pic.h [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/pic.h [iso-8859-1] Tue Dec 24 15:30:59 2013 @@ -2,7 +2,8 @@ * COPYRIGHT: GPL - See COPYING in the top level directory * PROJECT: ReactOS Virtual DOS Machine * FILE: pic.h - * PURPOSE: Programmable Interrupt Controller emulation (header file) + * PURPOSE: Programmable Interrupt Controller emulation + * (Interrupt Controller Adapter (ICA) in Windows terminology) * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org> */