On 14/02/2025 2:10 pm, Grygorii Strashko wrote:
>>>
>>> For example, requested range:
>>>    00e6140000 - 00e6141004 should set e6140:e6141 nr=2, but will
>>> configure
>>> e6140 e6142 nr=3 instead.
>>
>> I am not sure what 'nr' is referring to here.
>
> Sorry, will change to "num_pages"?

I agree Xen needs to be better (and by that, I mean consistent and
clear), but there are subtle bugs with most approaches like this.

Any exclusive bound, as well as counts like this need $n+1 bits of
arithmetic when you want to describe the boundaries of the space.

There is also a boundary condition for counts.  What map_foo(x, 0) mean?

Real hardware uses "last" for describing boundaries (x86 specifically
calls this "limit" in the ISA, but it's a trick used by other
architectures too).  Unlike "end", it's clearly an inclusive bound.

Personally, I'd like to see Xen switch to "start, last" pairs.  It's
unambiguous and has fewest boundary cases.

~Andrew

Reply via email to