Changeset 46c20c8 in mainline for kernel/arch/arm32/src/mm


Ignore:
Timestamp:
2010-11-26T20:08:10Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/fix-logger-deadlock, topic/msim-upgrade, topic/simplify-dev-export
Children:
45df59a
Parents:
fb150d78 (diff), ffdd2b9 (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 mainline changes.

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

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/src/mm/frame.c

    rfb150d78 r46c20c8  
    3636#include <mm/frame.h>
    3737#include <arch/mm/frame.h>
     38#include <arch/machine_func.h>
    3839#include <config.h>
    39 
    40 #ifdef MACHINE_testarm
    41         #include <arch/mach/testarm/testarm.h>
    42 #endif
    43 
    44 #ifdef MACHINE_integratorcp
    45         #include <arch/mach/integratorcp/integratorcp.h>
    46 #endif
     40#include <align.h>
    4741
    4842/** Address of the last frame in the memory. */
     
    5246void frame_arch_init(void)
    5347{
    54         last_frame = machine_get_memory_size();
     48        uintptr_t mem_start, mem_size;
     49        uintptr_t first_frame;
     50        uintptr_t num_frames;
     51
     52        machine_get_memory_extents(&mem_start, &mem_size);
     53        first_frame = ALIGN_UP(mem_start, FRAME_SIZE);
     54        last_frame = ALIGN_DOWN(mem_start + mem_size, FRAME_SIZE);
     55        num_frames = (last_frame - first_frame) >> FRAME_WIDTH;
    5556       
    5657        /* All memory as one zone */
    57         zone_create(0, ADDR2PFN(last_frame),
     58        zone_create(first_frame >> FRAME_WIDTH, num_frames,
    5859            BOOT_PAGE_TABLE_START_FRAME + BOOT_PAGE_TABLE_SIZE_IN_FRAMES, 0);
    5960       
  • kernel/arch/arm32/src/mm/page.c

    rfb150d78 r46c20c8  
    2727 */
    2828
    29 /** @addtogroup arm32mm 
     29/** @addtogroup arm32mm
    3030 * @{
    3131 */
     
    4141#include <arch/exception.h>
    4242#include <typedefs.h>
    43 #include <arch/types.h>
    4443#include <interrupt.h>
    4544#include <arch/mm/frame.h>
     
    5453        int flags = PAGE_CACHEABLE;
    5554        page_mapping_operations = &pt_mapping_operations;
     55
     56        page_table_lock(AS_KERNEL, true);
    5657       
    5758        uintptr_t cur;
    5859        /* Kernel identity mapping */
    59         for (cur = 0; cur < last_frame; cur += FRAME_SIZE)
     60        for (cur = PHYSMEM_START_ADDR; cur < last_frame; cur += FRAME_SIZE)
    6061                page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags);
    6162       
     
    6768#error "Only high exception vector supported now"
    6869#endif
     70        cur = ALIGN_DOWN(0x50008010, FRAME_SIZE);
     71        page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags);
     72
     73        page_table_unlock(AS_KERNEL, true);
    6974       
    7075        as_switch(NULL, AS_KERNEL);
     
    8893            KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) {
    8994                panic("Unable to map physical memory %p (%d bytes).",
    90                     physaddr, size);
     95                    (void *) physaddr, size);
    9196        }
    9297       
    9398        uintptr_t virtaddr = PA2KA(last_frame);
    9499        pfn_t i;
     100
     101        page_table_lock(AS_KERNEL, true);
    95102        for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) {
    96103                page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i),
     
    98105                    PAGE_NOT_CACHEABLE | PAGE_READ | PAGE_WRITE | PAGE_KERNEL);
    99106        }
     107        page_table_unlock(AS_KERNEL, true);
    100108       
    101109        last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE);
  • kernel/arch/arm32/src/mm/page_fault.c

    rfb150d78 r46c20c8  
    141141        if (instr.condition == 0xf) {
    142142                panic("page_fault - instruction does not access memory "
    143                     "(instr_code: %x, badvaddr:%x).", instr, badvaddr);
     143                    "(instr_code: %#0" PRIx32 ", badvaddr:%p).",
     144                    instr_union.pc, (void *) badvaddr);
    144145                return PF_ACCESS_EXEC;
    145146        }
     
    160161
    161162        panic("page_fault - instruction doesn't access memory "
    162             "(instr_code: %x, badvaddr:%x).", instr, badvaddr);
     163            "(instr_code: %#0" PRIx32 ", badvaddr:%p).",
     164            instr_union.pc, (void *) badvaddr);
    163165
    164166        return PF_ACCESS_EXEC;
     
    167169/** Handles "data abort" exception (load or store at invalid address).
    168170 *
    169  * @param exc_no        Exception number.
    170  * @param istate        CPU state when exception occured.
    171  */
    172 void data_abort(int exc_no, istate_t *istate)
     171 * @param exc_no Exception number.
     172 * @param istate CPU state when exception occured.
     173 *
     174 */
     175void data_abort(unsigned int exc_no, istate_t *istate)
    173176{
    174177        fault_status_t fsr __attribute__ ((unused)) =
     
    182185        if (ret == AS_PF_FAULT) {
    183186                fault_if_from_uspace(istate, "Page fault: %#x.", badvaddr);
    184                 print_istate(istate);
    185                 printf("page fault - pc: %x, va: %x, status: %x(%x), "
    186                     "access:%d\n", istate->pc, badvaddr, fsr.status, fsr,
    187                     access);
    188                
    189                 panic("Page fault.");
     187                panic_memtrap(istate, access, badvaddr, NULL);
    190188        }
    191189}
     
    193191/** Handles "prefetch abort" exception (instruction couldn't be executed).
    194192 *
    195  * @param exc_no        Exception number.
    196  * @param istate        CPU state when exception occured.
    197  */
    198 void prefetch_abort(int exc_no, istate_t *istate)
     193 * @param exc_no Exception number.
     194 * @param istate CPU state when exception occured.
     195 *
     196 */
     197void prefetch_abort(unsigned int exc_no, istate_t *istate)
    199198{
    200199        int ret = as_page_fault(istate->pc, PF_ACCESS_EXEC, istate);
    201200
    202201        if (ret == AS_PF_FAULT) {
    203                 printf("prefetch_abort\n");
    204                 print_istate(istate);
    205                 panic("page fault - prefetch_abort at address: %x.",
    206                     istate->pc);
     202                fault_if_from_uspace(istate,
     203                    "Page fault - prefetch_abort: %#x.", istate->pc);
     204                panic_memtrap(istate, PF_ACCESS_EXEC, istate->pc, NULL);
    207205        }
    208206}
  • kernel/arch/arm32/src/mm/tlb.c

    rfb150d78 r46c20c8  
    3737#include <arch/mm/asid.h>
    3838#include <arch/asm.h>
    39 #include <arch/types.h>
     39#include <typedefs.h>
    4040#include <arch/mm/page.h>
    4141
Note: See TracChangeset for help on using the changeset viewer.