On 22/05/2025 11:56, Luca Fancellu wrote:
> Hi Michal,
> 
>>> +
>>> +/*
>>> + * Set limit address of MPU protection region.
>>> + *
>>> + * @pr: pointer to the protection region structure.
>>> + * @limit: exclusive address as limit of the protection region.
>>> + */
>>> +static inline void pr_set_limit(pr_t *pr, paddr_t limit)
>>> +{
>>> +    pr->prlar.reg.limit = (((limit - 1) & ~MPU_REGION_RES0)
>> Might be worth adding a comment that PRLAR expects inclusive limit hence 
>> (limit -1).
> 
> You mean on top of the assignment? I’ve probably misunderstood you comment in 
> the past version
> and thought that the @limit description was enough, I’m ok to add also this 
> comment.
The comment says that the address must be exclusive. The code then transforms it
into inclusive before the write, so one might wonder why.

~Michal


Reply via email to