Hi, in the newseg() function there is:
mapsize = ROUND(size, PTEPERTAB)/PTEPERTAB; if(mapsize > nelem(s->ssegmap)){ mapsize *= 2; if(mapsize > (SEGMAPSIZE*PTEPERTAB)) mapsize = (SEGMAPSIZE*PTEPERTAB); s->map = smalloc(mapsize*sizeof(Pte*)); s->mapsize = mapsize; } else{ s->map = s->ssegmap; s->mapsize = nelem(s->ssegmap); } I think it should be if(mapsize > (SEGMAPSIZE)) mapsize = SEGMAPSIZE; 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.