@@ -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.
new file mode 100644
@@ -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__ */
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@citrix.com> --- 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