pal_host.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* Copyright (C) 2014 Stony Brook University
  2. This file is part of Graphene Library OS.
  3. Graphene Library OS is free software: you can redistribute it and/or
  4. modify it under the terms of the GNU Lesser General Public License
  5. as published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. Graphene Library OS is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Lesser General Public License for more details.
  11. You should have received a copy of the GNU Lesser General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  13. /*
  14. * pal_host.h
  15. *
  16. * This file contains definition of PAL host ABI.
  17. */
  18. #ifndef PAL_HOST_H
  19. #define PAL_HOST_H
  20. #ifndef IN_PAL
  21. # error "cannot be included outside PAL"
  22. #endif
  23. typedef struct mutex_handle {
  24. int unused;
  25. } PAL_LOCK;
  26. #define LOCK_INIT {}
  27. #define INIT_LOCK(lock) do {} while (0)
  28. #define MAX_FDS 3
  29. typedef struct pal_handle
  30. {
  31. /* TSAI: Here we define the internal types of PAL_HANDLE
  32. * in PAL design, user has not to access the content inside the
  33. * handle, also there is no need to allocate the internal
  34. * handles, so we hide the type name of these handles on purpose.
  35. */
  36. PAL_HDR hdr;
  37. union {
  38. struct {
  39. PAL_IDX fds[MAX_FDS];
  40. } generic;
  41. /* DP: Here we just define a placeholder fd; place your details here.
  42. * Not every type requires an fd either - this is up to your
  43. * host-specific code.
  44. */
  45. struct {
  46. PAL_IDX fd;
  47. } file;
  48. struct {
  49. PAL_IDX fd;
  50. } pipe;
  51. struct {
  52. PAL_IDX fd;
  53. } pipeprv;
  54. struct {
  55. PAL_IDX fd;
  56. PAL_IDX dev_type;
  57. } dev;
  58. struct {
  59. PAL_IDX fd;
  60. } dir;
  61. struct {
  62. PAL_IDX fd;
  63. } gipc;
  64. struct {
  65. PAL_IDX fd;
  66. } sock;
  67. struct {
  68. PAL_IDX unused;
  69. } process;
  70. struct {
  71. PAL_IDX unused;
  72. } mcast;
  73. struct {
  74. PAL_IDX unused;
  75. } thread;
  76. struct {
  77. PAL_IDX fd;
  78. } mutex;
  79. struct {
  80. PAL_IDX fd;
  81. } event;
  82. };
  83. } * PAL_HANDLE;
  84. #endif /* PAL_HOST_H */