Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/src/ras.c

    r9d58539 r818fffe  
    3838#include <mm/frame.h>
    3939#include <mm/page.h>
    40 #include <mm/km.h>
    4140#include <mm/tlb.h>
    4241#include <mm/asid.h>
     
    5150void ras_init(void)
    5251{
    53         uintptr_t frame;
    54 
    55         frame = (uintptr_t) frame_alloc(ONE_FRAME,
    56             FRAME_ATOMIC | FRAME_HIGHMEM);
    57         if (!frame)
    58                 frame = (uintptr_t) frame_alloc(ONE_FRAME, FRAME_LOWMEM);
    59         ras_page = (uintptr_t *) km_map(frame,
    60             PAGE_SIZE, PAGE_READ | PAGE_WRITE | PAGE_USER | PAGE_CACHEABLE);
    61 
    62         memsetb(ras_page, PAGE_SIZE, 0);
     52        ras_page = frame_alloc(ONE_FRAME, FRAME_KA);
     53        memsetb(ras_page, FRAME_SIZE, 0);
    6354        ras_page[RAS_START] = 0;
    6455        ras_page[RAS_END] = 0xffffffff;
     56        /*
     57         * Userspace needs to be able to write to this page. The page is
     58         * cached in TLB as PAGE_KERNEL. Purge it from TLB and map it
     59         * read/write PAGE_USER.
     60         */
     61        tlb_invalidate_pages(ASID_KERNEL, (uintptr_t)ras_page, 1);
     62        page_table_lock(AS, true);
     63        page_mapping_insert(AS, (uintptr_t)ras_page, (uintptr_t)KA2PA(ras_page),
     64            PAGE_READ | PAGE_WRITE | PAGE_USER);
     65        page_table_unlock(AS, true);
    6566}
    6667
Note: See TracChangeset for help on using the changeset viewer.