pgtable_32.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef _ASM_X86_PGTABLE_32_H
  2. #define _ASM_X86_PGTABLE_32_H
  3. #include <asm/pgtable_32_types.h>
  4. /*
  5. * The Linux memory management assumes a three-level page table setup. On
  6. * the i386, we use that, but "fold" the mid level into the top-level page
  7. * table, so that we physically have the same two-level page table as the
  8. * i386 mmu expects.
  9. *
  10. * This file contains the functions and defines necessary to modify and use
  11. * the i386 page table tree.
  12. */
  13. #ifndef __ASSEMBLY__
  14. #include <asm/processor.h>
  15. #include <asm/fixmap.h>
  16. #include <linux/threads.h>
  17. #include <asm/paravirt.h>
  18. #include <linux/bitops.h>
  19. #include <linux/slab.h>
  20. #include <linux/list.h>
  21. #include <linux/spinlock.h>
  22. struct mm_struct;
  23. struct vm_area_struct;
  24. extern pgd_t swapper_pg_dir[1024];
  25. static inline void pgtable_cache_init(void) { }
  26. static inline void check_pgt_cache(void) { }
  27. void paging_init(void);
  28. extern void set_pmd_pfn(unsigned long, unsigned long, pgprot_t);
  29. /*
  30. * Define this if things work differently on an i386 and an i486:
  31. * it will (on an i486) warn about kernel memory accesses that are
  32. * done without a 'access_ok(VERIFY_WRITE,..)'
  33. */
  34. #undef TEST_ACCESS_OK
  35. /* The boot page tables (all created as a single array) */
  36. extern unsigned long pg0[];
  37. #ifdef CONFIG_X86_PAE
  38. # include <asm/pgtable-3level.h>
  39. #else
  40. # include <asm/pgtable-2level.h>
  41. #endif
  42. #if defined(CONFIG_HIGHPTE)
  43. #define pte_offset_map(dir, address) \
  44. ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), KM_PTE0) + \
  45. pte_index((address)))
  46. #define pte_offset_map_nested(dir, address) \
  47. ((pte_t *)kmap_atomic_pte(pmd_page(*(dir)), KM_PTE1) + \
  48. pte_index((address)))
  49. #define pte_unmap(pte) kunmap_atomic((pte), KM_PTE0)
  50. #define pte_unmap_nested(pte) kunmap_atomic((pte), KM_PTE1)
  51. #else
  52. #define pte_offset_map(dir, address) \
  53. ((pte_t *)page_address(pmd_page(*(dir))) + pte_index((address)))
  54. #define pte_offset_map_nested(dir, address) pte_offset_map((dir), (address))
  55. #define pte_unmap(pte) do { } while (0)
  56. #define pte_unmap_nested(pte) do { } while (0)
  57. #endif
  58. /* Clear a kernel PTE and flush it from the TLB */
  59. #define kpte_clear_flush(ptep, vaddr) \
  60. do { \
  61. pte_clear(&init_mm, (vaddr), (ptep)); \
  62. __flush_tlb_one((vaddr)); \
  63. } while (0)
  64. /*
  65. * The i386 doesn't have any external MMU info: the kernel page
  66. * tables contain all the necessary information.
  67. */
  68. #define update_mmu_cache(vma, address, pte) do { } while (0)
  69. #endif /* !__ASSEMBLY__ */
  70. /*
  71. * kern_addr_valid() is (1) for FLATMEM and (0) for
  72. * SPARSEMEM and DISCONTIGMEM
  73. */
  74. #ifdef CONFIG_FLATMEM
  75. #define kern_addr_valid(addr) (1)
  76. #else
  77. #define kern_addr_valid(kaddr) (0)
  78. #endif
  79. #endif /* _ASM_X86_PGTABLE_32_H */