#define __HAVE_ARCH_PTEP_SET_WRPROTECT
#define __HAVE_ARCH_PTE_SAME
#define __HAVE_ARCH_PGD_OFFSET_GATE
+
+/*
+ * Override for pgd_addr_end() to deal with the virtual address space holes
+ * in each region. Virtual address bits are used like this:
+ * +--------+------+--------+-----+-----+--------+
+ * | pgdhi3 | rsvd | pgdlow | pmd | pte | offset |
+ * +--------+------+--------+-----+-----+--------+
+ * The high bit of 'pgdlow' must be sign extended across the 'rsvd' bits.
+ */
+#define IA64_PGD_SIGNEXTEND (PGDIR_SIZE << (PAGE_SHIFT-7))
+#define pgd_addr_end(addr, end) \
+({ unsigned long __boundary = ((addr) + PGDIR_SIZE) & PGDIR_MASK; \
+ if (__boundary & IA64_PGD_SIGNEXTEND) \
+ __boundary |= (RGN_SIZE - 1) & ~(IA64_PGD_SIGNEXTEND-1);\
+ (__boundary - 1 < (end) - 1)? __boundary: (end); \
+})
+
#include <asm-generic/pgtable-nopud.h>
#include <asm-generic/pgtable.h>