Alexei and Ard,

> The suggested code for EL1_OR_EL2 macro:
> 
> mrs    SAFE_XREG, CurrentEL ;\
> cmp    SAFE_XREG, #0x8      ;\
> b.eq   2f                   ;\
> tbnz   SAFE_XREG, #2, 1f    ;\
> b      .                    ;// We should never get here
> 
> will successfully branch to 1f label in case of EL3 with SAFE_XREG = 0xC
> because bit #2 will be set.

Agreed.  If you assume that EL1_OR_EL2 can never be invoked at EL3 then 
obviously this wouldn't be a concern.  But since there's already a case for 
handling neither EL1 nor EL2 (b .) then it would make sense to correct this so 
if it was accidentally used in EL3 it would hit the default case which is 
better for debugability.  The last tbnz needs to be reverted to the previous 
cmp/b.ne construct or equivalent.



_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to