On Fri, Aug 8, 2014 at 4:46 PM, Andrew Fish <[email protected]> wrote:
> 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

This sounds familiar to some trouble I had with using the driver in
DUET a while back.

I think the table size is 256 based on
#define  CPU_INTERRUPT_NUM         256
but, maybe only 32 entries are initialized?

Mike, was CPU_EXCEPTION_NUM related to DebugAgent and not wanting to
override the DebugAgent interrupt handlers from PEI?

-Jordan

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

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

Reply via email to