pgtable_32.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. /*
  29. * Define this if things work differently on an i386 and an i486:
  30. * it will (on an i486) warn about kernel memory accesses that are
  31. * done without a 'access_ok(VERIFY_WRITE,..)'
  32. */
  33. #undef TEST_ACCESS_OK
  34. #ifdef CONFIG_X86_PAE
  35. # include <asm/pgtable-3level.h>
  36. #else
  37. # include <asm/pgtable-2level.h>
  38. #endif
  39. #if defined(CONFIG_HIGHPTE)
  40. #define pte_offset_map(dir, address) \
  41. ((pte_t *)kmap_atomic(pmd_page(*(dir))) + \
  42. pte_index((address)))
  43. #define pte_unmap(pte) kunmap_atomic((pte))
  44. #else
  45. #define pte_offset_map(dir, address) \
  46. ((pte_t *)page_address(pmd_page(*(dir))) + pte_index((address)))
  47. #define pte_unmap(pte) do { } while (0)
  48. #endif
  49. /* Clear a kernel PTE and flush it from the TLB */
  50. #define kpte_clear_flush(ptep, vaddr) \
  51. do { \
  52. pte_clear(&init_mm, (vaddr), (ptep)); \
  53. __flush_tlb_one((vaddr)); \
  54. } while (0)
  55. #endif /* !__ASSEMBLY__ */
  56. /*
  57. * kern_addr_valid() is (1) for FLATMEM and (0) for
  58. * SPARSEMEM and DISCONTIGMEM
  59. */
  60. #ifdef CONFIG_FLATMEM
  61. #define kern_addr_valid(addr) (1)
  62. #else
  63. #define kern_addr_valid(kaddr) (0)
  64. #endif
  65. #endif /* _ASM_X86_PGTABLE_32_H */