pgtable_32.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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/list.h>
  20. #include <linux/spinlock.h>
  21. struct mm_struct;
  22. struct vm_area_struct;
  23. extern pgd_t swapper_pg_dir[1024];
  24. extern pgd_t initial_page_table[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. #ifdef CONFIG_X86_PAE
  36. # include <asm/pgtable-3level.h>
  37. #else
  38. # include <asm/pgtable-2level.h>
  39. #endif
  40. #if defined(CONFIG_HIGHPTE)
  41. #define pte_offset_map(dir, address) \
  42. ((pte_t *)kmap_atomic(pmd_page(*(dir))) + \
  43. pte_index((address)))
  44. #define pte_unmap(pte) kunmap_atomic((pte))
  45. #else
  46. #define pte_offset_map(dir, address) \
  47. ((pte_t *)page_address(pmd_page(*(dir))) + pte_index((address)))
  48. #define pte_unmap(pte) do { } while (0)
  49. #endif
  50. /* Clear a kernel PTE and flush it from the TLB */
  51. #define kpte_clear_flush(ptep, vaddr) \
  52. do { \
  53. pte_clear(&init_mm, (vaddr), (ptep)); \
  54. __flush_tlb_one((vaddr)); \
  55. } while (0)
  56. /*
  57. * The i386 doesn't have any external MMU info: the kernel page
  58. * tables contain all the necessary information.
  59. */
  60. #define update_mmu_cache(vma, address, ptep) do { } while (0)
  61. #endif /* !__ASSEMBLY__ */
  62. /*
  63. * kern_addr_valid() is (1) for FLATMEM and (0) for
  64. * SPARSEMEM and DISCONTIGMEM
  65. */
  66. #ifdef CONFIG_FLATMEM
  67. #define kern_addr_valid(addr) (1)
  68. #else
  69. #define kern_addr_valid(kaddr) (0)
  70. #endif
  71. #endif /* _ASM_X86_PGTABLE_32_H */