I’m still working on porting the CpuExceptionHandlerLib to clang, but I hit 
some code I don’t understand? I have mods in the assembly code but…..

I’m running in QEMU and I’m taking the 1st timer tick and 
CommonExceptionHandler() gets called and ExceptionType is 0x68. But 
ExceptionType is used to index into an array that only has 32 entries?

Thanks,

Andrew Fish


~/work/src/edk2(master)>git grep CPU_EXCEPTION_NUM -- *.h
UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h:29:#define  
CPU_EXCEPTION_NUM          32


https://svn.code.sf.net/p/edk2/code/trunk/edk2/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeSmmCpuException.c

RESERVED_VECTORS_DATA       mReservedVectorsData[CPU_EXCEPTION_NUM];
EFI_CPU_INTERRUPT_HANDLER   mExternalInterruptHandlerTable[CPU_EXCEPTION_NUM];
...
/**
  Common exception handler.

  @param ExceptionType  Exception type.
  @param SystemContext  Pointer to EFI_SYSTEM_CONTEXT.
**/
VOID
EFIAPI
CommonExceptionHandler (
  IN EFI_EXCEPTION_TYPE          ExceptionType, 
  IN EFI_SYSTEM_CONTEXT          SystemContext
  )
{
  EXCEPTION_HANDLER_CONTEXT      *ExceptionHandlerContext;

  ExceptionHandlerContext = (EXCEPTION_HANDLER_CONTEXT *) (UINTN) 
(SystemContext.SystemContextIa32);

  switch (mReservedVectors[ExceptionType].Attribute) {
…

  if (mExternalInterruptHandler[ExceptionType] != NULL) {
    (mExternalInterruptHandler[ExceptionType]) (ExceptionType, SystemContext);
  } else if (ExceptionType < CPU_EXCEPTION_NUM) {
    //
    // Get Spinlock to display CPU information
    //
    while (!AcquireSpinLockOrFail (&mDisplayMessageSpinLock)) {
      CpuPause ();
    }
    //
    // Display ExceptionType, CPU information and Image information
    //  
    DumpCpuContent (ExceptionType, SystemContext);
    //
    // Release Spinlock of output message
    //
    ReleaseSpinLock (&mDisplayMessageSpinLock);
    //
    // Enter a dead loop if needn't to execute old IDT handler further
    //
    if (mReservedVectors[ExceptionType].Attribute != 
EFI_VECTOR_HANDOFF_HOOK_BEFORE) {
      CpuDeadLoop ();
    }
  }

------------------------------------------------------------------------------
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to