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...

svn path=/branches/ntvdm/; revision=60917
This commit is contained in:
Hermès Bélusca-Maïto 2013-11-10 16:22:33 +00:00
parent bf2731fb9f
commit e4946e8b85

View file

@ -128,25 +128,16 @@ VOID WINAPI Int32Dispatch(LPWORD Stack)
VOID WINAPI InitializeInt32(WORD BiosSegment)
{
USHORT i;
WORD Offset = 0;
LPDWORD IntVecTable = (LPDWORD)BaseAddress;
LPBYTE BiosCode = (LPBYTE)SEG_OFF_TO_PTR(BiosSegment, 0);
LPBYTE BiosCode = (LPBYTE)SEG_OFF_TO_PTR(BiosSegment, 0);
/* Generate ISR stubs and fill the IVT */
for (i = 0x00; i <= 0xFF; i++)
USHORT i;
WORD CommonStub, BopSeqOffset, Offset;
CommonStub = Offset = 0x00;
/* 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 @@ VOID WINAPI InitializeInt32(WORD BiosSegment)
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)