1
1

memory patcher: add some clarifying comments

This is complicated stuff: add some comments so that future
maintainers have some rationale to understand the way things have been
done.

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
Этот коммит содержится в:
Jeff Squyres 2016-04-25 13:10:50 -07:00
родитель 55a15fb1d0
Коммит 78b367eb0d

Просмотреть файл

@ -10,7 +10,7 @@
* University of Stuttgart. All rights reserved. * University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California. * Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights * Copyright (c) 2013-2016 Los Alamos National Security, LLC. All rights
* reserved. * reserved.
* Copyright (c) 2016 Research Organization for Information Science * Copyright (c) 2016 Research Organization for Information Science
@ -92,6 +92,14 @@ opal_memory_patcher_component_t mca_memory_patcher_component = {
#define memory_patcher_syscall syscall #define memory_patcher_syscall syscall
#endif #endif
/*
* The following block of code is #if 0'ed out because we do not need
* to intercept mmap() any more (mmap() only deals with memory
* protection; it does not invalidate any rcache entries for a given
* region). But if we do someday, this is the code that we'll need.
* It's a little non-trivial, so we might as well keep it (and #if 0
* it out).
*/
#if 0 #if 0
#if OPAL_MEMORY_PATCHER_HAVE___MMAP && !OPAL_MEMORY_PATCHER_HAVE___MMAP_PROTO #if OPAL_MEMORY_PATCHER_HAVE___MMAP && !OPAL_MEMORY_PATCHER_HAVE___MMAP_PROTO
@ -385,8 +393,8 @@ static int patcher_open (void)
opal_mem_hooks_set_support (OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT); opal_mem_hooks_set_support (OPAL_MEMORY_FREE_SUPPORT | OPAL_MEMORY_MUNMAP_SUPPORT);
#if 0 #if 0
/* NTH: the only reason to hook mmap would be to detect memory protection. this does not invalidate /* See above block to see why mmap() functionality is #if 0'ed
* any cache entries in the region. */ out */
rc = opal_patcher->patch_symbol ("mmap", (uintptr_t) intercept_mmap, (uintptr_t *) &original_mmap); rc = opal_patcher->patch_symbol ("mmap", (uintptr_t) intercept_mmap, (uintptr_t *) &original_mmap);
if (OPAL_SUCCESS != rc) { if (OPAL_SUCCESS != rc) {
return rc; return rc;
@ -428,6 +436,7 @@ static int patcher_open (void)
static int patcher_close(void) static int patcher_close(void)
{ {
/* NTH: is it possible to unpatch the symbols? */ /* Note that we don't need to unpatch any symbols here; the
patcher framework will take care of all of that for us. */
return OPAL_SUCCESS; return OPAL_SUCCESS;
} }