src/os/aix/vm/loadlib_aix.hpp

Wed, 31 Jan 2018 19:24:57 -0500

author
dbuck
date
Wed, 31 Jan 2018 19:24:57 -0500
changeset 9289
427b2fb1944f
parent 0
f90c822e73f8
permissions
-rw-r--r--

8189170: Add option to disable stack overflow checking in primordial thread for use with JNI_CreateJavaJVM
Reviewed-by: dcubed

     1 /*
     2  * Copyright 2012, 2013 SAP AG. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     8  *
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    12  * version 2 for more details (a copy is included in the LICENSE file that
    13  * accompanied this code).
    14  *
    15  * You should have received a copy of the GNU General Public License version
    16  * 2 along with this work; if not, write to the Free Software Foundation,
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    18  *
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    22  *
    23  */
    26 // Loadlib_aix.cpp contains support code for analysing the memory
    27 // layout of loaded binaries in ones own process space.
    28 //
    29 // It is needed, among other things, to provide a  dladdr() emulation, because
    30 // that one is not provided by AIX
    32 #ifndef OS_AIX_VM_LOADLIB_AIX_HPP
    33 #define OS_AIX_VM_LOADLIB_AIX_HPP
    35 class outputStream;
    37 // This class holds information about a single loaded library module.
    38 // Note that on AIX, a single library can be spread over multiple
    39 // uintptr_t range on a module base, eg.
    40 // libC.a(shr3_64.o) or libC.a(shrcore_64.o).
    41 class LoadedLibraryModule {
    43     friend class LoadedLibraries;
    45     char fullpath[512];  // eg /usr/lib/libC.a
    46     char shortname[30];  // eg libC.a
    47     char membername[30]; // eg shrcore_64.o
    48     const unsigned char* text_from;
    49     const unsigned char* text_to;
    50     const unsigned char* data_from;
    51     const unsigned char* data_to;
    53   public:
    55     const char* get_fullpath() const {
    56       return fullpath;
    57     }
    58     const char* get_shortname() const {
    59       return shortname;
    60     }
    61     const char* get_membername() const {
    62       return membername;
    63     }
    65     // text_from, text_to: returns the range of the text (code)
    66     // segment for that module
    67     const unsigned char* get_text_from() const {
    68       return text_from;
    69     }
    70     const unsigned char* get_text_to() const {
    71       return text_to;
    72     }
    74     // data_from/data_to: returns the range of the data
    75     // segment for that module
    76     const unsigned char* get_data_from() const {
    77       return data_from;
    78     }
    79     const unsigned char* get_data_to() const {
    80       return data_to;
    81     }
    83     // returns true if the
    84     bool is_in_text(const unsigned char* p) const {
    85       return p >= text_from && p < text_to ? true : false;
    86     }
    88     bool is_in_data(const unsigned char* p) const {
    89       return p >= data_from && p < data_to ? true : false;
    90     }
    92     // output debug info
    93     void print(outputStream* os) const;
    95 }; // end LoadedLibraryModule
    97 // This class is a singleton holding a map of all loaded binaries
    98 // in the AIX process space.
    99 class LoadedLibraries
   100 // : AllStatic (including allocation.hpp just for AllStatic is overkill.)
   101 {
   103   private:
   105     enum {MAX_MODULES = 100};
   106     static LoadedLibraryModule tab[MAX_MODULES];
   107     static int num_loaded;
   109   public:
   111     // rebuild the internal table of LoadedLibraryModule objects
   112     static void reload();
   114     // checks whether the address p points to any of the loaded code segments.
   115     // If it does, returns the LoadedLibraryModule entry. If not, returns NULL.
   116     static const LoadedLibraryModule* find_for_text_address(const  unsigned char* p);
   118     // checks whether the address p points to any of the loaded data segments.
   119     // If it does, returns the LoadedLibraryModule entry. If not, returns NULL.
   120     static const LoadedLibraryModule* find_for_data_address(const  unsigned char* p);
   122     // output debug info
   123     static void print(outputStream* os);
   125 }; // end LoadedLibraries
   128 #endif // OS_AIX_VM_LOADLIB_AIX_HPP

mercurial