enclave_ocalls.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * This is for enclave to make ocalls to untrusted runtime.
  3. */
  4. #include "pal_linux.h"
  5. #include <asm/stat.h>
  6. #include <linux/socket.h>
  7. #include <linux/poll.h>
  8. #include <sys/types.h>
  9. noreturn void ocall_exit (int exitcode, int is_exitgroup);
  10. int ocall_mmap_untrusted (int fd, uint64_t offset,
  11. uint64_t size, unsigned short prot,
  12. void ** mem);
  13. int ocall_munmap_untrusted (const void * mem, uint64_t size);
  14. int ocall_cpuid (unsigned int leaf, unsigned int subleaf,
  15. unsigned int values[4]);
  16. int ocall_open (const char * pathname, int flags, unsigned short mode);
  17. int ocall_close (int fd);
  18. int ocall_read (int fd, void * buf, unsigned int count);
  19. int ocall_write (int fd, const void * buf, unsigned int count);
  20. ssize_t ocall_pread(int fd, void* buf, size_t count, off_t offset);
  21. ssize_t ocall_pwrite(int fd, const void* buf, size_t count, off_t offset);
  22. int ocall_fstat (int fd, struct stat * buf);
  23. int ocall_fionread (int fd);
  24. int ocall_fsetnonblock (int fd, int nonblocking);
  25. int ocall_fchmod (int fd, unsigned short mode);
  26. int ocall_fsync (int fd);
  27. int ocall_ftruncate (int fd, uint64_t length);
  28. int ocall_mkdir (const char *pathname, unsigned short mode);
  29. int ocall_getdents (int fd, struct linux_dirent64 *dirp, unsigned int size);
  30. int ocall_listen(int domain, int type, int protocol, int ipv6_v6only,
  31. struct sockaddr* addr, unsigned int* addrlen, struct sockopt* sockopt);
  32. int ocall_accept (int sockfd, struct sockaddr * addr,
  33. unsigned int * addrlen, struct sockopt * opt);
  34. int ocall_connect(int domain, int type, int protocol, int ipv6_v6only,
  35. const struct sockaddr* addr, unsigned int addrlen,
  36. struct sockaddr* bind_addr, unsigned int* bind_addrlen,
  37. struct sockopt* sockopt);
  38. int ocall_recv (int sockfd, void * buf, unsigned int count,
  39. struct sockaddr * addr, unsigned int * addrlenptr,
  40. void * control, uint64_t * controllenptr);
  41. int ocall_send (int sockfd, const void * buf, unsigned int count,
  42. const struct sockaddr * addr, unsigned int addrlen,
  43. void * control, uint64_t controllen);
  44. int ocall_setsockopt (int sockfd, int level, int optname,
  45. const void * optval, unsigned int optlen);
  46. int ocall_shutdown (int sockfd, int how);
  47. int ocall_resume_thread (void * tcs);
  48. int ocall_clone_thread (void);
  49. int ocall_create_process(const char* uri, int nargs, const char** args, int* stream_fd,
  50. int* cargo_fd, unsigned int* pid);
  51. int ocall_futex(int* uaddr, int op, int val, int64_t timeout_us);
  52. int ocall_gettime (unsigned long * microsec);
  53. int ocall_sleep (unsigned long * microsec);
  54. int ocall_socketpair (int domain, int type, int protocol, int sockfds[2]);
  55. int ocall_poll(struct pollfd* fds, int nfds, int64_t timeout_us);
  56. int ocall_rename (const char * oldpath, const char * newpath);
  57. int ocall_delete (const char * pathname);
  58. int ocall_load_debug (const char * command);
  59. int ocall_get_attestation(const sgx_spid_t* spid, const char* subkey, bool linkable,
  60. const sgx_report_t* report, const sgx_quote_nonce_t* nonce,
  61. sgx_attestation_t* attestation);
  62. int ocall_eventfd (unsigned int initval, int flags);