Changeset ef9a2a8 in mainline for kernel/arch/sparc32/src/mm


Ignore:
Timestamp:
2013-09-15T19:23:19Z (12 years ago)
Author:
Jakub Klama <jakub.klama@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3efc35a
Parents:
b6b02c0
Message:

Introduce early MMU support in kernel. At current state, it
is possible to create initial kernel address space, map kernel
identity into it and take over MMU control. ASID FIFO support
should also work.

Location:
kernel/arch/sparc32/src/mm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc32/src/mm/as.c

    rb6b02c0 ref9a2a8  
    11/*
    2  * Copyright (c) 2010 Martin Decky
     2 * Copyright (c) 2013 Jakub Klama
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup abs32lemm
     29/** @addtogroup sparc32mm
    3030 * @{
    3131 */
    3232
    3333#include <mm/as.h>
     34#include <arch/arch.h>
     35#include <arch/asm.h>
    3436#include <arch/mm/as.h>
     37#include <arch/mm/page.h>
    3538#include <genarch/mm/page_pt.h>
     39
     40static ptd_t context_table[ASID_MAX_ARCH] __attribute__((aligned (1024)));
    3641
    3742void as_arch_init(void)
    3843{
    3944        as_operations = &as_pt_operations;
     45        as_context_table = (uintptr_t)&context_table;
     46}
     47
     48void as_install_arch(as_t *as)
     49{
     50        printf("as_install_arch(asid=%d)\n", as->asid);
     51        printf("genarch.page_table=%p\n", as->genarch.page_table);
     52
     53        context_table[as->asid].table_pointer = (uintptr_t)as->genarch.page_table >> 6;
     54        context_table[as->asid].et = PTE_ET_DESCRIPTOR;
     55        asi_u32_write(ASI_MMUREGS, 0x200, as->asid);
    4056}
    4157
  • kernel/arch/sparc32/src/mm/frame.c

    rb6b02c0 ref9a2a8  
    4848        //machine_get_memory_extents(&base, &size);
    4949        base = 0x40000000;
    50         size = 0x2000000;
     50        size = 0x4000000;
    5151
    5252        base = ALIGN_UP(base, FRAME_SIZE);
  • kernel/arch/sparc32/src/mm/page.c

    rb6b02c0 ref9a2a8  
    4949#include <print.h>
    5050#include <interrupt.h>
     51#include <macros.h>
    5152
    5253void page_arch_init(void)
    5354{
    54         if (config.cpu_active == 1)
    55                 page_mapping_operations = &pt_mapping_operations;
     55        int flags = PAGE_CACHEABLE | PAGE_EXEC;
     56        page_mapping_operations = &pt_mapping_operations;
     57
     58        page_table_lock(AS_KERNEL, true);
     59       
     60        /* Kernel identity mapping */
     61        //FIXME: We need to consider the possibility that
     62        //identity_base > identity_size and physmem_end.
     63        //This might lead to overflow if identity_size is too big.
     64        for (uintptr_t cur = PHYSMEM_START_ADDR;
     65            cur < min(KA2PA(config.identity_base) +
     66                config.identity_size, config.physmem_end);
     67            cur += FRAME_SIZE)
     68                page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags);
     69       
     70
     71        page_table_unlock(AS_KERNEL, true);
     72        as_switch(NULL, AS_KERNEL);
     73
     74        printf("as_context_table=0x%08x\n", as_context_table);
     75
     76        /* Switch MMU to new context table */
     77        asi_u32_write(ASI_MMUREGS, 0x100, KA2PA(as_context_table) >> 4);
     78
     79        //boot_page_table_free();
    5680}
    5781
Note: See TracChangeset for help on using the changeset viewer.