Changeset 32e8cd1 in mainline for kernel/arch/sparc32/src/mm


Ignore:
Timestamp:
2013-12-28T17:16:44Z (12 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c1023bcb
Parents:
f6f22cdb
Message:

code revision
coding style fixes
removal of debugging printouts and other temporary stuff

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

Legend:

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

    rf6f22cdb r32e8cd1  
    3838#include <genarch/mm/page_pt.h>
    3939
    40 static ptd_t context_table[ASID_MAX_ARCH] __attribute__((aligned (1024)));
     40static ptd_t context_table[ASID_MAX_ARCH] __attribute__((aligned(1024)));
    4141
    4242void as_arch_init(void)
    4343{
    4444        as_operations = &as_pt_operations;
    45         as_context_table = (uintptr_t)&context_table;
     45        as_context_table = (uintptr_t) &context_table;
    4646}
    4747
    4848void as_install_arch(as_t *as)
    4949{
    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;
     50        context_table[as->asid].table_pointer =
     51            (uintptr_t) as->genarch.page_table >> 6;
    5452        context_table[as->asid].et = PTE_ET_DESCRIPTOR;
    5553        asi_u32_write(ASI_MMUREGS, 0x200, as->asid);
  • kernel/arch/sparc32/src/mm/frame.c

    rf6f22cdb r32e8cd1  
    4646        uintptr_t base;
    4747        size_t size;
    48 
    4948        machine_get_memory_extents(&base, &size);
    50 
     49       
    5150        base = ALIGN_UP(base, FRAME_SIZE);
    5251        size = ALIGN_DOWN(size, FRAME_SIZE);
     
    5453        if (!frame_adjust_zone_bounds(low, &base, &size))
    5554                return;
    56 
     55       
    5756        if (low) {
    5857                zone_create(ADDR2PFN(base), SIZE2FRAMES(size),
    5958                    BOOT_PT_START_FRAME + BOOT_PT_SIZE_FRAMES,
    6059                    ZONE_AVAILABLE | ZONE_LOWMEM);
    61 
    62                 printf("low_zone: %d frames\n", SIZE2FRAMES(size));
    6360        } else {
    6461                pfn_t conf = zone_external_conf_alloc(SIZE2FRAMES(size));
     
    6663                        zone_create(ADDR2PFN(base), SIZE2FRAMES(size), conf,
    6764                            ZONE_AVAILABLE | ZONE_HIGHMEM);
    68 
    69                 printf("high zone: %d frames\n", SIZE2FRAMES(size));
    7065        }
    71 
    72         printf("free: %d\n", frame_total_free_get());
    7366}
    7467
    7568void physmem_print(void)
    7669{
    77 
     70        // FIXME TODO
    7871}
    7972
     
    8275{
    8376        frame_common_arch_init(true);
    84 
    85         /* blacklist boot page table */
     77       
     78        /* Blacklist boot page table */
    8679        frame_mark_unavailable(BOOT_PT_START_FRAME, BOOT_PT_SIZE_FRAMES);
    87         printf("free: %d\n", frame_total_free_get());
    88         //machine_frame_init();
    8980}
    9081
     
    9586}
    9687
    97 /** Frees the boot page table. */
    98 /*void boot_page_table_free(void)
    99 {
    100         unsigned int i;
    101         for (i = 0; i < BOOT_PT_SIZE_FRAMES; i++)
    102                 frame_free(i * FRAME_SIZE + BOOT_PT_ADDRESS);
    103 }*/
    104 
    10588/** @}
    10689 */
  • kernel/arch/sparc32/src/mm/page.c

    rf6f22cdb r32e8cd1  
    2727 */
    2828
    29 /** @addtogroup abs32lemm
     29/** @addtogroup sparc32mm
    3030 * @{
    3131 */
     
    5757        int flags = PAGE_CACHEABLE | PAGE_EXEC;
    5858        page_mapping_operations = &pt_mapping_operations;
    59 
     59       
    6060        page_table_lock(AS_KERNEL, true);
    6161       
    6262        /* Kernel identity mapping */
    63         //FIXME: We need to consider the possibility that
    64         //identity_base > identity_size and physmem_end.
    65         //This might lead to overflow if identity_size is too big.
     63        // FIXME:
     64        // We need to consider the possibility that
     65        // identity_base > identity_size and physmem_end.
     66        // This might lead to overflow if identity_size is too big.
    6667        for (uintptr_t cur = PHYSMEM_START_ADDR;
    6768            cur < min(KA2PA(config.identity_base) +
    68                 config.identity_size, config.physmem_end);
     69            config.identity_size, config.physmem_end);
    6970            cur += FRAME_SIZE)
    7071                page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags);
    7172       
    72 
    7373        page_table_unlock(AS_KERNEL, true);
    7474        as_switch(NULL, AS_KERNEL);
    75 
    76 //      printf("as_context_table=0x%08x\n", as_context_table);
    77 
     75       
    7876        /* Switch MMU to new context table */
    7977        asi_u32_write(ASI_MMUREGS, MMU_CONTEXT_TABLE, KA2PA(as_context_table) >> 4);
    80 
    81         //boot_page_table_free();
    8278}
    8379
     
    8682        uint32_t fault_status = asi_u32_read(ASI_MMUREGS, MMU_FAULT_STATUS);
    8783        uintptr_t fault_address = asi_u32_read(ASI_MMUREGS, MMU_FAULT_ADDRESS);
    88         mmu_fault_status_t *fault = (mmu_fault_status_t *)&fault_status;
    89         mmu_fault_type_t type = (mmu_fault_type_t)fault->at;
    90 
    91 //      printf("page fault on address 0x%08x, status 0x%08x, type %d\n", fault_address, fault_status, type);
    92 
    93         if (type == FAULT_TYPE_LOAD_USER_DATA ||
    94             type == FAULT_TYPE_LOAD_SUPERVISOR_DATA)   
     84        mmu_fault_status_t *fault = (mmu_fault_status_t *) &fault_status;
     85        mmu_fault_type_t type = (mmu_fault_type_t) fault->at;
     86       
     87        if ((type == FAULT_TYPE_LOAD_USER_DATA) ||
     88            (type == FAULT_TYPE_LOAD_SUPERVISOR_DATA))
    9589                as_page_fault(fault_address, PF_ACCESS_READ, istate);
    9690
    97         if (type == FAULT_TYPE_EXECUTE_USER ||
    98             type == FAULT_TYPE_EXECUTE_SUPERVISOR)
     91        if ((type == FAULT_TYPE_EXECUTE_USER) ||
     92            (type == FAULT_TYPE_EXECUTE_SUPERVISOR))
    9993                as_page_fault(fault_address, PF_ACCESS_EXEC, istate);
    10094
    101         if (type == FAULT_TYPE_STORE_USER_DATA ||
    102             type == FAULT_TYPE_STORE_USER_INSTRUCTION ||
    103             type == FAULT_TYPE_STORE_SUPERVISOR_INSTRUCTION ||
    104             type == FAULT_TYPE_STORE_SUPERVISOR_DATA)
     95        if ((type == FAULT_TYPE_STORE_USER_DATA) ||
     96            (type == FAULT_TYPE_STORE_USER_INSTRUCTION) ||
     97            (type == FAULT_TYPE_STORE_SUPERVISOR_INSTRUCTION) ||
     98            (type == FAULT_TYPE_STORE_SUPERVISOR_DATA))
    10599                as_page_fault(fault_address, PF_ACCESS_WRITE, istate);
    106100}
  • kernel/arch/sparc32/src/mm/tlb.c

    rf6f22cdb r32e8cd1  
    2727 */
    2828
    29 /** @addtogroup abs32lemm
     29/** @addtogroup sparc32mm
    3030 * @{
    3131 */
     
    4545}
    4646
    47 void tlb_invalidate_pages(asid_t asid __attribute__((unused)), uintptr_t page, size_t cnt)
     47void tlb_invalidate_pages(asid_t asid __attribute__((unused)), uintptr_t page,
     48    size_t cnt)
    4849{
    4950        tlb_invalidate_all();
Note: See TracChangeset for help on using the changeset viewer.