uvm_pmap.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /* $OpenBSD: uvm_pmap.h,v 1.24 2015/02/15 21:34:33 miod Exp $ */
  2. /* $NetBSD: uvm_pmap.h,v 1.1 2000/06/27 09:00:14 mrg Exp $ */
  3. /*
  4. * Copyright (c) 1991, 1993
  5. * The Regents of the University of California. All rights reserved.
  6. *
  7. * This code is derived from software contributed to Berkeley by
  8. * The Mach Operating System project at Carnegie-Mellon University.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in the
  17. * documentation and/or other materials provided with the distribution.
  18. * 3. Neither the name of the University nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  23. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  28. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  29. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  31. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  32. * SUCH DAMAGE.
  33. *
  34. * @(#)pmap.h 8.1 (Berkeley) 6/11/93
  35. *
  36. *
  37. * Copyright (c) 1987, 1990 Carnegie-Mellon University.
  38. * All rights reserved.
  39. *
  40. * Author: Avadis Tevanian, Jr.
  41. *
  42. * Permission to use, copy, modify and distribute this software and
  43. * its documentation is hereby granted, provided that both the copyright
  44. * notice and this permission notice appear in all copies of the
  45. * software, derivative works or modified versions, and any portions
  46. * thereof, and that both notices appear in supporting documentation.
  47. *
  48. * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  49. * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
  50. * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  51. *
  52. * Carnegie Mellon requests users of this software to return to
  53. *
  54. * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
  55. * School of Computer Science
  56. * Carnegie Mellon University
  57. * Pittsburgh PA 15213-3890
  58. *
  59. * any improvements or extensions that they make and grant Carnegie the
  60. * rights to redistribute these changes.
  61. */
  62. /*
  63. * Machine address mapping definitions -- machine-independent
  64. * section. [For machine-dependent section, see "machine/pmap.h".]
  65. */
  66. #ifndef _PMAP_VM_
  67. #define _PMAP_VM_
  68. struct proc; /* for pmap_activate()/pmap_deactivate() proto */
  69. /*
  70. * Each machine dependent implementation is expected to
  71. * keep certain statistics. They may do this anyway they
  72. * so choose, but are expected to return the statistics
  73. * in the following structure.
  74. */
  75. struct pmap_statistics {
  76. long resident_count; /* # of pages mapped (total)*/
  77. long wired_count; /* # of pages wired */
  78. };
  79. typedef struct pmap_statistics *pmap_statistics_t;
  80. #include <machine/pmap.h>
  81. /*
  82. * Flags passed to pmap_enter(). Note the bottom 3 bits are PROT_*
  83. * bits, used to indicate the access type that was made (to seed modified
  84. * and referenced information).
  85. */
  86. #define PMAP_WIRED 0x00000010 /* wired mapping */
  87. #define PMAP_CANFAIL 0x00000020 /* can fail if resource shortage */
  88. #define PMAP_MD0 0x00000040 /* Machine dependant */
  89. #define PMAP_MD1 0x00000080 /* Machine dependant */
  90. #define PMAP_MD2 0x00000100 /* Machine dependant */
  91. #define PMAP_MD3 0x00000200 /* Machine dependant */
  92. #ifndef PMAP_EXCLUDE_DECLS /* Used in Sparc port to virtualize pmap mod */
  93. #ifdef _KERNEL
  94. __BEGIN_DECLS
  95. #ifndef pmap_activate
  96. void pmap_activate(struct proc *);
  97. #endif
  98. #ifndef pmap_deactivate
  99. void pmap_deactivate(struct proc *);
  100. #endif
  101. #ifndef pmap_unwire
  102. void pmap_unwire(pmap_t, vaddr_t);
  103. #endif
  104. #if !defined(pmap_clear_modify)
  105. boolean_t pmap_clear_modify(struct vm_page *);
  106. #endif
  107. #if !defined(pmap_clear_reference)
  108. boolean_t pmap_clear_reference(struct vm_page *);
  109. #endif
  110. #if !defined(pmap_collect)
  111. void pmap_collect(pmap_t);
  112. #endif
  113. #if !defined(pmap_copy)
  114. void pmap_copy(pmap_t, pmap_t, vaddr_t, vsize_t, vaddr_t);
  115. #endif
  116. #if !defined(pmap_copy_page)
  117. void pmap_copy_page(struct vm_page *, struct vm_page *);
  118. #endif
  119. struct pmap *pmap_create(void);
  120. void pmap_destroy(pmap_t);
  121. int pmap_enter(pmap_t,
  122. vaddr_t, paddr_t, vm_prot_t, int);
  123. boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
  124. #if defined(PMAP_GROWKERNEL)
  125. vaddr_t pmap_growkernel(vaddr_t);
  126. #endif
  127. void pmap_init(void);
  128. void pmap_kenter_pa(vaddr_t, paddr_t, vm_prot_t);
  129. void pmap_kremove(vaddr_t, vsize_t);
  130. #if !defined(pmap_is_modified)
  131. boolean_t pmap_is_modified(struct vm_page *);
  132. #endif
  133. #if !defined(pmap_is_referenced)
  134. boolean_t pmap_is_referenced(struct vm_page *);
  135. #endif
  136. void pmap_page_protect(struct vm_page *, vm_prot_t);
  137. #if !defined(pmap_proc_iflush)
  138. void pmap_proc_iflush(struct proc *, vaddr_t, vsize_t);
  139. #endif
  140. void pmap_protect(pmap_t, vaddr_t, vaddr_t, vm_prot_t);
  141. #if !defined(pmap_reference)
  142. void pmap_reference(pmap_t);
  143. #endif
  144. #if !defined(pmap_remove)
  145. void pmap_remove(pmap_t, vaddr_t, vaddr_t);
  146. #endif
  147. #if !defined(pmap_remove_holes)
  148. void pmap_remove_holes(struct vmspace *);
  149. #endif
  150. #if !defined(pmap_update)
  151. void pmap_update(pmap_t);
  152. #endif
  153. #if !defined(pmap_zero_page)
  154. void pmap_zero_page(struct vm_page *);
  155. #endif
  156. void pmap_virtual_space(vaddr_t *, vaddr_t *);
  157. #if defined(PMAP_STEAL_MEMORY)
  158. vaddr_t pmap_steal_memory(vsize_t, vaddr_t *, vaddr_t *);
  159. #endif
  160. #if defined(PMAP_FORK)
  161. void pmap_fork(pmap_t, pmap_t);
  162. #endif
  163. __END_DECLS
  164. #endif /* kernel*/
  165. #endif /* PMAP_EXCLUDE_DECLS */
  166. #endif /* _PMAP_VM_ */