sgxs_loaders/
lib.rs

1/* Copyright (c) Fortanix, Inc.
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7#![doc(html_logo_url = "https://edp.fortanix.com/img/docs/edp-logo.svg",
8       html_favicon_url = "https://edp.fortanix.com/favicon.ico",
9       html_root_url = "https://edp.fortanix.com/docs/api/")]
10
11#[cfg(unix)] #[macro_use]
12extern crate nix;
13
14extern crate thiserror;
15#[macro_use]
16extern crate bitflags;
17
18mod generic;
19#[cfg(unix)] pub mod isgx;
20pub mod sgx_enclave_common;
21#[cfg(windows)] pub mod enclaveapi;
22
23use std::fmt::Debug;
24use std::os::raw::c_void;
25use std::sync::Arc;
26
27use sgxs::loader;
28
29#[derive(Debug)]
30pub struct Tcs {
31    _mapping: Arc<dyn Debug + Sync + Send>,
32    address: u64,
33}
34
35impl loader::Tcs for Tcs {
36    fn address(&self) -> *mut c_void {
37        self.address as _
38    }
39}
40
41#[derive(Debug)]
42pub struct MappingInfo {
43    _mapping: Arc<dyn Debug + Sync + Send>,
44    base: u64,
45    size: u64,
46}
47
48impl loader::MappingInfo for MappingInfo {
49    fn address(&self) -> *mut c_void {
50        self.base as _
51    }
52
53    fn size(&self) -> usize {
54        self.size as _
55    }
56}