hotspot/src/os/aix/vm/loadlib_aix.hpp
author goetz
Thu, 21 Jan 2016 12:37:47 +0100
changeset 35594 cc13089c6327
parent 33743 e21d93a9e062
permissions -rw-r--r--
8147937: Adapt SAP copyrights to new company name. Reviewed-by: simonis, stuefe
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     1
/*
35594
cc13089c6327 8147937: Adapt SAP copyrights to new company name.
goetz
parents: 33743
diff changeset
     2
 * Copyright (c) 2012, 2013 SAP SE. All rights reserved.
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     4
 *
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     7
 * published by the Free Software Foundation.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     8
 *
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    13
 * accompanied this code).
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    14
 *
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    18
 *
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    21
 * questions.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    22
 *
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    23
 */
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    24
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    25
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    26
// Loadlib_aix.cpp contains support code for analysing the memory
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    27
// layout of loaded binaries in ones own process space.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    28
//
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    29
// It is needed, among other things, to provide dladdr(3), which is
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    30
// missing on AIX.
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    31
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    32
#ifndef OS_AIX_VM_LOADLIB_AIX_HPP
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    33
#define OS_AIX_VM_LOADLIB_AIX_HPP
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    34
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    35
#include <stddef.h>
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    36
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    37
class outputStream;
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    38
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    39
// Struct holds information about a single loaded library module.
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    40
// Note that on AIX, a single library can be spread over multiple
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    41
// uintptr_t ranges on a module base, eg.
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    42
// libC.a(shr3_64.o) or libC.a(shrcore_64.o).
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    43
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    44
// Note: all pointers to strings (path, member) point to strings which are immortal.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    45
struct loaded_module_t {
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    46
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    47
  // Points to the full path of the lodaed module, e.g.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    48
  // "/usr/lib/libC.a".
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    49
  const char* path;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    50
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    51
  // Host library name without path
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    52
  const char* shortname;
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    53
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    54
  // Points to the object file (AIX specific stuff)
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    55
  // e.g "shrcore_64.o".
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    56
  const char* member;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    57
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    58
  // Text area from, to
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    59
  const void* text;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    60
  size_t text_len;
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    61
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    62
  // Data area from, to
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    63
  const void* data;
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    64
  size_t data_len;
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    65
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    66
  // True if this module is part of the vm.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    67
  bool is_in_vm;
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    68
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    69
};
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    70
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    71
// This class is a singleton holding a map of all loaded binaries
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    72
// in the AIX process space.
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    73
class LoadedLibraries
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    74
// : AllStatic (including allocation.hpp just for AllStatic is overkill.)
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    75
{
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    76
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    77
  public:
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    78
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    79
    // Rebuild the internal module table. If an error occurs, internal module
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    80
    // table remains untouched.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    81
    static bool reload();
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    82
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    83
    // Check whether the given address points into the text segment of a
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    84
    // loaded module. Return true if this is the case.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    85
    // Optionally, information about the module is returned (info)
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    86
    static bool find_for_text_address (
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    87
      const void* p,
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    88
      loaded_module_t* info // Optional, leave NULL if not needed.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    89
    );
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    90
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    91
    // Check whether the given address points into the data segment of a
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    92
    // loaded module. Return true if this is the case.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    93
    // Optionally, information about the module is returned (info)
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    94
    static bool find_for_data_address (
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    95
      const void* p,
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    96
      loaded_module_t* info // Optional, leave NULL if not needed.
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    97
    );
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
    98
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
    99
    // Output debug info
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   100
    static void print(outputStream* os);
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   101
33743
e21d93a9e062 8140645: Recent Developments for AIX
stuefe
parents: 22831
diff changeset
   102
};
22831
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   103
1e2ba1d62103 8023038: PPC64 (part 15): Platform files for AIX/PPC64 support
simonis
parents:
diff changeset
   104
#endif // OS_AIX_VM_LOADLIB_AIX_HPP