segment_alloc may not allocate enough memory.
commit61cdc1167fcda6ccd6a034245596a2b82089df3f
authorGuanqun Lu <guanqun.lu@gmail.com>
Fri, 2 May 2008 02:56:30 +0000 (2 10:56 +0800)
committerGuanqun Lu <guanqun.lu@gmail.com>
Fri, 2 May 2008 02:56:30 +0000 (2 10:56 +0800)
treec05645dd96ce37a3e3e766d96fc5461af4e389a4
parent620d4b87537f8a926f84d780d21f3d244282f84a
segment_alloc may not allocate enough memory.

e.g. 800020 -> 805004. the length is 4fe4.
according to my original implementation, ROUNDUP length, and
we get 5 pages, but actually, there are "6" pages that we need,
i.e: 0x800000, 0x801000, 0x802000, 0x803000, 0x804000, 0x805000.
Thus, we can't simply round down the va, and round up the length.
A loop through method is more robust.

Signed-off-by: Guanqun Lu <guanqun.lu@gmail.com>
kern/env.c