@@ -83,11 +83,6 @@ opal_memory_patcher_component_t mca_memory_patcher_component = {
8383 it out) */
8484};
8585
86- #if OPAL_MEMORY_PATCHER_HAVE___MMAP && !OPAL_MEMORY_PATCHER_HAVE___MMAP_PROTO
87- /* prototype for Apple's internal mmap function */
88- void * __mmap (void * start , size_t length , int prot , int flags , int fd , off_t offset );
89- #endif
90-
9186#if OPAL_MEMORY_PATCHER_HAVE___SYSCALL_PROTO && OPAL_MEMORY_PATCHER_HAVE___SYSCALL
9287/* calling __syscall is preferred on some systems when some arguments may be 64-bit. it also
9388 * has the benefit of having an off_t return type */
@@ -96,6 +91,13 @@ void *__mmap (void *start, size_t length, int prot, int flags, int fd, off_t off
9691#define memory_patcher_syscall syscall
9792#endif
9893
94+ #if 0
95+
96+ #if OPAL_MEMORY_PATCHER_HAVE___MMAP && !OPAL_MEMORY_PATCHER_HAVE___MMAP_PROTO
97+ /* prototype for Apple's internal mmap function */
98+ void * __mmap (void * start , size_t length , int prot , int flags , int fd , off_t offset );
99+ #endif
100+
99101static void * (* original_mmap )(void * , size_t , int , int , int , off_t );
100102
101103static void * intercept_mmap (void * start , size_t length , int prot , int flags , int fd , off_t offset )
@@ -127,6 +129,8 @@ static void *intercept_mmap(void *start, size_t length, int prot, int flags, int
127129 return result ;
128130}
129131
132+ #endif
133+
130134static int (* original_munmap ) (void * , size_t );
131135
132136static int intercept_munmap (void * start , size_t length )
@@ -372,10 +376,14 @@ static int patcher_open (void)
372376 /* set memory hooks support level */
373377 opal_mem_hooks_set_support (OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT );
374378
379+ #if 0
380+ /* NTH: the only reason to hook mmap would be to detect memory protection. this does not invalidate
381+ * any cache entries in the region. */
375382 rc = opal_patcher -> patch_symbol ("mmap" , (uintptr_t ) intercept_mmap , (uintptr_t * ) & original_mmap );
376383 if (OPAL_SUCCESS != rc ) {
377384 return rc ;
378385 }
386+ #endif
379387
380388 rc = opal_patcher -> patch_symbol ("munmap" , (uintptr_t )intercept_munmap , (uintptr_t * ) & original_munmap );
381389 if (OPAL_SUCCESS != rc ) {
0 commit comments