Re: FreeBSD doesn't handle SMAP: amd64 machdep.c typo & bug

From: James R. Van Artsdalen <james-freebsd-current_at_jrv.org>
Date: Mon, 24 Aug 2009 23:53:45 -0500
James R. Van Artsdalen wrote:
> This code seems to be suspect
> sys/amd64/amd64/machdep.c:
>
>                 for (i = 0; i <= physmap_idx; i += 2) {
>                         if (smap->base < physmap[i + 1]) {
>                 if (boothowto & RB_VERBOSE)
>                                     printf(
>         "Overlapping or non-monotonic memory region, ignoring second
> region\n");
>                                 continue;
>             }
>             }
>   

The first-order problem is a typo: that "continue" isn't doing
anything.  Fixing it (to make physmap non-descending) improves things.
Code elsewhere apparently assumes that the upper bound in the last
physmap entry is the maximum of all physmap upper bounds.

But there is still the incorrect assumption that smap is
non-descending.  Perhaps just sort() smap on the base address?
Received on Tue Aug 25 2009 - 02:53:47 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:54 UTC