Of all the gin joints in all the towns in all the world, Andrew Fish had to walk into mine at 16:46:15 on Friday 08 August 2014 and say:
> 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? Vectors 0 to 31 are reserved for internal CPU exception vector values when running in protected mode or long mode. Vectors 32 through 255 are available for software defined interrupts. (In 16-bit real mode, only vectors 0 through 7 are reserved, which requires you to fiddle with the 8259 PICs a bit when you enter protected mode to avoid a conflict in the unlikely event that you choose to use the legacy PICs for interrupt handling.) So the exception count is correct, and I guess CommonExceptionHandler() is assuming that the ExceptionType argument will only ever be an internal exception value. Presumably there's some other code somewhere that branches off the handling of vectors 32 to 255 to a different handler (for IRQ dispatching). The question is where is the value 0x68 coming from? -Bill > 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/CpuExcept > ionHandlerLib/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 (); > } > } -- ============================================================================= -Bill Paul (510) 749-2329 | Senior Member of Technical Staff, [email protected] | Master of Unix-Fu - Wind River Systems ============================================================================= "I put a dollar in a change machine. Nothing changed." - George Carlin ============================================================================= ------------------------------------------------------------------------------ _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
