]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/mini-os.git/commitdiff
mini-os: added arch_init_gnttab
authorKarim Raslan <karim.allah.ahmed@gmail.com>
Thu, 26 Jun 2014 11:28:25 +0000 (12:28 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Fri, 27 Jun 2014 12:38:34 +0000 (13:38 +0100)
Moves some x86-specific code into arch/x86.

Signed-off-by: Karim Allah Ahmed <karim.allah.ahmed@gmail.com>
[talex5@gmail.com: split into multiple patches]
Signed-off-by: Thomas Leonard <talex5@gmail.com>
Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
arch/x86/mm.c
gnttab.c
include/gnttab.h

index 35df15bd1e9ff99086d9ec57d1aac5acd797ec5d..9c6d1b84f6dec6edcf8fbab612302f821d95a9b0 100644 (file)
@@ -942,3 +942,16 @@ void arch_init_mm(unsigned long* start_pfn_p, unsigned long* max_pfn_p)
     *start_pfn_p = start_pfn;
     *max_pfn_p = max_pfn;
 }
+
+grant_entry_t *arch_init_gnttab(int nr_grant_frames)
+{
+    struct gnttab_setup_table setup;
+    unsigned long frames[nr_grant_frames];
+
+    setup.dom = DOMID_SELF;
+    setup.nr_frames = nr_grant_frames;
+    set_xen_guest_handle(setup.frame_list, frames);
+
+    HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1);
+    return map_frames(frames, nr_grant_frames);
+}
index 6f250062b80316432bff0080e106f257f699baf2..f395d12ab6e18ff60ca4b2dc5933342941d4290e 100644 (file)
--- a/gnttab.c
+++ b/gnttab.c
@@ -172,8 +172,6 @@ gnttabop_error(int16_t status)
 void
 init_gnttab(void)
 {
-    struct gnttab_setup_table setup;
-    unsigned long frames[NR_GRANT_FRAMES];
     int i;
 
 #ifdef GNT_DEBUG
@@ -182,12 +180,7 @@ init_gnttab(void)
     for (i = NR_RESERVED_ENTRIES; i < NR_GRANT_ENTRIES; i++)
         put_free_entry(i);
 
-    setup.dom = DOMID_SELF;
-    setup.nr_frames = NR_GRANT_FRAMES;
-    set_xen_guest_handle(setup.frame_list, frames);
-
-    HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1);
-    gnttab_table = map_frames(frames, NR_GRANT_FRAMES);
+    gnttab_table = arch_init_gnttab(NR_GRANT_FRAMES);
     printk("gnttab_table mapped at %p.\n", gnttab_table);
 }
 
index acd6c39f8cb0bf84427043ee6a71effcbd78c407..c43ad4255dc54236bce4ec9c9906898d44982ca2 100644 (file)
@@ -12,5 +12,6 @@ unsigned long gnttab_end_transfer(grant_ref_t gref);
 int gnttab_end_access(grant_ref_t ref);
 const char *gnttabop_error(int16_t status);
 void fini_gnttab(void);
+grant_entry_t *arch_init_gnttab(int nr_grant_frames);
 
 #endif /* !__GNTTAB_H__ */