@@ -42,12 +42,22 @@
* (so 4K page can only have 1K entries: or 10 bits)
*/
#ifdef CONFIG_ARC_PAGE_SIZE_4K
+#ifdef CONFIG_ARC_HAS_PAE40
+/*
+ * For PAE40 and 4K page size set 10:9:12 Page Table
+ * (as with PAE40 4k page can only have 512 entries)
+ * Page Table can describe only 31-bit (2Gb) virtual space
+ */
+#define PGDIR_SHIFT 21
+#define ARC_VADDR_BITS 31
+#else
#define PGDIR_SHIFT 22
+#endif /* CONFIG_ARC_HAS_PAE40 */
#else
#define PGDIR_SHIFT 21
-#endif
+#endif /* CONFIG_ARC_PAGE_SIZE_4K */
-#endif
+#endif /* CONFIG_ARC_HUGEPAGE_16M */
#else /* CONFIG_PGTABLE_LEVELS != 2 */
@@ -67,9 +77,13 @@
#endif /* CONFIG_PGTABLE_LEVELS */
+#ifndef ARC_VADDR_BITS
+#define ARC_VADDR_BITS 32
+#endif
+
#define PGDIR_SIZE BIT(PGDIR_SHIFT)
#define PGDIR_MASK (~(PGDIR_SIZE - 1))
-#define PTRS_PER_PGD BIT(32 - PGDIR_SHIFT)
+#define PTRS_PER_PGD BIT(ARC_VADDR_BITS - PGDIR_SHIFT)
#if CONFIG_PGTABLE_LEVELS > 3
#define PUD_SIZE BIT(PUD_SHIFT)