[okl4-developer] [PATCH] map_region - size alignment
Geoffrey Lee
glee at ok-labs.com
Mon Aug 25 17:55:48 EST 2008
On Thu, Aug 21, 2008 at 12:21:11PM +1000, Tomas Hruby wrote:
> The size alignment in map_region() does not work if the vaddr is not
> already minimal-page size aligned.
Hi Tomas
Thanks for the patch. I'll pass it on to the right people.
-gl
>
> 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)) {
>
> _______________________________________________
> Developer mailing list
> Developer at okl4.org
> https://lists.okl4.org/mailman/listinfo/developer
>
--
More information about the Developer
mailing list