/* Set exception handler in IDT table by ExceptionNum. */
VOID SetExceptionHandlerInIdtEntry(IN UINTN ExceptionNum, IN VOID *ExceptionHandler)
/* Set exception handler in IDT table by ExceptionNum. */
VOID SetExceptionHandlerInIdtEntry(IN UINTN ExceptionNum, IN VOID *ExceptionHandler)
{
  IA32_IDT_GATE_DESCRIPTOR  *IdtEntry;
  IA32_DESCRIPTOR           IdtDescriptor;
  AsmReadIdtr (&IdtDescriptor);
  IdtEntry = (IA32_IDT_GATE_DESCRIPTOR *)IdtDescriptor.Base;
  IdtEntry[ExceptionNum].Bits.OffsetLow  = (UINT16)(UINTN)ExceptionHandler;
  IdtEntry[ExceptionNum].Bits.OffsetHigh = (UINT16)((UINTN)ExceptionHandler >> 16);
}