|
From: | Richard Henderson |
Subject: | Re: [PATCH] target/arm: Make the final stage1+2 write to secure be unconditional |
Date: | Fri, 7 Oct 2022 09:53:37 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 |
On 10/7/22 09:20, Peter Maydell wrote:
- /* Check if IPA translates to secure or non-secure PA space. */ - if (is_secure) { - if (ipa_secure) { - result->attrs.secure = - !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW)); - } else { - result->attrs.secure = - !((env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW)) - || (env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW))); - } - }If: is_secure == true ipa_secure == false (env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW) is non-zero (env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW) is zero then the old code sets attrs.secure to true...
No, I think the misalignment of the two lines wrt the !() may have been confusing: if (true) { if (false) { } else { secure = !((0) || (non-zero)) = !(1) = 0 } } r~
+ /* + * Check if IPA translates to secure or non-secure PA space. + * Note that VSTCR overrides VTCR and {N}SW overrides {N}SA. + */ + result->attrs.secure = + (is_secure + && !(env->cp15.vstcr_el2 & (VSTCR_SA | VSTCR_SW)) + && (ipa_secure + || !(env->cp15.vtcr_el2 & (VTCR_NSA | VTCR_NSW))));...but the new code will set it to false, I think ? thanks -- PMM
[Prev in Thread] | Current Thread | [Next in Thread] |