mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 12:45:16 +00:00
[NTVDM]
Since the BIOS registers the whole range of possible interrupts, we register their stubs in an array-form so that the BIOS always registers INT n at the same place. We save 561 bytes of memory. svn path=/trunk/; revision=63366
This commit is contained in:
parent
65a58c440e
commit
de36490031
|
@ -301,18 +301,14 @@ static VOID BiosHwSetup(VOID)
|
|||
static VOID InitializeBiosInt32(VOID)
|
||||
{
|
||||
USHORT i;
|
||||
// USHORT Offset = 0;
|
||||
|
||||
/* Initialize the callback context */
|
||||
InitializeContext(&BiosContext, BIOS_SEGMENT, 0x0000);
|
||||
|
||||
/* Register the BIOS 32-bit Interrupts */
|
||||
/* Register the default BIOS 32-bit Interrupts */
|
||||
for (i = 0x00; i <= 0xFF; i++)
|
||||
{
|
||||
// Offset += RegisterInt32(MAKELONG(Offset, BIOS_SEGMENT), i, NULL, NULL);
|
||||
BiosContext.NextOffset += RegisterInt32(MAKELONG(BiosContext.NextOffset,
|
||||
BiosContext.Segment),
|
||||
i, NULL, NULL);
|
||||
RegisterBiosInt32(i, NULL);
|
||||
}
|
||||
|
||||
/* Initialize the exception vector interrupts to a default Exception handler */
|
||||
|
|
|
@ -30,11 +30,12 @@
|
|||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
extern CALLBACK16 BiosContext;
|
||||
#define RegisterBiosInt32(IntNumber, IntHandler) \
|
||||
#define RegisterBiosInt32(IntNumber, IntHandler) \
|
||||
do { \
|
||||
BiosContext.NextOffset += RegisterInt32(MAKELONG(BiosContext.NextOffset, \
|
||||
BiosContext.Segment), \
|
||||
(IntNumber), (IntHandler), NULL); \
|
||||
RegisterInt32(BiosContext.TrampolineFarPtr + \
|
||||
BiosContext.TrampolineSize + \
|
||||
(IntNumber) * Int16To32StubSize, \
|
||||
(IntNumber), (IntHandler), NULL); \
|
||||
} while(0);
|
||||
|
||||
VOID EnableHwIRQ(UCHAR hwirq, EMULATOR_INT32_PROC func);
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
/*
|
||||
* This is the list of registered BOP handlers.
|
||||
*/
|
||||
EMULATOR_BOP_PROC BopProc[EMULATOR_MAX_BOP_NUM] = { NULL };
|
||||
static EMULATOR_BOP_PROC BopProc[EMULATOR_MAX_BOP_NUM] = { NULL };
|
||||
|
||||
/* PUBLIC FUNCTIONS ***********************************************************/
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
/*
|
||||
* This is the list of registered 32-bit Interrupt handlers.
|
||||
*/
|
||||
EMULATOR_INT32_PROC Int32Proc[EMULATOR_MAX_INT32_NUM] = { NULL };
|
||||
static EMULATOR_INT32_PROC Int32Proc[EMULATOR_MAX_INT32_NUM] = { NULL };
|
||||
|
||||
/* BOP Identifiers */
|
||||
#define BOP_CONTROL 0xFF // Control BOP Handler
|
||||
|
@ -50,7 +50,7 @@ do { \
|
|||
//
|
||||
|
||||
/* 16-bit generic interrupt code for calling a 32-bit interrupt handler */
|
||||
BYTE Int16To32[] =
|
||||
static BYTE Int16To32[] =
|
||||
{
|
||||
0xFA, // cli
|
||||
|
||||
|
@ -76,6 +76,7 @@ BYTE Int16To32[] =
|
|||
0x44, 0x44, // inc sp, inc sp
|
||||
0xCF, // iret
|
||||
};
|
||||
const ULONG Int16To32StubSize = sizeof(Int16To32);
|
||||
|
||||
/* PUBLIC FUNCTIONS ***********************************************************/
|
||||
|
||||
|
@ -85,9 +86,10 @@ InitializeContext(IN PCALLBACK16 Context,
|
|||
IN USHORT Offset)
|
||||
{
|
||||
Context->TrampolineFarPtr = MAKELONG(Offset, Segment);
|
||||
Context->TrampolineSize = max(CALL16_TRAMPOLINE_SIZE,
|
||||
INT16_TRAMPOLINE_SIZE);
|
||||
Context->Segment = Segment;
|
||||
Context->NextOffset = Offset + max(CALL16_TRAMPOLINE_SIZE,
|
||||
INT16_TRAMPOLINE_SIZE);
|
||||
Context->NextOffset = Offset + Context->TrampolineSize;
|
||||
}
|
||||
|
||||
VOID
|
||||
|
|
|
@ -15,17 +15,15 @@
|
|||
/* 32-bit Interrupt Identifiers */
|
||||
#define EMULATOR_MAX_INT32_NUM 0xFF + 1
|
||||
|
||||
#define INT_HANDLER_OFFSET 0x1000
|
||||
#define COMMON_STUB_OFFSET 0x2000
|
||||
|
||||
|
||||
typedef struct _CALLBACK16
|
||||
{
|
||||
ULONG TrampolineFarPtr; // Where the trampoline zone is placed
|
||||
ULONG TrampolineSize; // Size of the trampoline zone
|
||||
USHORT Segment;
|
||||
USHORT NextOffset;
|
||||
} CALLBACK16, *PCALLBACK16;
|
||||
|
||||
extern const ULONG Int16To32StubSize;
|
||||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
|
|
Loading…
Reference in a new issue