-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add std::os::fortanix_sgx
module
#56978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
//! Functionality specific to the `x86_64-fortanix-unknown-sgx` target. | ||
//! | ||
//! This includes functions to deal with memory isolation, usercalls, and the | ||
//! SGX instruction set. | ||
|
||
#![deny(missing_docs, missing_debug_implementations)] | ||
#![unstable(feature = "sgx_platform", issue = "56975")] | ||
|
||
/// Low-level interfaces to usercalls. See the [ABI documentation] for more | ||
/// information. | ||
/// | ||
/// [ABI documentation]: https://docs.rs/fortanix-sgx-abi/ | ||
pub mod usercalls { | ||
pub use sys::abi::usercalls::*; | ||
|
||
/// Primitives for allocating memory in userspace as well as copying data | ||
/// to and from user memory. | ||
pub mod alloc { | ||
pub use sys::abi::usercalls::alloc; | ||
} | ||
|
||
/// 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::{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; | ||
pub use sys::abi::usercalls::raw::{EV_RETURNQ_NOT_EMPTY, EV_UNPARK, EV_USERCALLQ_NOT_FULL, | ||
FD_STDERR, FD_STDIN, FD_STDOUT, RESULT_SUCCESS, | ||
USERCALL_USER_DEFINED, WAIT_INDEFINITE, WAIT_NO}; | ||
pub use sys::abi::usercalls::raw::{Fd, Result, Tcs}; | ||
} | ||
} | ||
|
||
/// Functions for querying mapping information for pointers. | ||
pub mod mem { | ||
pub use sys::abi::mem::*; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,25 +29,10 @@ cfg_if! { | |
|
||
#[doc(cfg(target_os = "linux"))] | ||
pub mod linux; | ||
|
||
} else { | ||
|
||
// If we're not documenting libstd then we just expose everything as we | ||
// otherwise would. | ||
|
||
#[cfg(target_os = "android")] pub mod android; | ||
#[cfg(target_os = "bitrig")] pub mod bitrig; | ||
#[cfg(target_os = "dragonfly")] pub mod dragonfly; | ||
#[cfg(target_os = "freebsd")] pub mod freebsd; | ||
#[cfg(target_os = "haiku")] pub mod haiku; | ||
#[cfg(target_os = "ios")] pub mod ios; | ||
#[cfg(target_os = "macos")] pub mod macos; | ||
#[cfg(target_os = "netbsd")] pub mod netbsd; | ||
#[cfg(target_os = "openbsd")] pub mod openbsd; | ||
#[cfg(target_os = "solaris")] pub mod solaris; | ||
#[cfg(target_os = "emscripten")] pub mod emscripten; | ||
#[cfg(target_os = "fuchsia")] pub mod fuchsia; | ||
#[cfg(target_os = "hermit")] pub mod hermit; | ||
// If we're not documenting libstd then we just expose the main modules | ||
// as we otherwise would. | ||
|
||
#[cfg(any(target_os = "redox", unix))] | ||
#[stable(feature = "rust1", since = "1.0.0")] | ||
|
@@ -63,4 +48,19 @@ cfg_if! { | |
} | ||
} | ||
|
||
#[cfg(target_os = "android")] pub mod android; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These changes are from #56972 |
||
#[cfg(target_os = "bitrig")] pub mod bitrig; | ||
#[cfg(target_os = "dragonfly")] pub mod dragonfly; | ||
#[cfg(target_os = "freebsd")] pub mod freebsd; | ||
#[cfg(target_os = "haiku")] pub mod haiku; | ||
#[cfg(target_os = "ios")] pub mod ios; | ||
#[cfg(target_os = "macos")] pub mod macos; | ||
#[cfg(target_os = "netbsd")] pub mod netbsd; | ||
#[cfg(target_os = "openbsd")] pub mod openbsd; | ||
#[cfg(target_os = "solaris")] pub mod solaris; | ||
#[cfg(target_os = "emscripten")] pub mod emscripten; | ||
#[cfg(target_os = "fuchsia")] pub mod fuchsia; | ||
#[cfg(target_os = "hermit")] pub mod hermit; | ||
#[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] pub mod fortanix_sgx; | ||
|
||
pub mod raw; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Diff: fortanix/rust-sgx@769d806 (adding stability attributes)