• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git b/src/lib.rs a/src/lib.rs
2index dd9b9df1..a0a0372d 100644
3--- b/src/lib.rs
4+++ a/src/lib.rs
5@@ -145,6 +145,12 @@ cfg_if! {
6
7         mod teeos;
8         pub use teeos::*;
9+    } else if #[cfg(target_os = "trusty")] {
10+        mod fixed_width_ints;
11+        pub use fixed_width_ints::*;
12+
13+        mod trusty;
14+        pub use trusty::*;
15     } else if #[cfg(all(target_env = "sgx", target_vendor = "fortanix"))] {
16         mod fixed_width_ints;
17         pub use fixed_width_ints::*;
18diff --git b/src/trusty.rs a/src/trusty.rs
19new file mode 100644
20index 00000000..7f1c6399
21--- /dev/null
22+++ a/src/trusty.rs
23@@ -0,0 +1,98 @@
24+#[cfg(feature = "trusty_sys")]
25+extern crate trusty_sys;
26+
27+pub use core::ffi::c_void;
28+
29+#[cfg(feature = "trusty_sys")]
30+pub const PROT_READ: i32 = self::trusty_sys::MMAP_FLAG_PROT_READ as i32;
31+
32+#[cfg(feature = "trusty_sys")]
33+pub const PROT_WRITE: i32 = self::trusty_sys::MMAP_FLAG_PROT_WRITE as i32;
34+
35+pub type size_t = usize;
36+pub type ssize_t = isize;
37+
38+pub type off_t = i64;
39+
40+#[cfg(any(target_arch = "aarch64", target_arch = "arm"))]
41+pub type c_char = u8;
42+#[cfg(target_arch = "x86_64")]
43+pub type c_char = i8;
44+
45+pub type c_schar = i8;
46+pub type c_uchar = u8;
47+pub type c_short = i16;
48+pub type c_ushort = u16;
49+pub type c_int = i32;
50+pub type c_uint = u32;
51+
52+#[cfg(target_pointer_width = "32")]
53+pub type c_long = i32;
54+#[cfg(target_pointer_width = "64")]
55+pub type c_long = i64;
56+
57+#[cfg(target_pointer_width = "32")]
58+pub type c_ulong = u32;
59+#[cfg(target_pointer_width = "64")]
60+pub type c_ulong = u64;
61+
62+pub type c_longlong = i64;
63+pub type c_ulonglong = u64;
64+
65+pub type c_uint8_t = u8;
66+pub type c_uint16_t = u16;
67+pub type c_uint32_t = u32;
68+pub type c_uint64_t = u64;
69+
70+pub type c_int8_t = i8;
71+pub type c_int16_t = i16;
72+pub type c_int32_t = i32;
73+pub type c_int64_t = i64;
74+
75+pub type time_t = c_long;
76+
77+pub type clockid_t = c_int;
78+pub const CLOCK_REALTIME: clockid_t = 0;
79+pub struct timespec {
80+    pub tv_sec: time_t,
81+    pub tv_nsec: c_long,
82+}
83+
84+pub const STDOUT_FILENO: ::c_int = 1;
85+pub const STDERR_FILENO: ::c_int = 2;
86+
87+pub const AT_PAGESZ: ::c_ulong = 6;
88+
89+pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
90+
91+extern "C" {
92+    pub fn calloc(nobj: size_t, size: size_t) -> *mut c_void;
93+    pub fn malloc(size: size_t) -> *mut c_void;
94+    pub fn realloc(p: *mut c_void, size: size_t) -> *mut c_void;
95+    pub fn free(p: *mut c_void);
96+    pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
97+    pub fn posix_memalign(memptr: *mut *mut ::c_void, align: ::size_t, size: ::size_t) -> ::c_int;
98+    pub fn write(fd: ::c_int, buf: *const ::c_void, count: ::size_t) -> ::ssize_t;
99+    pub fn writev(fd: ::c_int, iov: *const ::iovec, iovcnt: ::c_int) -> ::ssize_t;
100+    pub fn close(fd: ::c_int) -> ::c_int;
101+    pub fn strlen(cs: *const c_char) -> size_t;
102+    pub fn getauxval(type_: c_ulong) -> c_ulong;
103+    pub fn mmap(
104+        addr: *mut ::c_void,
105+        len: ::size_t,
106+        prot: ::c_int,
107+        flags: ::c_int,
108+        fd: ::c_int,
109+        offset: off_t,
110+    ) -> *mut ::c_void;
111+    pub fn munmap(addr: *mut ::c_void, len: ::size_t) -> ::c_int;
112+    pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
113+    pub fn nanosleep(rqtp: *const ::timespec, rmtp: *mut ::timespec) -> ::c_int;
114+}
115+
116+s! {
117+    pub struct iovec {
118+        pub iov_base: *mut ::c_void,
119+        pub iov_len: ::size_t,
120+    }
121+}
122