Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/src/mm/page.c

    re49e234 r7e752b2  
    3939#include <mm/page.h>
    4040#include <mm/as.h>
    41 #include <arch/types.h>
     41#include <typedefs.h>
    4242#include <align.h>
    4343#include <config.h>
     
    6161                 * PA2KA(identity) mapping for all frames until last_frame.
    6262                 */
     63                page_table_lock(AS_KERNEL, true);
    6364                for (cur = 0; cur < last_frame; cur += FRAME_SIZE) {
    6465                        flags = PAGE_CACHEABLE | PAGE_WRITE;
     
    6768                        page_mapping_insert(AS_KERNEL, PA2KA(cur), cur, flags);
    6869                }
     70                page_table_unlock(AS_KERNEL, true);
    6971               
    70                 exc_register(14, "page_fault", (iroutine) page_fault);
     72                exc_register(14, "page_fault", true, (iroutine_t) page_fault);
    7173                write_cr3((uintptr_t) AS_KERNEL->genarch.page_table);
    7274        } else
     
    8082{
    8183        if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))
    82                 panic("Unable to map physical memory %p (%d bytes).", physaddr, size)
     84                panic("Unable to map physical memory %p (%zu bytes).",
     85                    (void *) physaddr, size);
    8386       
    8487        uintptr_t virtaddr = PA2KA(last_frame);
    8588        pfn_t i;
     89        page_table_lock(AS_KERNEL, true);
    8690        for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) {
    8791                uintptr_t addr = PFN2ADDR(i);
    8892                page_mapping_insert(AS_KERNEL, virtaddr + addr, physaddr + addr, PAGE_NOT_CACHEABLE | PAGE_WRITE);
    8993        }
     94        page_table_unlock(AS_KERNEL, true);
    9095       
    9196        last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE);
     
    9499}
    95100
    96 void page_fault(int n __attribute__((unused)), istate_t *istate)
     101void page_fault(unsigned int n __attribute__((unused)), istate_t *istate)
    97102{
    98103        uintptr_t page;
     
    111116        if (as_page_fault(page, access, istate) == AS_PF_FAULT) {
    112117                fault_if_from_uspace(istate, "Page fault: %#x.", page);
    113                
    114                 decode_istate(istate);
    115                 printf("page fault address: %#lx\n", page);
    116                 panic("Page fault.");
     118                panic_memtrap(istate, access, page, NULL);
    117119        }
    118120}
Note: See TracChangeset for help on using the changeset viewer.