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

James R. Van Artsdalen james-freebsd-current at jrv.org
Tue Aug 25 04:53:47 UTC 2009


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?



More information about the freebsd-current mailing list