On 6/25/20 5:29 AM, Peter Maydell wrote:
> On Tue, 23 Jun 2020 at 20:37, Richard Henderson
> <richard.hender...@linaro.org> wrote:
>>
>> Introduce an lvalue macro to wrap target_tlb_bit0.
>>
>> Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
>> +/* Helper for the macros below, validating the argument type. */
>> +static inline MemTxAttrs *typecheck_memtxattrs(MemTxAttrs *x)
>> +{
>> +    return x;
>> +}
>> +
>> +/*
>> + * Lvalue macros for ARM TLB bits that we must cache in the TCG TLB.
>> + * Using these should be a bit more self-documenting than using the
>> + * generic target bits directly.
>> + */
>> +#define arm_tlb_bti_gp(x) (typecheck_memtxattrs(x)->target_tlb_bit0)
> 
> It seems unlikely that we wouldn't get a compile failure if
> we passed something other than a MemTxAttrs* to this macro,
> given the specificity of the field name, but I guess it
> gives us a less confusing compiler error ?

Yes, it's a quite clear error with the function.  But you're right, we could
probably get away without it.


r~

> 
> Reviewed-by: Peter Maydell <peter.mayd...@linaro.org>
> 
> thanks
> -- PMM
> 


Reply via email to