Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset bb6f135 in mainline


Ignore:
Timestamp:
2012-02-09T22:19:06Z (8 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
master
Children:
e10d41a
Parents:
3d4750f (diff), 492ddc9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from lp:~jakub/helenos/mm.

Location:
kernel/generic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/macros.h

    r3d4750f rbb6f135  
    6969    uint64_t sz2)
    7070{
    71         uint64_t e1 = s1 + sz1;
    72         uint64_t e2 = s2 + sz2;
    73        
     71        uint64_t e1;
     72        uint64_t e2;
     73
     74        /* Handle the two corner cases when either sz1 or sz2 are zero. */
     75        if (sz1 == 0)
     76                return (s1 == s2) && (sz2 == 0);
     77        e1 = s1 + sz1 - 1;     
     78        if (sz2 == 0)
     79                return (s1 <= s2) && (s2 <= e1);
     80        e2 = s2 + sz2 - 1;
     81
     82        /* e1 and e2 are end addresses, the sum is imune to overflow */
    7483        return ((s1 <= s2) && (e1 >= e2));
    7584}
  • kernel/generic/src/mm/km.c

    r3d4750f rbb6f135  
    134134        ASSERT(ALIGN_UP(size, FRAME_SIZE) == size);
    135135
     136        /* Enforce natural or at least PAGE_SIZE alignment. */
    136137        align = ispwr2(size) ? size : (1U << (fnzb(size) + 1));
    137138        vaddr = km_page_alloc(size, max(PAGE_SIZE, align));
     
    150151{
    151152        uintptr_t offs;
     153        size_t align;
    152154        ipl_t ipl;
    153155
     
    168170        page_table_unlock(AS_KERNEL, true);
    169171
    170         km_page_free(vaddr, size);
     172        /*
     173         * Match the size parameter with that of km_page_alloc() in
     174         * km_map_aligned().
     175         */
     176        align = ispwr2(size) ? size : (1U << (fnzb(size) + 1));
     177        km_page_free(vaddr, max(PAGE_SIZE, align));
    171178}
    172179
Note: See TracChangeset for help on using the changeset viewer.