[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 13/19] 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> Reviewed-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxx> --- 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 c53b0ca..707a3e0 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 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |