1 //! Functionality specific to the `x86_64-fortanix-unknown-sgx` target.
3 //! This includes functions to deal with memory isolation, usercalls, and the
4 //! SGX instruction set.
6 #![deny(missing_docs, missing_debug_implementations)]
7 #![unstable(feature = "sgx_platform", issue = "56975")]
9 /// Low-level interfaces to usercalls. See the [ABI documentation] for more
12 /// [ABI documentation]: https://docs.rs/fortanix-sgx-abi/
14 pub use sys::abi::usercalls::*;
16 /// Primitives for allocating memory in userspace as well as copying data
17 /// to and from user memory.
19 pub use sys::abi::usercalls::alloc;
22 /// Lowest-level interfaces to usercalls and usercall ABI type definitions.
24 use sys::abi::usercalls::raw::invoke_with_usercalls;
25 pub use sys::abi::usercalls::raw::do_usercall;
26 pub use sys::abi::usercalls::raw::{accept_stream, alloc, async_queues, bind_stream, close,
27 connect_stream, exit, flush, free, insecure_time,
28 launch_thread, read, read_alloc, send, wait, write};
30 macro_rules! define_usercallnrs {
31 ($(fn $f:ident($($n:ident: $t:ty),*) $(-> $r:ty)*; )*) => {
32 /// Usercall numbers as per the ABI.
34 #[unstable(feature = "sgx_platform", issue = "56975")]
35 #[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)]
36 #[allow(missing_docs)]
37 pub enum UsercallNrs {
42 invoke_with_usercalls!(define_usercallnrs);
44 // fortanix-sgx-abi re-exports
45 pub use sys::abi::usercalls::raw::{ByteBuffer, FifoDescriptor, Return, Usercall};
46 pub use sys::abi::usercalls::raw::Error;
47 pub use sys::abi::usercalls::raw::{EV_RETURNQ_NOT_EMPTY, EV_UNPARK, EV_USERCALLQ_NOT_FULL,
48 FD_STDERR, FD_STDIN, FD_STDOUT, RESULT_SUCCESS,
49 USERCALL_USER_DEFINED, WAIT_INDEFINITE, WAIT_NO};
50 pub use sys::abi::usercalls::raw::{Fd, Result, Tcs};
54 /// Functions for querying mapping information for pointers.
56 pub use sys::abi::mem::*;
59 pub use sys::ext::{io, arch, ffi};