[okl4-developer] [PATCH] map_region - size alignment
Tomas Hruby
thruby at cs.otago.ac.nz
Thu Aug 21 12:21:11 EST 2008
The size alignment in map_region() does not work if the vaddr is not
already minimal-page size aligned.
1 << BITS_WORD overflows
--- orig/pistachio/src/space.cc 2008-08-21 11:20:27.000000000 +1000
+++ fix/pistachio/src/space.cc 2008-08-21 11:20:10.000000000 +1000
@@ -527,14 +527,14 @@
//TRACEF("Map region %p -> %p %lx bytes\n", vaddr, paddr, size);
/* page align all addresses and size */
- size = (word_t)addr_align_up((addr_t)(((word_t)vaddr) + size), page_size(pgent_t::size_min)) - vaddr;
+ size = (word_t)addr_align_up((addr_t)size, page_size(pgent_t::size_min));
vaddr = (word_t)addr_align((addr_t)vaddr, page_size(pgent_t::size_min));
paddr = (word_t)addr_align((addr_t)paddr, page_size(pgent_t::size_min));
while (size != 0)
{
/* find pagesize to use for this portion of the mapping */
- for (pgsize = BITS_WORD; pgsize; pgsize--) {
+ for (pgsize = BITS_WORD - 1; pgsize; pgsize--) {
pagesize = 1UL << pgsize;
// Ignore sizes not supported by the kernel
if (!(pagesize & supported_sizes)) {
More information about the Developer
mailing list