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

[Xen-devel] [PATCH v5 01/23] x86/mm: move guest_get_eff_l1e to pv/mm.h



Mkae it static inline. It well be used by map_ldt_shadow_page and ro
page fault emulation code later.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 xen/arch/x86/mm.c    | 18 +-----------------
 xen/arch/x86/pv/mm.h | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 17 deletions(-)
 create mode 100644 xen/arch/x86/pv/mm.h

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 5208e73734..8d2a4682c9 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -127,6 +127,7 @@
 #include <asm/pv/grant_table.h>
 
 #include "pv/emulate.h"
+#include "pv/mm.h"
 
 /* Override macros from asm/page.h to make them work with mfn_t */
 #undef mfn_to_page
@@ -563,23 +564,6 @@ static l1_pgentry_t *map_guest_l1e(unsigned long linear, 
mfn_t *gl1mfn)
     return (l1_pgentry_t *)map_domain_page(*gl1mfn) + l1_table_offset(linear);
 }
 
-/* Read a PV guest's l1e that maps this linear address. */
-static l1_pgentry_t guest_get_eff_l1e(unsigned long linear)
-{
-    l1_pgentry_t l1e;
-
-    ASSERT(!paging_mode_translate(current->domain));
-    ASSERT(!paging_mode_external(current->domain));
-
-    if ( unlikely(!__addr_ok(linear)) ||
-         __copy_from_user(&l1e,
-                          &__linear_l1_table[l1_linear_offset(linear)],
-                          sizeof(l1_pgentry_t)) )
-        l1e = l1e_empty();
-
-    return l1e;
-}
-
 /*
  * Read the guest's l1e that maps this address, from the kernel-mode
  * page tables.
diff --git a/xen/arch/x86/pv/mm.h b/xen/arch/x86/pv/mm.h
new file mode 100644
index 0000000000..5b5dbff433
--- /dev/null
+++ b/xen/arch/x86/pv/mm.h
@@ -0,0 +1,21 @@
+#ifndef __PV_MM_H__
+#define __PV_MM_H__
+
+/* Read a PV guest's l1e that maps this linear address. */
+static inline l1_pgentry_t guest_get_eff_l1e(unsigned long linear)
+{
+    l1_pgentry_t l1e;
+
+    ASSERT(!paging_mode_translate(current->domain));
+    ASSERT(!paging_mode_external(current->domain));
+
+    if ( unlikely(!__addr_ok(linear)) ||
+         __copy_from_user(&l1e,
+                          &__linear_l1_table[l1_linear_offset(linear)],
+                          sizeof(l1_pgentry_t)) )
+        l1e = l1e_empty();
+
+    return l1e;
+}
+
+#endif /* __PV_MM_H__ */
-- 
2.11.0


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

 


Rackspace

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