memoryOperation.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * Copyright (C) 2004-2006 Atmel Corporation
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef __ASM_AVR32_PGTABLE_H
  9. #define __ASM_AVR32_PGTABLE_H
  10. #include <asm/addrspace.h>
  11. #ifndef __ASSEMBLY__
  12. #include <linux/sched.h>
  13. #endif /* !__ASSEMBLY__ */
  14. /*
  15. * Use two-level page tables just as the i386 (without PAE)
  16. */
  17. #include <asm/pgtable-2level.h>
  18. /*
  19. * The following code might need some cleanup when the values are
  20. * final...
  21. */
  22. #define PMD_SIZE (1UL << PMD_SHIFT)
  23. #define PMD_MASK (~(PMD_SIZE-1))
  24. #define PGDIR_SIZE (1UL << PGDIR_SHIFT)
  25. #define PGDIR_MASK (~(PGDIR_SIZE-1))
  26. #define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
  27. #define FIRST_USER_ADDRESS 0
  28. #ifndef __ASSEMBLY__
  29. extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
  30. extern void paging_init(void);
  31. /*
  32. * ZERO_PAGE is a global shared page that is always zero: used for
  33. * zero-mapped memory areas etc.
  34. */
  35. extern struct page *empty_zero_page;
  36. #define ZERO_PAGE(vaddr) (empty_zero_page)
  37. /*
  38. * Just any arbitrary offset to the start of the vmalloc VM area: the
  39. * current 8 MiB value just means that there will be a 8 MiB "hole"
  40. * after the uncached physical memory (P2 segment) until the vmalloc
  41. * area starts. That means that any out-of-bounds memory accesses will
  42. * hopefully be caught; we don't know if the end of the P1/P2 segments
  43. * are actually used for anything, but it is anyway safer to let the
  44. * MMU catch these kinds of errors than to rely on the memory bus.
  45. *
  46. * A "hole" of the same size is added to the end of the P3 segment as
  47. * well. It might seem wasteful to use 16 MiB of virtual address space
  48. * on this, but we do have 512 MiB of it...
  49. *
  50. * The vmalloc() routines leave a hole of 4 KiB between each vmalloced
  51. * area for the same reason.
  52. */
  53. #define VMALLOC_OFFSET (8 * 1024 * 1024)
  54. #define VMALLOC_START (P3SEG + VMALLOC_OFFSET)
  55. #define VMALLOC_END (P4SEG - VMALLOC_OFFSET)
  56. #endif /* !__ASSEMBLY__ */
  57. /*
  58. * Page flags. Some of these flags are not directly supported by
  59. * hardware, so we have to emulate them.
  60. */
  61. #define _TLBEHI_BIT_VALID 9
  62. #define _TLBEHI_VALID (1 << _TLBEHI_BIT_VALID)
  63. #define _PAGE_BIT_WT 0 /* W-bit : write-through */
  64. #define _PAGE_BIT_DIRTY 1 /* D-bit : page changed */
  65. #define _PAGE_BIT_SZ0 2 /* SZ0-bit : Size of page */
  66. #define _PAGE_BIT_SZ1 3 /* SZ1-bit : Size of page */
  67. #define _PAGE_BIT_EXECUTE 4 /* X-bit : execute access allowed */
  68. #define _PAGE_BIT_RW 5 /* AP0-bit : write access allowed */
  69. #define _PAGE_BIT_USER 6 /* AP1-bit : user space access allowed */
  70. #define _PAGE_BIT_BUFFER 7 /* B-bit : bufferable */
  71. #define _PAGE_BIT_GLOBAL 8 /* G-bit : global (ignore ASID) */
  72. #define _PAGE_BIT_CACHABLE 9 /* C-bit : cachable */
  73. /* If we drop support for 1K pages, we get two extra bits */
  74. #define _PAGE_BIT_PRESENT 10
  75. #define _PAGE_BIT_ACCESSED 11 /* software: page was accessed */
  76. /* The following flags are only valid when !PRESENT */
  77. #define _PAGE_BIT_FILE 0 /* software: pagecache or swap? */