[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [PATCH v2 13/18] mini-os: add function to map one frame
Add a function to map one physical frame to a specified virtual address as read/write. This will be used later multiple times. Signed-off-by: Juergen Gross <jgross@xxxxxxxx> --- include/arm/arch_mm.h | 2 ++ include/mm.h | 1 + mm.c | 5 +++++ 3 files changed, 8 insertions(+) diff --git a/include/arm/arch_mm.h b/include/arm/arch_mm.h index 085d4e5..f4685d8 100644 --- a/include/arm/arch_mm.h +++ b/include/arm/arch_mm.h @@ -14,6 +14,8 @@ extern uint32_t physical_address_offset; /* Add this to a virtual address to get #define L1_PAGETABLE_SHIFT 12 +#define L1_PROT 0 + #define to_phys(x) (((paddr_t)(x)+physical_address_offset) & 0xffffffff) #define to_virt(x) ((void *)(((x)-physical_address_offset) & 0xffffffff)) diff --git a/include/mm.h b/include/mm.h index 9244e26..6add683 100644 --- a/include/mm.h +++ b/include/mm.h @@ -72,6 +72,7 @@ int do_map_frames(unsigned long addr, const unsigned long *f, unsigned long n, unsigned long stride, unsigned long increment, domid_t id, int *err, unsigned long prot); int unmap_frames(unsigned long va, unsigned long num_frames); +int map_frame_rw(unsigned long addr, unsigned long mfn); #ifdef HAVE_LIBC extern unsigned long heap, brk, heap_mapped, heap_end; #endif diff --git a/mm.c b/mm.c index ff071ca..fd66115 100644 --- a/mm.c +++ b/mm.c @@ -319,6 +319,11 @@ int free_physical_pages(xen_pfn_t *mfns, int n) return HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation); } +int map_frame_rw(unsigned long addr, unsigned long mfn) +{ + return do_map_frames(addr, &mfn, 1, 1, 1, DOMID_SELF, NULL, L1_PROT); +} + #ifdef HAVE_LIBC void *sbrk(ptrdiff_t increment) { -- 2.6.6 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/cgi-bin/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |