mach-init.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* -*-comment-start: "//";comment-end:""-*-
  2. * GNU Mes --- Maxwell Equations of Software
  3. * Copyright © 1993-2016 Free Software Foundation, Inc.
  4. * Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  5. *
  6. * This file is part of GNU Mes.
  7. *
  8. * GNU Mes is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 3 of the License, or (at
  11. * your option) any later version.
  12. *
  13. * GNU Mes is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. /** Commentary:
  22. Taken from GNU C Library
  23. Declarations and macros for the basic Mach things set at startup.
  24. */
  25. #ifndef _MACH_INIT_H
  26. #define _MACH_INIT_H 1
  27. #include <mach/mach_types.h>
  28. /* Return the current task's task port. */
  29. extern mach_port_t mach_task_self (void);
  30. extern mach_port_t mach_host_self (void);
  31. /* Kernel page size. */
  32. extern vm_size_t __vm_page_size;
  33. extern vm_size_t vm_page_size;
  34. /* Round the address X up to a page boundary. */
  35. #define round_page(x) \
  36. ((((vm_offset_t) (x) + __vm_page_size - 1) / __vm_page_size) * \
  37. __vm_page_size)
  38. /* Truncate the address X down to a page boundary. */
  39. #define trunc_page(x) \
  40. ((((vm_offset_t) (x)) / __vm_page_size) * __vm_page_size)
  41. #endif /* mach_init.h */