From: ftillier Date: Tue, 11 Oct 2005 22:15:58 +0000 (+0000) Subject: [HCA] Add calls to secure address ranges associated with X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=29e86cf82a5352e822debf575b31ddf22b8e83b5;p=~shefty%2Frdma-win.git [HCA] Add calls to secure address ranges associated with user-mode memory registrations. Signed-off-by: Fab Tillier (ftillier@silverstorm.com) git-svn-id: svn://openib.tc.cornell.edu/gen1@110 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- diff --git a/trunk/hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_iobuf.c b/trunk/hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_iobuf.c index 1e9cbeaa..a43e37e6 100644 --- a/trunk/hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_iobuf.c +++ b/trunk/hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_iobuf.c @@ -202,7 +202,31 @@ check_va_validity: rc = MT_EPERM; goto err2; } - + + if( mode == UserMode ) + { + if (req_perm & MOSAL_PERM_WRITE) + { + new_iobuf->h_secure = MmSecureVirtualMemory( + (PVOID)va, (SIZE_T)size, PAGE_READWRITE ); + } + else + { + new_iobuf->h_secure = MmSecureVirtualMemory( + (PVOID)va, (SIZE_T)size, PAGE_READONLY ); + } + + if( !new_iobuf->h_secure ) + { + rc = MT_EPERM; + goto err3; + } + } + else + { + new_iobuf->h_secure = NULL; + } + // fill IOBUF object new_iobuf->va = va; new_iobuf->size= size; @@ -212,6 +236,8 @@ check_va_validity: MOSAL_dlist_insert_tail( &iobuf_p->seg_que, &new_iobuf->link ); return MT_OK; +err3: + MmUnlockPages( mdl_p ); err2: IoFreeMdl(mdl_p); err1: @@ -222,6 +248,8 @@ err0: static void deregister_segment(MOSAL_iobuf_seg_t iobuf_seg_p) { + if( iobuf_seg_p->h_secure ) + MmUnsecureVirtualMemory( iobuf_seg_p->h_secure); MmUnlockPages( iobuf_seg_p->mdl_p ); // unlock the buffer IoFreeMdl( iobuf_seg_p->mdl_p ); // free MDL FREE(iobuf_seg_p); diff --git a/trunk/hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_iobuf_imp.h b/trunk/hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_iobuf_imp.h index ff19b196..85e8fcd3 100644 --- a/trunk/hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_iobuf_imp.h +++ b/trunk/hw/mt23108/vapi/mlxsys/mosal/os_dep/win/mosal_iobuf_imp.h @@ -44,6 +44,7 @@ struct mosal_iobuf_seg_st { MT_size_t size; /* size in bytes of the buffer */ u_int32_t nr_pages; MOSAL_prot_ctx_t prot_ctx; + void *h_secure; }; typedef struct mosal_iobuf_seg_st * MOSAL_iobuf_seg_t;