enclave_ocalls.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /* -*- mode:c; c-file-style:"k&r"; c-basic-offset: 4; tab-width:4; indent-tabs-mode:nil; mode:auto-fill; fill-column:78; -*- */
  2. /* vim: set ts=4 sw=4 et tw=78 fo=cqt wm=0: */
  3. /*
  4. * This is for enclave to make ocalls to untrusted runtime.
  5. */
  6. #include "pal_linux.h"
  7. #include <asm/stat.h>
  8. #include <linux/socket.h>
  9. #include <linux/poll.h>
  10. int ocall_exit (void);
  11. int ocall_print_string (const char * str, unsigned int length);
  12. int ocall_alloc_untrusted (unsigned int size, void ** mem);
  13. int ocall_map_untrusted (int fd, uint64_t offset,
  14. uint64_t size, unsigned short prot,
  15. void ** mem);
  16. int ocall_unmap_untrusted (const void * mem, uint64_t size);
  17. int ocall_cpuid (unsigned int leaf, unsigned int subleaf,
  18. unsigned int values[4]);
  19. int ocall_open (const char * pathname, int flags, unsigned short mode);
  20. int ocall_close (int fd);
  21. int ocall_read (int fd, void * buf, unsigned int count);
  22. int ocall_write (int fd, const void * buf, unsigned int count);
  23. int ocall_fstat (int fd, struct stat * buf);
  24. int ocall_stat (const char * path, struct stat * buf);
  25. int ocall_fionread (int fd);
  26. int ocall_fsetnonblock (int fd, int nonblocking);
  27. int ocall_fchmod (int fd, unsigned short mode);
  28. int ocall_fsync (int fd);
  29. int ocall_ftruncate (int fd, unsigned int length);
  30. int ocall_mkdir (const char *pathname, unsigned short mode);
  31. int ocall_getdents (int fd, struct linux_dirent64 *dirp, unsigned int size);
  32. int ocall_sock_listen (int domain, int type, int protocol,
  33. const struct sockaddr * addr, unsigned int addrlen,
  34. struct sockopt * opt);
  35. int ocall_sock_accept (int sockfd, struct sockaddr * addr,
  36. unsigned int * addrlen, struct sockopt * opt);
  37. int ocall_sock_connect (int domain, int type, int protocol,
  38. const struct sockaddr * addr, unsigned int addrlen,
  39. struct sockaddr * connaddr,
  40. unsigned int * connaddrlen, struct sockopt * opt);
  41. int ocall_sock_recv (int sockfd, void * buf, unsigned int count,
  42. struct sockaddr * addr, unsigned int * addrlen);
  43. int ocall_sock_send (int sockfd, const void * buf, unsigned int count,
  44. const struct sockaddr * addr, unsigned int addrlen);
  45. int ocall_sock_recv_fd (int sockfd, void * buf, unsigned int count,
  46. unsigned int * fds, unsigned int * nfds);
  47. int ocall_sock_send_fd (int sockfd, const void * buf, unsigned int count,
  48. const unsigned int * fds, unsigned int nfds);
  49. int ocall_sock_setopt (int sockfd, int level, int optname,
  50. const void * optval, unsigned int optlen);
  51. int ocall_sock_shutdown (int sockfd, int how);
  52. int ocall_wake_thread (void * tcs);
  53. int ocall_create_process (const char * uri,
  54. int nargs, const char ** args,
  55. int procfds[3],
  56. unsigned int * pid);
  57. int ocall_futex (int * uaddr, int op, int val, const uint64_t * timeout);
  58. int ocall_gettime (unsigned long * microsec);
  59. int ocall_sleep (unsigned long * microsec);
  60. int ocall_socketpair (int domain, int type, int protocol, int sockfds[2]);
  61. int ocall_poll (struct pollfd * fds, int nfds, uint64_t * timeout);
  62. int ocall_rename (const char * oldpath, const char * newpath);
  63. int ocall_delete (const char * pathname);
  64. int ocall_load_debug (const char * command);