Changeset 2057572 in mainline for uspace/libc/generic/as.c


Ignore:
Timestamp:
2007-03-27T23:40:25Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
399ece9
Parents:
8d37a06
Message:

The Ultimate Solution To Illegal Virtual Aliases.
It is better to avoid them completely than to fight them.
Switch the sparc64 port to 16K pages. The TLBs and TSBs
continue to operate with 8K pages only. Page tables and
other generic parts operate with 16K pages.

Because the MMU doesn't support 16K directly, each 16K
page is emulated by a pair of 8K pages. With 16K pages,
illegal aliases cannot be created in 16K D-cache.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/libc/generic/as.c

    r8d37a06 r2057572  
    5656{
    5757        return (void *) __SYSCALL3(SYS_AS_AREA_CREATE, (sysarg_t ) address,
    58                 (sysarg_t) size, (sysarg_t) flags);
     58            (sysarg_t) size, (sysarg_t) flags);
    5959}
    6060
     
    7070int as_area_resize(void *address, size_t size, int flags)
    7171{
    72         return __SYSCALL3(SYS_AS_AREA_RESIZE, (sysarg_t ) address, (sysarg_t)
    73                 size, (sysarg_t) flags);
     72        return __SYSCALL3(SYS_AS_AREA_RESIZE, (sysarg_t ) address,
     73            (sysarg_t) size, (sysarg_t) flags);
    7474}
    7575
     
    144144 *
    145145 * @param sz Requested size of the allocation.
    146  * @param color Requested virtual color of the allocation.
    147146 *
    148147 * @return Pointer to the beginning
     
    151150 *       the pointer to last area
    152151 */
    153 void *as_get_mappable_page(size_t sz, int color)
     152void *as_get_mappable_page(size_t sz)
    154153{
    155154        void *res;
     
    167166       
    168167        /*
    169          * Make sure we allocate from naturally aligned address and a page of
    170          * appropriate color.
     168         * Make sure we allocate from naturally aligned address.
    171169         */
    172170        i = 0;
    173         do {
    174                 if (!last_allocated) {
    175                         last_allocated = (void *) ALIGN_UP((void *) &_heap +
    176                                 maxheapsize, asz);
    177                 } else {
    178                         last_allocated = (void *) ALIGN_UP(((uintptr_t)
    179                                 last_allocated) + (int) (i > 0), asz);
    180                 }
    181         } while ((asz < (1 << (PAGE_COLOR_BITS + PAGE_WIDTH))) &&
    182                 (PAGE_COLOR((uintptr_t) last_allocated) != color) &&
    183                 (++i < (1 << PAGE_COLOR_BITS)));
     171        if (!last_allocated) {
     172                last_allocated = (void *) ALIGN_UP((void *) &_heap +
     173                    maxheapsize, asz);
     174        } else {
     175                last_allocated = (void *) ALIGN_UP(((uintptr_t)
     176                    last_allocated) + (int) (i > 0), asz);
     177        }
    184178
    185179        res = last_allocated;
Note: See TracChangeset for help on using the changeset viewer.