Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/os/aix/porting_aix.hpp
40930 views
1
/*
2
* Copyright (c) 2012, 2015 SAP SE. 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
*/
24
25
#ifndef OS_AIX_PORTING_AIX_HPP
26
#define OS_AIX_PORTING_AIX_HPP
27
28
#include <stddef.h>
29
30
// Header file to contain porting-relevant code which does not have a
31
// home anywhere else and which can not go into os_<platform>.h because
32
// that header is included inside the os class definition, hence all
33
// its content is part of the os class.
34
35
// Aix' own version of dladdr().
36
// This function tries to mimick dladdr(3) on Linux
37
// (see http://linux.die.net/man/3/dladdr)
38
// dladdr(3) is not POSIX but a GNU extension, and is not available on AIX.
39
//
40
// Differences between AIX dladdr and Linux dladdr:
41
//
42
// 1) Dl_info.dli_fbase: can never work, is disabled.
43
// A loaded image on AIX is divided in multiple segments, at least two
44
// (text and data) but potentially also far more. This is because the loader may
45
// load each member into an own segment, as for instance happens with the libC.a
46
// 2) Dl_info.dli_sname: This only works for code symbols (functions); for data, a
47
// zero-length string is returned ("").
48
// 3) Dl_info.dli_saddr: For code, this will return the entry point of the function,
49
// not the function descriptor.
50
51
typedef struct {
52
const char *dli_fname; // file path of loaded library
53
// void *dli_fbase;
54
const char *dli_sname; // symbol name; "" if not known
55
void *dli_saddr; // address of *entry* of function; not function descriptor;
56
} Dl_info;
57
58
// Note: we export this to use it inside J2se too
59
#ifdef __cplusplus
60
extern "C"
61
#endif
62
int dladdr(void *addr, Dl_info *info);
63
64
struct tbtable;
65
66
class AixSymbols {
67
public:
68
69
// Given a program counter, tries to locate the traceback table and returns info from
70
// it - e.g. function name, displacement of the pc inside the function, and the traceback
71
// table itself.
72
static bool get_function_name (
73
address pc, // [in] program counter
74
char* p_name, size_t namelen, // [out] optional: user provided buffer for the function name
75
int* p_displacement, // [out] optional: displacement
76
const struct tbtable** p_tb, // [out] optional: ptr to traceback table to get further information
77
bool demangle // [in] whether to demangle the name
78
);
79
80
// Given a program counter, returns the name of the module (library and module) the pc points to
81
static bool get_module_name (
82
address pc, // [in] program counter
83
char* p_name, size_t namelen // [out] module name
84
);
85
86
};
87
88
class AixNativeCallstack {
89
public:
90
// This function can be used independently from os::init();
91
static void print_callstack_for_context(outputStream* st, const ucontext_t* uc,
92
bool demangle,
93
char* buf, size_t buf_size);
94
};
95
96
class AixMisc {
97
public:
98
struct stackbounds_t {
99
address base; // high address (stack grows down)
100
size_t size;
101
};
102
103
// Invokes pthread_getthrds_np() and returns its values. Note: values are
104
// not aligned to stack page sizes.
105
// This function can be used independently from os::init();
106
static bool query_stack_bounds_for_current_thread(stackbounds_t* out);
107
108
};
109
110
#endif // OS_AIX_PORTING_AIX_HPP
111
112