Changeset aecf79f in mainline for kernel/arch/xen32/src/mm/page.c


Ignore:
Timestamp:
2006-07-24T16:07:15Z (19 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c59dd1a2
Parents:
7b0599b
Message:

xen memory initialization

File:
1 edited

Legend:

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

    r7b0599b raecf79f  
    7878}
    7979
    80 
    81 uintptr_t hw_map(uintptr_t physaddr, size_t size)
    82 {
    83         if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))
    84                 panic("Unable to map physical memory %p (%d bytes)", physaddr, size)
    85        
    86         uintptr_t virtaddr = PA2KA(last_frame);
    87         pfn_t i;
    88         for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++)
    89                 page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i), physaddr + PFN2ADDR(i), PAGE_NOT_CACHEABLE);
    90        
    91         last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE);
    92        
    93         return virtaddr;
    94 }
    95 
    9680void page_fault(int n, istate_t *istate)
    9781{
    98         uintptr_t page;
     82        uintptr_t page;
    9983        pf_access_t access;
    10084       
    101         page = read_cr2();
    102                
    103         if (istate->error_word & PFERR_CODE_RSVD)
     85        page = read_cr2();
     86       
     87        if (istate->error_word & PFERR_CODE_RSVD)
    10488                panic("Reserved bit set in page directory.\n");
    105 
     89       
    10690        if (istate->error_word & PFERR_CODE_RW)
    10791                access = PF_ACCESS_WRITE;
    10892        else
    10993                access = PF_ACCESS_READ;
    110 
    111         if (as_page_fault(page, access, istate) == AS_PF_FAULT) {
     94       
     95        if (as_page_fault(page, access, istate) == AS_PF_FAULT) {
    11296                fault_if_from_uspace(istate, "Page fault: %#x", page);
    113 
    114                 PRINT_INFO_ERRCODE(istate);
    115                 printf("page fault address: %#x\n", page);
    116                 panic("page fault\n");
    117         }
     97               
     98                PRINT_INFO_ERRCODE(istate);
     99                printf("page fault address: %#x\n", page);
     100                panic("page fault\n");
     101        }
    118102}
    119103
Note: See TracChangeset for help on using the changeset viewer.