xen-devel
[Xen-devel] [PATCH 10 of 36] x86: unify pgd_index
pgd_index is common for 32 and 64-bit, so move it to a common place.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
---
include/asm-x86/pgtable.h | 20 ++++++++++++++++++++
include/asm-x86/pgtable_32.h | 20 --------------------
include/asm-x86/pgtable_64.h | 3 ---
3 files changed, 20 insertions(+), 23 deletions(-)
diff --git a/include/asm-x86/pgtable.h b/include/asm-x86/pgtable.h
--- a/include/asm-x86/pgtable.h
+++ b/include/asm-x86/pgtable.h
@@ -357,6 +357,26 @@
# include "pgtable_64.h"
#endif
+/*
+ * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD]
+ *
+ * this macro returns the index of the entry in the pgd page which would
+ * control the given virtual address
+ */
+#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
+
+/*
+ * pgd_offset() returns a (pgd_t *)
+ * pgd_index() is used get the offset into the pgd page's array of pgd_t's;
+ */
+#define pgd_offset(mm, address) ((mm)->pgd + pgd_index((address)))
+/*
+ * a shortcut which implies the use of the kernel's pgd, instead
+ * of a process's
+ */
+#define pgd_offset_k(address) pgd_offset(&init_mm, (address))
+
+
#define KERNEL_PGD_BOUNDARY pgd_index(PAGE_OFFSET)
#define KERNEL_PGD_PTRS (PTRS_PER_PGD - KERNEL_PGD_BOUNDARY)
diff --git a/include/asm-x86/pgtable_32.h b/include/asm-x86/pgtable_32.h
--- a/include/asm-x86/pgtable_32.h
+++ b/include/asm-x86/pgtable_32.h
@@ -119,26 +119,6 @@
*/
#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
-/*
- * the pgd page can be thought of an array like this: pgd_t[PTRS_PER_PGD]
- *
- * this macro returns the index of the entry in the pgd page which would
- * control the given virtual address
- */
-#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
-#define pgd_index_k(addr) pgd_index((addr))
-
-/*
- * pgd_offset() returns a (pgd_t *)
- * pgd_index() is used get the offset into the pgd page's array of pgd_t's;
- */
-#define pgd_offset(mm, address) ((mm)->pgd + pgd_index((address)))
-
-/*
- * a shortcut which implies the use of the kernel's pgd, instead
- * of a process's
- */
-#define pgd_offset_k(address) pgd_offset(&init_mm, (address))
static inline int pud_large(pud_t pud) { return 0; }
diff --git a/include/asm-x86/pgtable_64.h b/include/asm-x86/pgtable_64.h
--- a/include/asm-x86/pgtable_64.h
+++ b/include/asm-x86/pgtable_64.h
@@ -196,9 +196,6 @@
#define pgd_page_vaddr(pgd) \
((unsigned long)__va((unsigned long)pgd_val((pgd)) & PTE_MASK))
#define pgd_page(pgd) (pfn_to_page(pgd_val((pgd)) >> PAGE_SHIFT))
-#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD - 1))
-#define pgd_offset(mm, address) ((mm)->pgd + pgd_index((address)))
-#define pgd_offset_k(address) (init_level4_pgt + pgd_index((address)))
#define pgd_present(pgd) (pgd_val(pgd) & _PAGE_PRESENT)
static inline int pgd_large(pgd_t pgd) { return 0; }
#define mk_kernel_pgd(address) __pgd((address) | _KERNPG_TABLE)
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-devel] Re: [PATCH 03 of 36] x86: add memory barriers to wrmsr, (continued)
[Xen-devel] [PATCH 02 of 36] x86: add memory clobber to save/loadsegment, Jeremy Fitzhardinge
[Xen-devel] [PATCH 01 of 36] x86: asm-x86/pgtable.h: fix compiler warning, Jeremy Fitzhardinge
[Xen-devel] [PATCH 04 of 36] x86: remove open-coded save/load segment operations, Jeremy Fitzhardinge
[Xen-devel] [PATCH 09 of 36] x86_64: Use __pgd() on mk_kernel_pgd(), Jeremy Fitzhardinge
[Xen-devel] [PATCH 08 of 36] x86_64: Add gate_offset() and gate_segment() macros, Jeremy Fitzhardinge
[Xen-devel] [PATCH 07 of 36] x86_64: unify early_ioremap, Jeremy Fitzhardinge
[Xen-devel] [PATCH 06 of 36] x86_64: use p??_populate() to attach pages to pagetable, Jeremy Fitzhardinge
[Xen-devel] [PATCH 13 of 36] x86_64: add prototype for x86_64_start_kernel(), Jeremy Fitzhardinge
[Xen-devel] [PATCH 11 of 36] x86: unify mmu_context.h, Jeremy Fitzhardinge
[Xen-devel] [PATCH 10 of 36] x86: unify pgd_index,
Jeremy Fitzhardinge <=
[Xen-devel] [PATCH 05 of 36] x86_64: use write_gdt_entry in vsyscall_set_cpu, Jeremy Fitzhardinge
[Xen-devel] [PATCH 12 of 36] x86_64: replace end_pfn with num_physpages, Jeremy Fitzhardinge
[Xen-devel] [PATCH 14 of 36] x86_64: add sync_cmpxchg, Jeremy Fitzhardinge
[Xen-devel] [PATCH 18 of 36] x86/paravirt: add debugging for missing operations, Jeremy Fitzhardinge
[Xen-devel] [PATCH 15 of 36] x86: simplify vmalloc_sync_all, Jeremy Fitzhardinge
[Xen-devel] [PATCH 17 of 36] x86: preallocate and prepopulate separately, Jeremy Fitzhardinge
[Xen-devel] [PATCH 16 of 36] x86/paravirt: add a pgd_alloc/free hooks, Jeremy Fitzhardinge
[Xen-devel] [PATCH 22 of 36] x86_64: split x86_64_start_kernel, Jeremy Fitzhardinge
[Xen-devel] [PATCH 21 of 36] x86-64: add FIX_PARAVIRT_BOOTMAP fixmap slot, Jeremy Fitzhardinge
[Xen-devel] [PATCH 20 of 36] paravirt/x86_64: move __PAGE_OFFSET to leave a space for hypervisor, Jeremy Fitzhardinge
|
|
|