Author: hbelusca Date: Sun Nov 10 16:22:33 2013 New Revision: 60917
URL: http://svn.reactos.org/svn/reactos?rev=60917&view=rev Log: [NTVDM] Instead of reassembling each time the very same common stub code for each interrupt, do it once, and then assemble just a little part for each interrupt and jump to the common stub. Now the 4DOS Ctrl-C exception bug changes, but I have an idea what's happening in there...
Modified: branches/ntvdm/subsystems/ntvdm/int32.c
Modified: branches/ntvdm/subsystems/ntvdm/int32.c URL: http://svn.reactos.org/svn/reactos/branches/ntvdm/subsystems/ntvdm/int32.c?r... ============================================================================== --- branches/ntvdm/subsystems/ntvdm/int32.c [iso-8859-1] (original) +++ branches/ntvdm/subsystems/ntvdm/int32.c [iso-8859-1] Sun Nov 10 16:22:33 2013 @@ -128,25 +128,16 @@
VOID WINAPI InitializeInt32(WORD BiosSegment) { + LPDWORD IntVecTable = (LPDWORD)BaseAddress; + LPBYTE BiosCode = (LPBYTE)SEG_OFF_TO_PTR(BiosSegment, 0); + USHORT i; - WORD Offset = 0; + WORD CommonStub, BopSeqOffset, Offset;
- LPDWORD IntVecTable = (LPDWORD)BaseAddress; - LPBYTE BiosCode = (LPBYTE)SEG_OFF_TO_PTR(BiosSegment, 0); + CommonStub = Offset = 0x00;
- /* Generate ISR stubs and fill the IVT */ - for (i = 0x00; i <= 0xFF; i++) + /* Write the common stub code */ { - IntVecTable[i] = MAKELONG(Offset, BiosSegment); - - BiosCode[Offset++] = 0xFA; // cli - - BiosCode[Offset++] = 0x6A; // push i - BiosCode[Offset++] = (UCHAR)i; - - BiosCode[Offset++] = 0x6A; // push 0 - BiosCode[Offset++] = 0x00; - // BOP_SEQ: BiosCode[Offset++] = 0xF8; // clc
@@ -173,6 +164,27 @@
BiosCode[Offset++] = 0xCF; // iret } + + /* Generate ISR stubs and fill the IVT */ + for (i = 0x00; i <= 0xFF; i++) + { + IntVecTable[i] = MAKELONG(Offset, BiosSegment); + + BiosCode[Offset++] = 0xFA; // cli + + BiosCode[Offset++] = 0x6A; // push i + BiosCode[Offset++] = (UCHAR)i; + + BiosCode[Offset++] = 0x6A; // push 0 + BiosCode[Offset++] = 0x00; + + BopSeqOffset = CommonStub - Offset - 3; + + BiosCode[Offset+0] = 0xE9; // jmp near BOP_SEQ + BiosCode[Offset+1] = LOBYTE(BopSeqOffset); + BiosCode[Offset+2] = HIBYTE(BopSeqOffset); + Offset+=3; + } }
VOID WINAPI RegisterInt32(BYTE IntNumber, EMULATOR_INT32_PROC IntHandler)