xref: /drstd/src/std/os/fortanix_sgx/mod.rs (revision 0fe3ff0054d3aec7fbf9bddecfecb10bc7d23a51)
1 //! Functionality specific to the `x86_64-fortanix-unknown-sgx` target.
2 //!
3 //! This includes functions to deal with memory isolation, usercalls, and the
4 //! SGX instruction set.
5 
6 #![deny(missing_docs)]
7 
8 /// Low-level interfaces to usercalls. See the [ABI documentation] for more
9 /// information.
10 ///
11 /// [ABI documentation]: https://docs.rs/fortanix-sgx-abi/
12 pub mod usercalls {
13     pub use crate::std::sys::abi::usercalls::*;
14 
15     /// Primitives for allocating memory in userspace as well as copying data
16     /// to and from user memory.
17     pub mod alloc {
18         pub use crate::std::sys::abi::usercalls::alloc::*;
19     }
20 
21     /// Lowest-level interfaces to usercalls and usercall ABI type definitions.
22     pub mod raw {
23         pub use crate::std::sys::abi::usercalls::raw::{
24             accept_stream, alloc, async_queues, bind_stream, close, connect_stream, exit, flush,
25             free, insecure_time, launch_thread, read, read_alloc, send, wait, write,
26         };
27         pub use crate::std::sys::abi::usercalls::raw::{do_usercall, Usercalls as UsercallNrs};
28         pub use crate::std::sys::abi::usercalls::raw::{Register, RegisterArgument, ReturnValue};
29 
30         // fortanix-sgx-abi re-exports
31         pub use crate::std::sys::abi::usercalls::raw::Error;
32         pub use crate::std::sys::abi::usercalls::raw::{
33             ByteBuffer, Cancel, FifoDescriptor, Return, Usercall,
34         };
35         pub use crate::std::sys::abi::usercalls::raw::{Fd, Result, Tcs};
36         pub use crate::std::sys::abi::usercalls::raw::{
37             EV_RETURNQ_NOT_EMPTY, EV_UNPARK, EV_USERCALLQ_NOT_FULL, FD_STDERR, FD_STDIN, FD_STDOUT,
38             RESULT_SUCCESS, USERCALL_USER_DEFINED, WAIT_INDEFINITE, WAIT_NO,
39         };
40     }
41 }
42 
43 /// Functions for querying mapping information for pointers.
44 pub mod mem {
45     pub use crate::std::sys::abi::mem::*;
46 }
47 
48 pub mod arch;
49 pub mod ffi;
50 pub mod io;
51 
52 /// Functions for querying thread-related information.
53 pub mod thread {
54     pub use crate::std::sys::abi::thread::current;
55 }
56