Changeset c1982e45 in mainline for arch/ia32/src/mm/page.c


Ignore:
Timestamp:
2006-05-20T21:11:08Z (19 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
125e944
Parents:
1068f6a
Message:

make hardware memory mapping more generic

File:
1 edited

Legend:

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

    r1068f6a rc1982e45  
    3434#include <mm/as.h>
    3535#include <arch/types.h>
     36#include <align.h>
    3637#include <config.h>
    3738#include <func.h>
     
    4243#include <print.h>
    4344#include <interrupt.h>
     45
    4446
    4547void page_arch_init(void)
     
    7072        paging_on();
    7173}
     74
     75
     76__address hw_map(__address physaddr, size_t size)
     77{
     78        if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH))
     79                panic("Unable to map physical memory %p (%d bytes)", physaddr, size)
     80       
     81        __address virtaddr = PA2KA(last_frame);
     82        pfn_t i;
     83        for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++)
     84                page_mapping_insert(AS_KERNEL, virtaddr + PFN2ADDR(i), physaddr + PFN2ADDR(i), PAGE_NOT_CACHEABLE);
     85       
     86        last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE);
     87       
     88        return virtaddr;
     89}
Note: See TracChangeset for help on using the changeset viewer.