rset.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (c) 2024 Agustina Arzille.
  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 as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. *
  18. * Reverse sets.
  19. *
  20. * These sets contain all the virtual -> physical translations that
  21. * exist for a specific page. They allow users to know whether a page
  22. * is dirty or has been recently accesed, for instance.
  23. */
  24. #ifndef VM_RSET_H
  25. #define VM_RSET_H
  26. #include <stdint.h>
  27. #include <kern/init.h>
  28. #include <kern/slist_types.h>
  29. #include <kern/work.h>
  30. struct vm_rset_entry
  31. {
  32. struct slist_node link;
  33. struct work work;
  34. void *pte;
  35. uintptr_t va;
  36. uint32_t cpu;
  37. };
  38. struct vm_page;
  39. // Link a page to a PTE.
  40. int vm_rset_page_link (struct vm_page *page, void *pte,
  41. uintptr_t va, uint32_t cpu);
  42. /*
  43. * Remove an RSET entry corresponding to a PTE.
  44. * The caller is responsible for any locking.
  45. */
  46. void vm_rset_del (struct vm_page *page, void *pte);
  47. // Mark an RSET - and therefore the page - as read-only.
  48. void vm_rset_mark_ro (struct vm_page *page);
  49. /*
  50. * This init operation provides :
  51. * - module fully initialized
  52. */
  53. INIT_OP_DECLARE (vm_rset_setup);
  54. #endif