This is an automated email from the ASF dual-hosted git repository.

rduan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-teaclave-sgx-sdk.git


The following commit(s) were added to refs/heads/master by this push:
     new b2a8d159 Fix the EMM interface pointer type
b2a8d159 is described below

commit b2a8d1596727797c46f483d253f0e770333affb2
Author: volcano <[email protected]>
AuthorDate: Tue Feb 28 18:40:20 2023 +0800

    Fix the EMM interface pointer type
---
 sgx_trts/src/emm.rs       | 16 ++++++++--------
 sgx_types/src/function.rs | 16 ++++++++--------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/sgx_trts/src/emm.rs b/sgx_trts/src/emm.rs
index 70c571f0..99ea4124 100644
--- a/sgx_trts/src/emm.rs
+++ b/sgx_trts/src/emm.rs
@@ -181,7 +181,7 @@ impl EmmAlloc {
         };
 
         let ret = sgx_mm_alloc(
-            addr as *mut _,
+            addr as *const _,
             length,
             flags as i32,
             mem::transmute(options.handler),
@@ -199,7 +199,7 @@ impl EmmAlloc {
     // AllocFlags::COMMIT_ON_DEMAND.
     #[inline]
     pub unsafe fn commit(&self, addr: NonNull<u8>, length: usize) -> SysError {
-        let ret = sgx_mm_commit(addr.as_ptr() as *mut _, length);
+        let ret = sgx_mm_commit(addr.as_ptr() as *const _, length);
         if ret == 0 {
             Ok(())
         } else {
@@ -215,9 +215,9 @@ impl EmmAlloc {
     #[inline]
     pub unsafe fn commit_with_data(addr: NonNull<u8>, data: &[u8], perm: Perm) 
-> SysError {
         let ret = sgx_mm_commit_data(
-            addr.as_ptr() as *mut _,
+            addr.as_ptr() as *const _,
             data.len(),
-            data.as_ptr() as *mut _,
+            data.as_ptr() as *const _,
             perm.bits() as _,
         );
         if ret == 0 {
@@ -232,7 +232,7 @@ impl EmmAlloc {
     /// reserved.
     #[inline]
     pub unsafe fn uncommit(&self, addr: NonNull<u8>, length: usize) -> 
SysError {
-        let ret = sgx_mm_uncommit(addr.as_ptr() as *mut _, length);
+        let ret = sgx_mm_uncommit(addr.as_ptr() as *const _, length);
         if ret == 0 {
             Ok(())
         } else {
@@ -245,7 +245,7 @@ impl EmmAlloc {
     /// for future allocation.
     #[inline]
     pub unsafe fn dealloc(&self, addr: NonNull<u8>, length: usize) -> SysError 
{
-        let ret = sgx_mm_dealloc(addr.as_ptr() as *mut _, length);
+        let ret = sgx_mm_dealloc(addr.as_ptr() as *const _, length);
         if ret == 0 {
             Ok(())
         } else {
@@ -261,7 +261,7 @@ impl EmmAlloc {
         length: usize,
         perm: Perm,
     ) -> SysError {
-        let ret = sgx_mm_modify_permissions(addr.as_ptr() as *mut _, length, 
perm.bits() as _);
+        let ret = sgx_mm_modify_permissions(addr.as_ptr() as *const _, length, 
perm.bits() as _);
         if ret == 0 {
             Ok(())
         } else {
@@ -277,7 +277,7 @@ impl EmmAlloc {
         length: usize,
         page_type: PageType,
     ) -> SysError {
-        let ret = sgx_mm_modify_type(addr.as_ptr() as *mut _, length, 
page_type as _);
+        let ret = sgx_mm_modify_type(addr.as_ptr() as *const _, length, 
page_type as _);
         if ret == 0 {
             Ok(())
         } else {
diff --git a/sgx_types/src/function.rs b/sgx_types/src/function.rs
index 5d2b6d85..8101324d 100644
--- a/sgx_types/src/function.rs
+++ b/sgx_types/src/function.rs
@@ -694,7 +694,7 @@ extern "C" {
 //#[link(name = "sgx_mm")]
 extern "C" {
     pub fn sgx_mm_alloc(
-        addr: *mut c_void,
+        addr: *const c_void,
         length: size_t,
         flags: int32_t,
         handler: sgx_enclave_fault_handler_t,
@@ -702,17 +702,17 @@ extern "C" {
         out_addr: *mut *mut c_void,
     ) -> int32_t;
 
-    pub fn sgx_mm_commit(addr: *mut c_void, length: size_t) -> int32_t;
+    pub fn sgx_mm_commit(addr: *const c_void, length: size_t) -> int32_t;
     pub fn sgx_mm_commit_data(
-        addr: *mut c_void,
+        addr: *const c_void,
         length: size_t,
-        data: *mut uint8_t,
+        data: *const uint8_t,
         prot: int32_t,
     ) -> int32_t;
-    pub fn sgx_mm_uncommit(addr: *mut c_void, length: size_t) -> int32_t;
-    pub fn sgx_mm_dealloc(addr: *mut c_void, length: size_t) -> int32_t;
-    pub fn sgx_mm_modify_permissions(addr: *mut c_void, length: size_t, prot: 
int32_t) -> int32_t;
-    pub fn sgx_mm_modify_type(addr: *mut c_void, length: size_t, page_type: 
int32_t) -> int32_t;
+    pub fn sgx_mm_uncommit(addr: *const c_void, length: size_t) -> int32_t;
+    pub fn sgx_mm_dealloc(addr: *const c_void, length: size_t) -> int32_t;
+    pub fn sgx_mm_modify_permissions(addr: *const c_void, length: size_t, 
prot: int32_t) -> int32_t;
+    pub fn sgx_mm_modify_type(addr: *const c_void, length: size_t, page_type: 
int32_t) -> int32_t;
 }
 
 //#[link(name = "sgx_epid")]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to