Implement and export (and define in vddsvc.h) call_ica_hw_interrupt and VDDSimulateInterrupt macro.
ICA = Interrupt Controller Adapter (in windows terminology)

svn path=/branches/ntvdm/; revision=61372
This commit is contained in:
Hermès Bélusca-Maïto 2013-12-24 15:30:59 +00:00
parent 81c28dca92
commit 4f99547f7d
5 changed files with 59 additions and 5 deletions

View file

@ -26,6 +26,22 @@
#include <nt_vdd.h> #include <nt_vdd.h>
#endif #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 * Registers manipulation
*/ */

View file

@ -24,7 +24,7 @@
#include <winreg.h> #include <winreg.h>
#include <winuser.h> #include <winuser.h>
#include <nt_vdd.h> #include <vddsvc.h>
#include <debug.h> #include <debug.h>

View file

@ -175,8 +175,6 @@
@ stdcall MGetVdmPointer(long long long) @ stdcall MGetVdmPointer(long long long)
@ stdcall Sim32pGetVDMPointer(long long) @ stdcall Sim32pGetVDMPointer(long long)
@ -184,5 +182,6 @@
@ stdcall VdmMapFlat(long long long) @ stdcall VdmMapFlat(long long long)
;@ stdcall VdmUnmapFlat(long long ptr long) ; Not exported on x86 ;@ 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 VDDInstallIOHook(long long ptr ptr)
@ stdcall VDDDeInstallIOHook(long long ptr) @ stdcall VDDDeInstallIOHook(long long ptr)

View file

@ -3,6 +3,7 @@
* PROJECT: ReactOS Virtual DOS Machine * PROJECT: ReactOS Virtual DOS Machine
* FILE: pic.c * FILE: pic.c
* PURPOSE: Programmable Interrupt Controller emulation * PURPOSE: Programmable Interrupt Controller emulation
* (Interrupt Controller Adapter (ICA) in Windows terminology)
* PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org> * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
*/ */
@ -200,7 +201,7 @@ VOID PicInterruptRequest(BYTE Number)
if (Number >= 0 && Number < 8) if (Number >= 0 && Number < 8)
{ {
/* Check if any of the higher-priority interrupts are busy */ /* 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; if (MasterPic.InServiceRegister & (1 << Number)) return;
} }
@ -301,4 +302,41 @@ BOOLEAN PicInitialize(VOID)
return TRUE; 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 */ /* EOF */

View file

@ -2,7 +2,8 @@
* COPYRIGHT: GPL - See COPYING in the top level directory * COPYRIGHT: GPL - See COPYING in the top level directory
* PROJECT: ReactOS Virtual DOS Machine * PROJECT: ReactOS Virtual DOS Machine
* FILE: pic.h * 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> * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
*/ */