about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorJethro Beekman <jethro@fortanix.com>2019-02-01 13:58:49 +0530
committerJethro Beekman <jethro@fortanix.com>2019-02-01 13:58:49 +0530
commita90b23fd30cce3f83b9c1771bab31c1964ce2fe2 (patch)
tree3e9dd9193a83c3d9b2bde248d79e35f5abe34204 /src/libstd
parentd30b99f9c23f8e1d6ef993cc94da96510ad709b3 (diff)
downloadrust-a90b23fd30cce3f83b9c1771bab31c1964ce2fe2.tar.gz
rust-a90b23fd30cce3f83b9c1771bab31c1964ce2fe2.zip
Fix `std::os::fortanix_sgx::usercalls::raw::UsercallNrs`
Fixes https://github.com/fortanix/rust-sgx/issues/88
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/os/fortanix_sgx/mod.rs17
-rw-r--r--src/libstd/sys/sgx/abi/usercalls/raw.rs13
2 files changed, 10 insertions, 20 deletions
diff --git a/src/libstd/os/fortanix_sgx/mod.rs b/src/libstd/os/fortanix_sgx/mod.rs
index 810965fc1b8..c6106b9f827 100644
--- a/src/libstd/os/fortanix_sgx/mod.rs
+++ b/src/libstd/os/fortanix_sgx/mod.rs
@@ -21,26 +21,11 @@ pub mod usercalls {
 
     /// Lowest-level interfaces to usercalls and usercall ABI type definitions.
     pub mod raw {
-        use sys::abi::usercalls::raw::invoke_with_usercalls;
-        pub use sys::abi::usercalls::raw::do_usercall;
+        pub use sys::abi::usercalls::raw::{do_usercall, Usercalls as UsercallNrs};
         pub use sys::abi::usercalls::raw::{accept_stream, alloc, async_queues, bind_stream, close,
                                            connect_stream, exit, flush, free, insecure_time,
                                            launch_thread, read, read_alloc, send, wait, write};
 
-        macro_rules! define_usercallnrs {
-            ($(fn $f:ident($($n:ident: $t:ty),*) $(-> $r:ty)*; )*) => {
-                /// Usercall numbers as per the ABI.
-                #[repr(C)]
-                #[unstable(feature = "sgx_platform", issue = "56975")]
-                #[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)]
-                #[allow(missing_docs)]
-                pub enum UsercallNrs {
-                    $($f,)*
-                }
-            };
-        }
-        invoke_with_usercalls!(define_usercallnrs);
-
         // fortanix-sgx-abi re-exports
         pub use sys::abi::usercalls::raw::{ByteBuffer, FifoDescriptor, Return, Usercall};
         pub use sys::abi::usercalls::raw::Error;
diff --git a/src/libstd/sys/sgx/abi/usercalls/raw.rs b/src/libstd/sys/sgx/abi/usercalls/raw.rs
index 27aca7c0903..27f780ca224 100644
--- a/src/libstd/sys/sgx/abi/usercalls/raw.rs
+++ b/src/libstd/sys/sgx/abi/usercalls/raw.rs
@@ -41,10 +41,15 @@ trait ReturnValue {
 macro_rules! define_usercalls {
     // Using `$r:tt` because `$r:ty` doesn't match ! in `clobber_diverging`
     ($(fn $f:ident($($n:ident: $t:ty),*) $(-> $r:tt)*; )*) => {
-        #[repr(C)]
-        #[allow(non_camel_case_types)]
-        enum Usercalls {
-            __enclave_usercalls_invalid,
+        /// Usercall numbers as per the ABI.
+        #[repr(u64)]
+        #[unstable(feature = "sgx_platform", issue = "56975")]
+        #[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)]
+        #[allow(missing_docs, non_camel_case_types)]
+        #[non_exhaustive]
+        pub enum Usercalls {
+            #[doc(hidden)]
+            __enclave_usercalls_invalid = 0,
             $($f,)*
         }