From c425bbc689651b9f6e3212756894960657df2df8 Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Sat, 12 Oct 2013 13:58:34 +0000 Subject: [PATCH] [SOFT386] Implement Soft386Interrupt. [NTVDM] Implement EmulatorInterrupt and EmulatorExternalInterrupt for NEW_EMULATOR. svn path=/branches/ntvdm/; revision=60628 --- include/reactos/libs/soft386/soft386.h | 2 +- lib/soft386/soft386.c | 23 ++++++++++++++++++++--- subsystems/ntvdm/emulator.c | 10 ++++++---- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/include/reactos/libs/soft386/soft386.h b/include/reactos/libs/soft386/soft386.h index 96c9d467eed..d8ced70a1bf 100644 --- a/include/reactos/libs/soft386/soft386.h +++ b/include/reactos/libs/soft386/soft386.h @@ -359,7 +359,7 @@ Soft386Reset(PSOFT386_STATE State); VOID NTAPI -Soft386Interrupt(PSOFT386_STATE State, UCHAR Number); +Soft386Interrupt(PSOFT386_STATE State, UCHAR Number, BOOLEAN Hardware); VOID NTAPI diff --git a/lib/soft386/soft386.c b/lib/soft386/soft386.c index 02d91b0dc56..060ac2cea5d 100644 --- a/lib/soft386/soft386.c +++ b/lib/soft386/soft386.c @@ -273,10 +273,27 @@ Soft386Reset(PSOFT386_STATE State) VOID NTAPI -Soft386Interrupt(PSOFT386_STATE State, UCHAR Number) +Soft386Interrupt(PSOFT386_STATE State, UCHAR Number, BOOLEAN Hardware) { - // TODO: NOT IMPLEMENTED!!! - UNIMPLEMENTED; + SOFT386_IDT_ENTRY IdtEntry; + + if (Hardware) + { + /* Set the hardware interrupt flag */ + State->HardwareInt = TRUE; + } + + if (!Soft386GetIntVector(State, Number, &IdtEntry)) + { + /* An exception occurred, let the handler execute */ + return; + } + + /* Perform the interrupt */ + Soft386InterruptInternal(State, + IdtEntry.Selector, + MAKELONG(IdtEntry.Offset, IdtEntry.OffsetHigh), + IdtEntry.Type); } VOID diff --git a/subsystems/ntvdm/emulator.c b/subsystems/ntvdm/emulator.c index e3b80276591..a9814e15038 100644 --- a/subsystems/ntvdm/emulator.c +++ b/subsystems/ntvdm/emulator.c @@ -461,6 +461,7 @@ VOID EmulatorExecute(WORD Segment, WORD Offset) VOID EmulatorInterrupt(BYTE Number) { +#ifndef NEW_EMULATOR LPDWORD IntVecTable = (LPDWORD)((ULONG_PTR)BaseAddress); UINT Segment, Offset; @@ -468,13 +469,11 @@ VOID EmulatorInterrupt(BYTE Number) Segment = HIWORD(IntVecTable[Number]); Offset = LOWORD(IntVecTable[Number]); -#ifndef NEW_EMULATOR /* Call the softx86 API */ softx86_make_simple_interrupt_call(&EmulatorContext, &Segment, &Offset); #else - UNREFERENCED_PARAMETER(Segment); - UNREFERENCED_PARAMETER(Offset); - // TODO: NOT IMPLEMENTED + /* Call the Soft386 API */ + Soft386Interrupt(&EmulatorContext, Number, FALSE); #endif } @@ -483,6 +482,9 @@ VOID EmulatorExternalInterrupt(BYTE Number) #ifndef NEW_EMULATOR /* Call the softx86 API */ softx86_ext_hw_signal(&EmulatorContext, Number); +#else + /* Call the Soft386 API */ + Soft386Interrupt(&EmulatorContext, Number, TRUE); #endif }