1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 //! Functionality specific to the `x86_64-fortanix-unknown-sgx` target.
13 //! This includes functions to deal with memory isolation, usercalls, and the
14 //! SGX instruction set.
16 #![deny(missing_docs, missing_debug_implementations)]
17 #![unstable(feature = "sgx_platform", issue = "56975")]
19 /// Low-level interfaces to usercalls. See the [ABI documentation] for more
22 /// [ABI documentation]: https://docs.rs/fortanix-sgx-abi/
24 pub use sys::abi::usercalls::*;
26 /// Primitives for allocating memory in userspace as well as copying data
27 /// to and from user memory.
29 pub use sys::abi::usercalls::alloc;
32 /// Lowest-level interfaces to usercalls and usercall ABI type definitions.
34 use sys::abi::usercalls::raw::invoke_with_usercalls;
35 pub use sys::abi::usercalls::raw::do_usercall;
36 pub use sys::abi::usercalls::raw::{accept_stream, alloc, async_queues, bind_stream, close,
37 connect_stream, exit, flush, free, insecure_time,
38 launch_thread, read, read_alloc, send, wait, write};
40 macro_rules! define_usercallnrs {
41 ($(fn $f:ident($($n:ident: $t:ty),*) $(-> $r:ty)*; )*) => {
42 /// Usercall numbers as per the ABI.
44 #[unstable(feature = "sgx_platform", issue = "56975")]
45 #[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)]
46 #[allow(missing_docs)]
47 pub enum UsercallNrs {
52 invoke_with_usercalls!(define_usercallnrs);
54 // fortanix-sgx-abi re-exports
55 pub use sys::abi::usercalls::raw::{ByteBuffer, FifoDescriptor, Return, Usercall};
56 pub use sys::abi::usercalls::raw::Error;
57 pub use sys::abi::usercalls::raw::{EV_RETURNQ_NOT_EMPTY, EV_UNPARK, EV_USERCALLQ_NOT_FULL,
58 FD_STDERR, FD_STDIN, FD_STDOUT, RESULT_SUCCESS,
59 USERCALL_USER_DEFINED, WAIT_INDEFINITE, WAIT_NO};
60 pub use sys::abi::usercalls::raw::{Fd, Result, Tcs};
64 /// Functions for querying mapping information for pointers.
66 pub use sys::abi::mem::*;
69 pub use sys::ext::{io, arch};