> I think it should be
> if(mapsize > (SEGMAPSIZE))
> mapsize = SEGMAPSIZE;
hmm. i think this code is correct. ssegmap is a static map
to handle small segments. small segments fit in ssegmap.
the point must have been to avoid malloc.
this test is a little more questionable
> if(mapsize > (SEGMAPSIZE*PTEPERTAB))
> mapsize = (SEGMAPSIZE*PTEPERTAB);
cf. the check in ibrk
if(newsize > (SEGMAPSIZE*PTEPERTAB)) {
qunlock(&s->lk);
error(Enovmem);
}
i think this check is either not wrong, or more extensive rework
is necessary.
@anthony, do you know if this code or similar occurred in even older kernels?
if there was a cap also in ibrk() then i would suspect this code was originally
correct.
i don't know where a history of stuff older than sources (2002) is.
> Also why in the kernel they use 'struct Pte' instead of the better name
> Pagetable.
> In many places this is very confusing because when I see Pte I think of a
> Pagetable Entry
> where really they are speaking about a Pagetable.
i would naturally think a Pte* would be an array of Pte's, i.e. a Pte table,
just like an array of uchar* could be used as a table.
- erik