vm_external.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * Mach Operating System
  3. * Copyright (c) 1991,1990,1989 Carnegie Mellon University
  4. * All Rights Reserved.
  5. *
  6. * Permission to use, copy, modify and distribute this software and its
  7. * documentation is hereby granted, provided that both the copyright
  8. * notice and this permission notice appear in all copies of the
  9. * software, derivative works or modified versions, and any portions
  10. * thereof, and that both notices appear in supporting documentation.
  11. *
  12. * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13. * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14. * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15. *
  16. * Carnegie Mellon requests users of this software to return to
  17. *
  18. * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
  19. * School of Computer Science
  20. * Carnegie Mellon University
  21. * Pittsburgh PA 15213-3890
  22. *
  23. * any improvements or extensions that they make and grant Carnegie Mellon
  24. * the rights to redistribute these changes.
  25. */
  26. #ifndef _VM_VM_EXTERNAL_H_
  27. #define _VM_VM_EXTERNAL_H_
  28. /*
  29. * External page management hint technology
  30. *
  31. * The data structure exported by this module maintains
  32. * a (potentially incomplete) map of the pages written
  33. * to external storage for a range of virtual memory.
  34. */
  35. /*
  36. * The data structure representing the state of pages
  37. * on external storage.
  38. */
  39. typedef struct vm_external {
  40. int existence_size; /* Size of the following bitmap */
  41. char *existence_map; /* A bitmap of pages that have
  42. * been written to backing
  43. * storage.
  44. */
  45. #if 0
  46. /* XXX: Currently, existence_count is not used. I guess it
  47. could be useful to get rid of the map if the count drops to
  48. zero. */
  49. int existence_count;/* Number of bits turned on in
  50. * existence_map.
  51. */
  52. #endif
  53. } *vm_external_t;
  54. #define VM_EXTERNAL_NULL ((vm_external_t) 0)
  55. #define VM_EXTERNAL_SMALL_SIZE 128
  56. #define VM_EXTERNAL_LARGE_SIZE 8192
  57. /*
  58. * The states that may be recorded for a page of external storage.
  59. */
  60. typedef int vm_external_state_t;
  61. #define VM_EXTERNAL_STATE_EXISTS 1
  62. #define VM_EXTERNAL_STATE_UNKNOWN 2
  63. #define VM_EXTERNAL_STATE_ABSENT 3
  64. /*
  65. * Routines exported by this module.
  66. */
  67. /* Initialize the module */
  68. extern void vm_external_module_initialize(void);
  69. /* Create a vm_external_t */
  70. extern vm_external_t vm_external_create(vm_offset_t);
  71. /* Destroy one */
  72. extern void vm_external_destroy(vm_external_t);
  73. /* Set state of a page. */
  74. extern void vm_external_state_set(vm_external_t, vm_offset_t,
  75. vm_external_state_t);
  76. /* Retrieve the state for a given page, if known. */
  77. #define vm_external_state_get(e,offset) (((e) != VM_EXTERNAL_NULL) ? \
  78. _vm_external_state_get(e, offset) : \
  79. VM_EXTERNAL_STATE_UNKNOWN)
  80. /* HIDDEN routine */
  81. extern vm_external_state_t _vm_external_state_get(vm_external_t, vm_offset_t);
  82. #endif /* _VM_VM_EXTERNAL_H_ */