[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [mini-os master] mini-os: add function to map one frame



commit 17c73471d4757b342d71b74afa04f53efa3efa71
Author:     Juergen Gross <jgross@xxxxxxxx>
AuthorDate: Thu Aug 4 16:14:31 2016 +0200
Commit:     Juergen Gross <jgross@xxxxxxxx>
CommitDate: Thu Aug 11 13:04:09 2016 +0200

    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)
 {
--
generated by git-patchbot for /home/xen/git/mini-os.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.