mm.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* include/kernel/mm.h
  2. *
  3. * This file is part of evx.
  4. *
  5. * evx is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * evx is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with evx. If not, see <https://www.gnu.org/licenses/>
  17. */
  18. #ifndef __MM_H
  19. #define __MM_H
  20. #ifndef __ASSEMBLER__
  21. #include <sys/types.h>
  22. #include <arch/archinfo.h>
  23. /* a descriptor for each page to describe a page, hopely be smallest
  24. * and this is create only for the buddy memory management system. we
  25. * can't implement that without this, because we need more memory when
  26. * inserting.
  27. *
  28. *
  29. * we should initiallize this as late as we can, after maps okay.
  30. * */
  31. struct page {
  32. /* number of this page */
  33. __archptr_t pnr;
  34. /* for cow, the reference count. we won't free if count-- */
  35. __uint32_t count;
  36. struct page *next;
  37. };
  38. /* okay, that's may only in the x86, but... */
  39. struct zone {
  40. __uint32_t total_pages;
  41. #define ZONETYPE_RAM 1
  42. #define ZONETYPE_OTHER 2
  43. __uint32_t type;
  44. void *start_addr;
  45. struct page *pages;
  46. };
  47. #define kmem_zones ((struct zone *) &_end)
  48. #define kmem_pages
  49. #endif
  50. #endif