hiddenDangerAnalysis.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* pgtable.h: FR-V page table mangling
  2. *
  3. * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
  4. * Written by David Howells (dhowells@redhat.com)
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. *
  11. * Derived from:
  12. * include/asm-m68knommu/pgtable.h
  13. * include/asm-i386/pgtable.h
  14. */
  15. #ifndef _ASM_PGTABLE_H
  16. #define _ASM_PGTABLE_H
  17. #include <asm/mem-layout.h>
  18. #include <asm/setup.h>
  19. #include <asm/processor.h>
  20. #ifndef __ASSEMBLY__
  21. #include <linux/threads.h>
  22. #include <linux/slab.h>
  23. #include <linux/list.h>
  24. #include <linux/spinlock.h>
  25. #include <linux/sched.h>
  26. struct vm_area_struct;
  27. #endif
  28. #ifndef __ASSEMBLY__
  29. #if defined(CONFIG_HIGHPTE)
  30. typedef unsigned long pte_addr_t;
  31. #else
  32. typedef pte_t *pte_addr_t;
  33. #endif
  34. #endif
  35. /*****************************************************************************/
  36. /*
  37. * MMU-less operation case first
  38. */
  39. #ifndef CONFIG_MMU
  40. #define pgd_present(pgd) (1) /* pages are always present on NO_MM */
  41. #define pgd_none(pgd) (0)
  42. #define pgd_bad(pgd) (0)
  43. #define pgd_clear(pgdp)
  44. #define kern_addr_valid(addr) (1)
  45. #define pmd_offset(a, b) ((void *) 0)
  46. #define PAGE_NONE __pgprot(0) /* these mean nothing to NO_MM */
  47. #define PAGE_SHARED __pgprot(0) /* these mean nothing to NO_MM */
  48. #define PAGE_COPY __pgprot(0) /* these mean nothing to NO_MM */
  49. #define PAGE_READONLY __pgprot(0) /* these mean nothing to NO_MM */
  50. #define PAGE_KERNEL __pgprot(0) /* these mean nothing to NO_MM */
  51. #define __swp_type(x) (0)
  52. #define __swp_offset(x) (0)
  53. #define __swp_entry(typ,off) ((swp_entry_t) { ((typ) | ((off) << 7)) })
  54. #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
  55. #define __swp_entry_to_pte(x) ((pte_t) { (x).val })
  56. #ifndef __ASSEMBLY__
  57. static inline int pte_file(pte_t pte) { return 0; }
  58. #endif
  59. #define ZERO_PAGE(vaddr) ({ BUG(); NULL; })
  60. #define swapper_pg_dir ((pgd_t *) NULL)
  61. #define pgtable_cache_init() do {} while (0)
  62. #include <asm-generic/pgtable.h>
  63. #else /* !CONFIG_MMU */
  64. /*****************************************************************************/
  65. /*
  66. * then MMU operation
  67. */
  68. /*
  69. * ZERO_PAGE is a global shared page that is always zero: used
  70. * for zero-mapped memory areas etc..
  71. */
  72. #ifndef __ASSEMBLY__
  73. extern unsigned long empty_zero_page;
  74. #define ZERO_PAGE(vaddr) virt_to_page(empty_zero_page)
  75. #endif
  76. /*
  77. * we use 2-level page tables, folding the PMD (mid-level table) into the PGE (top-level entry)
  78. * [see Documentation/frv/mmu-layout.txt]
  79. *
  80. * Page Directory:
  81. * - Size: 16KB
  82. * - 64 PGEs per PGD