Ard,

> > +  //
> > +  // Patch in the common Assembly exception handler
> > +  //
> > +  Offset = (UINTN)CommonExceptionEntry -
> (UINTN)ExceptionHandlersStart;
> > +  *(UINTN *)((UINT8 *)(UINTN)(BaseAddress + Offset)) =
> (UINTN)AsmCommonExceptionEntry;
> > +
> 
> Why is this needed? CommonExceptionEntry should already contain the
> absolute address of AsmCommonExceptionEntry, this is taken care of by
> the linker and/or the PE/COFF relocation (exactly the same as how your
> reference here got its actual value)

The silly answer is that this is what was already done in 
ArmPkg/Drivers/CpuDxe/Arm/Exception.c that I leveraged this from.  :)  This 
goes back to the dawn of time (BeagleBoard and first ARM support in edk2 in 
2009 contributed by Andrew Fish).  Back then CommonExceptionEntry needed to be 
patched at runtime because it just contained a placeholder at build time:

ASM_PFX(CommonExceptionEntry):
  .byte       0x12
  .byte       0x34
  .byte       0x56
  .byte       0x78

in 2011 a patch came in for the ARMv6 exception handling that changed this to 
populate the pointer with the address at build time:

ASM_PFX(CommonExceptionEntry):
  .word       ASM_PFX(AsmCommonExceptionEntry)

This came in for ARMv6 but the ARMv4 exception handling file was not updated.  
The ARMv4 exception handling was removed last December.

So historically there was a reason for it and now it no longer applies.  So 
I'll generate an updated patchset that removes this.

Nice catch.

Eugene


_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to