Changeset 2057572 in mainline for kernel/generic/src


Ignore:
Timestamp:
2007-03-27T23:40:25Z (19 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.

Location:
kernel/generic/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/klog.c

    r8d37a06 r2057572  
    9191
    9292        sysinfo_set_item_val("klog.faddr", NULL, (unative_t) faddr);
    93         sysinfo_set_item_val("klog.fcolor", NULL, (unative_t)
    94                 PAGE_COLOR((uintptr_t) klog));
    9593        sysinfo_set_item_val("klog.pages", NULL, 1 << KLOG_ORDER);
    9694        sysinfo_set_item_val("klog.devno", NULL, devno);
  • kernel/generic/src/ddi/ddi.c

    r8d37a06 r2057572  
    100100 *      syscall, ENOENT if there is no task matching the specified ID or the
    101101 *      physical address space is not enabled for mapping and ENOMEM if there
    102  *      was a problem in creating address space area. ENOTSUP is returned when
    103  *      an attempt to create an illegal address alias is detected.
     102 *      was a problem in creating address space area.
    104103 */
    105104static int ddi_physmem_map(uintptr_t pf, uintptr_t vp, count_t pages, int flags)
     
    140139                return ENOENT;
    141140        }
    142 
    143 #ifdef CONFIG_VIRT_IDX_DCACHE
    144         if (PAGE_COLOR(parea->vbase) != PAGE_COLOR(vp)) {
    145                 /*
    146                  * Refuse to create an illegal address alias.
    147                  */
    148                 spinlock_unlock(&parea_lock);
    149                 interrupts_restore(ipl);
    150                 return ENOTSUP;
    151         }
    152 #endif /* CONFIG_VIRT_IDX_DCACHE */
    153 
    154141        spinlock_unlock(&parea_lock);
    155142
  • kernel/generic/src/lib/rd.c

    r8d37a06 r2057572  
    9191        sysinfo_set_item_val("rd.address.physical", NULL, (unative_t)
    9292                KA2PA((void *) header + hsize));
    93         sysinfo_set_item_val("rd.address.color", NULL, (unative_t)
    94                 PAGE_COLOR((uintptr_t) header + hsize));
    9593
    9694        return RE_OK;
  • kernel/generic/src/mm/as.c

    r8d37a06 r2057572  
    614614 * or ENOMEM if there was a problem in allocating destination address space
    615615 * area. ENOTSUP is returned if the address space area backend does not support
    616  * sharing or if the kernel detects an attempt to create an illegal address
    617  * alias.
     616 * sharing.
    618617 */
    619618int as_area_share(as_t *src_as, uintptr_t src_base, size_t acc_size,
     
    667666                return EPERM;
    668667        }
    669 
    670 #ifdef CONFIG_VIRT_IDX_DCACHE
    671         if (!(dst_flags_mask & AS_AREA_EXEC)) {
    672                 if (PAGE_COLOR(src_area->base) != PAGE_COLOR(dst_base)) {
    673                         /*
    674                          * Refuse to create an illegal address alias.
    675                          */
    676                         mutex_unlock(&src_area->lock);
    677                         mutex_unlock(&src_as->lock);
    678                         interrupts_restore(ipl);
    679                         return ENOTSUP;
    680                 }
    681         }
    682 #endif /* CONFIG_VIRT_IDX_DCACHE */
    683668
    684669        /*
     
    902887                         * ASID.
    903888                         */
    904                          ASSERT(old_as->asid != ASID_INVALID);
    905                          list_append(&old_as->inactive_as_with_asid_link,
    906                              &inactive_as_with_asid_head);
     889                        ASSERT(old_as->asid != ASID_INVALID);
     890                        list_append(&old_as->inactive_as_with_asid_link,
     891                            &inactive_as_with_asid_head);
    907892                }
    908893                mutex_unlock(&old_as->lock);
  • kernel/generic/src/mm/backend_anon.c

    r8d37a06 r2057572  
    158158                panic("Could not insert used space.\n");
    159159               
    160 #ifdef CONFIG_VIRT_IDX_DCACHE
    161         if (dirty && PAGE_COLOR(PA2KA(frame)) != PAGE_COLOR(addr)) {
    162                 /*
    163                  * By writing to the frame using kernel virtual address,
    164                  * we have created an illegal virtual alias. We now have to
    165                  * invalidate cachelines belonging to addr on all processors
    166                  * so that they will be reloaded with the new content on next
    167                  * read.
    168                  */
    169                 dcache_flush_frame(addr, frame);
    170                 dcache_shootdown_start(DCACHE_INVL_FRAME, PAGE_COLOR(addr), frame);
    171                 dcache_shootdown_finalize();
    172         }
    173 #endif
    174 
    175160        return AS_PF_OK;
    176161}
     
    241226/** @}
    242227 */
    243 
  • kernel/generic/src/mm/backend_elf.c

    r8d37a06 r2057572  
    209209        if (!used_space_insert(area, ALIGN_DOWN(addr, PAGE_SIZE), 1))
    210210                panic("Could not insert used space.\n");
    211 
    212 #ifdef CONFIG_VIRT_IDX_DCACHE
    213         if (dirty && PAGE_COLOR(PA2KA(frame)) != PAGE_COLOR(addr)) {
    214                 /*
    215                  * By writing to the frame using kernel virtual address,
    216                  * we have created an illegal virtual alias. We now have to
    217                  * invalidate cachelines belonging to addr on all processors
    218                  * so that they will be reloaded with the new content on next
    219                  * read.
    220                  */
    221                 dcache_flush_frame(addr, frame);
    222                 dcache_shootdown_start(DCACHE_INVL_FRAME, PAGE_COLOR(addr), frame);
    223                 dcache_shootdown_finalize();
    224         }
    225 #endif
    226211
    227212        return AS_PF_OK;
     
    356341/** @}
    357342 */
    358 
  • kernel/generic/src/time/clock.c

    r8d37a06 r2057572  
    105105         */
    106106        sysinfo_set_item_val("clock.cacheable", NULL, (unative_t) true);
    107         sysinfo_set_item_val("clock.fcolor", NULL, (unative_t)
    108                 PAGE_COLOR(clock_parea.vbase));
    109107        sysinfo_set_item_val("clock.faddr", NULL, (unative_t) faddr);
    110108}
Note: See TracChangeset for help on using the changeset viewer.