8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26 /*
27 * Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
28 * Copyright (c) 2013, Joyent, Inc. All rights reserved.
29 */
30
31 /*
32 * String conversion routines the system structs found in
33 * Solaris core file note sections. These items are not
34 * ELF constructs. However, elfdump contains code for decoding
35 * them, and therefore requires formatting support.
36 */
37 #include <stdio.h>
38 #include <procfs.h>
39 #include <sys/corectl.h>
40 #include <string.h>
41 #include <_conv.h>
42 #include <corenote_msg.h>
43
44 const char *
45 conv_cnote_type(Word type, Conv_fmt_flags_t fmt_flags,
46 Conv_inv_buf_t *inv_buf)
47 {
48 static const Msg types[] = {
59 MSG_NT_ZONENAME, MSG_NT_FDINFO,
60 MSG_NT_SPYMASTER
61 };
62 #if NT_NUM != NT_SPYMASTER
63 #error "NT_NUM has grown. Update core note types[]"
64 #endif
65 static const conv_ds_msg_t ds_types = {
66 CONV_DS_MSG_INIT(NT_PRSTATUS, types) };
67 static const conv_ds_t *ds[] = { CONV_DS_ADDR(ds_types), NULL };
68
69
70 return (conv_map_ds(ELFOSABI_NONE, EM_NONE, type, ds, fmt_flags,
71 inv_buf));
72 }
73
74
75 const char *
76 conv_cnote_auxv_type(Word type, Conv_fmt_flags_t fmt_flags,
77 Conv_inv_buf_t *inv_buf)
78 {
79 static const Msg types_0_22[] = {
80 MSG_AUXV_AT_NULL, MSG_AUXV_AT_IGNORE,
81 MSG_AUXV_AT_EXECFD, MSG_AUXV_AT_PHDR,
82 MSG_AUXV_AT_PHENT, MSG_AUXV_AT_PHNUM,
83 MSG_AUXV_AT_PAGESZ, MSG_AUXV_AT_BASE,
84 MSG_AUXV_AT_FLAGS, MSG_AUXV_AT_ENTRY,
85 MSG_AUXV_AT_NOTELF, MSG_AUXV_AT_UID,
86 MSG_AUXV_AT_EUID, MSG_AUXV_AT_GID,
87 MSG_AUXV_AT_EGID, MSG_AUXV_AT_PLATFORM,
88 MSG_AUXV_AT_HWCAP, MSG_AUXV_AT_CLKTCK,
89 MSG_AUXV_AT_FPUCW, MSG_AUXV_AT_DCACHEBSIZE,
90 MSG_AUXV_AT_ICACHEBSIZE, MSG_AUXV_AT_UCACHEBSIZE,
91 MSG_AUXV_AT_IGNOREPPC
92 };
93 static const conv_ds_msg_t ds_types_0_22 = {
94 CONV_DS_MSG_INIT(0, types_0_22) };
95
96 static const Msg types_2000_2011[] = {
97 MSG_AUXV_AT_SUN_UID, MSG_AUXV_AT_SUN_RUID,
98 MSG_AUXV_AT_SUN_GID, MSG_AUXV_AT_SUN_RGID,
99 MSG_AUXV_AT_SUN_LDELF, MSG_AUXV_AT_SUN_LDSHDR,
100 MSG_AUXV_AT_SUN_LDNAME, MSG_AUXV_AT_SUN_LPAGESZ,
101 MSG_AUXV_AT_SUN_PLATFORM, MSG_AUXV_AT_SUN_HWCAP,
102 MSG_AUXV_AT_SUN_IFLUSH, MSG_AUXV_AT_SUN_CPU
103 };
104 static const conv_ds_msg_t ds_types_2000_2011 = {
105 CONV_DS_MSG_INIT(2000, types_2000_2011) };
106
107 static const Msg types_2014_2023[] = {
108 MSG_AUXV_AT_SUN_EXECNAME, MSG_AUXV_AT_SUN_MMU,
109 MSG_AUXV_AT_SUN_LDDATA, MSG_AUXV_AT_SUN_AUXFLAGS,
110 MSG_AUXV_AT_SUN_EMULATOR, MSG_AUXV_AT_SUN_BRANDNAME,
111 MSG_AUXV_AT_SUN_BRAND_AUX1, MSG_AUXV_AT_SUN_BRAND_AUX2,
112 MSG_AUXV_AT_SUN_BRAND_AUX3, MSG_AUXV_AT_SUN_HWCAP2
113 };
114 static const conv_ds_msg_t ds_types_2014_2023 = {
115 CONV_DS_MSG_INIT(2014, types_2014_2023) };
116
117 static const conv_ds_t *ds[] = {
118 CONV_DS_ADDR(ds_types_0_22), CONV_DS_ADDR(ds_types_2000_2011),
119 CONV_DS_ADDR(ds_types_2014_2023), NULL };
120
121 return (conv_map_ds(ELFOSABI_NONE, EM_NONE, type, ds, fmt_flags,
122 inv_buf));
123 }
124
125
126 const char *
127 conv_cnote_signal(Word sig, Conv_fmt_flags_t fmt_flags,
128 Conv_inv_buf_t *inv_buf)
129 {
130 static const Msg sigarr[] = {
131 MSG_SIGHUP, MSG_SIGINT,
132 MSG_SIGQUIT, MSG_SIGILL,
133 MSG_SIGTRAP, MSG_SIGABRT,
134 MSG_SIGEMT, MSG_SIGFPE,
135 MSG_SIGKILL, MSG_SIGBUS,
136 MSG_SIGSEGV, MSG_SIGSYS,
137 MSG_SIGPIPE, MSG_SIGALRM,
138 MSG_SIGTERM, MSG_SIGUSR1,
139 MSG_SIGUSR2, MSG_SIGCHLD,
|
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26 /*
27 * Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
28 * Copyright 2016 Joyent, Inc.
29 */
30
31 /*
32 * String conversion routines the system structs found in
33 * Solaris core file note sections. These items are not
34 * ELF constructs. However, elfdump contains code for decoding
35 * them, and therefore requires formatting support.
36 */
37 #include <stdio.h>
38 #include <procfs.h>
39 #include <sys/corectl.h>
40 #include <string.h>
41 #include <_conv.h>
42 #include <corenote_msg.h>
43
44 const char *
45 conv_cnote_type(Word type, Conv_fmt_flags_t fmt_flags,
46 Conv_inv_buf_t *inv_buf)
47 {
48 static const Msg types[] = {
59 MSG_NT_ZONENAME, MSG_NT_FDINFO,
60 MSG_NT_SPYMASTER
61 };
62 #if NT_NUM != NT_SPYMASTER
63 #error "NT_NUM has grown. Update core note types[]"
64 #endif
65 static const conv_ds_msg_t ds_types = {
66 CONV_DS_MSG_INIT(NT_PRSTATUS, types) };
67 static const conv_ds_t *ds[] = { CONV_DS_ADDR(ds_types), NULL };
68
69
70 return (conv_map_ds(ELFOSABI_NONE, EM_NONE, type, ds, fmt_flags,
71 inv_buf));
72 }
73
74
75 const char *
76 conv_cnote_auxv_type(Word type, Conv_fmt_flags_t fmt_flags,
77 Conv_inv_buf_t *inv_buf)
78 {
79 static const Msg types_0_25[] = {
80 MSG_AUXV_AT_NULL, MSG_AUXV_AT_IGNORE,
81 MSG_AUXV_AT_EXECFD, MSG_AUXV_AT_PHDR,
82 MSG_AUXV_AT_PHENT, MSG_AUXV_AT_PHNUM,
83 MSG_AUXV_AT_PAGESZ, MSG_AUXV_AT_BASE,
84 MSG_AUXV_AT_FLAGS, MSG_AUXV_AT_ENTRY,
85 MSG_AUXV_AT_NOTELF, MSG_AUXV_AT_UID,
86 MSG_AUXV_AT_EUID, MSG_AUXV_AT_GID,
87 MSG_AUXV_AT_EGID, MSG_AUXV_AT_PLATFORM,
88 MSG_AUXV_AT_HWCAP, MSG_AUXV_AT_CLKTCK,
89 MSG_AUXV_AT_FPUCW, MSG_AUXV_AT_DCACHEBSIZE,
90 MSG_AUXV_AT_ICACHEBSIZE, MSG_AUXV_AT_UCACHEBSIZE,
91 MSG_AUXV_AT_IGNOREPPC, MSG_AUXV_AT_SECURE,
92 MSG_AUXV_AT_BASE_PLATFORM, MSG_AUXV_AT_RANDOM
93 };
94 static const conv_ds_msg_t ds_types_0_25 = {
95 CONV_DS_MSG_INIT(0, types_0_25) };
96
97 static const Msg types_2000_2011[] = {
98 MSG_AUXV_AT_SUN_UID, MSG_AUXV_AT_SUN_RUID,
99 MSG_AUXV_AT_SUN_GID, MSG_AUXV_AT_SUN_RGID,
100 MSG_AUXV_AT_SUN_LDELF, MSG_AUXV_AT_SUN_LDSHDR,
101 MSG_AUXV_AT_SUN_LDNAME, MSG_AUXV_AT_SUN_LPAGESZ,
102 MSG_AUXV_AT_SUN_PLATFORM, MSG_AUXV_AT_SUN_HWCAP,
103 MSG_AUXV_AT_SUN_IFLUSH, MSG_AUXV_AT_SUN_CPU
104 };
105 static const conv_ds_msg_t ds_types_2000_2011 = {
106 CONV_DS_MSG_INIT(2000, types_2000_2011) };
107
108 static const Msg types_2014_2025[] = {
109 MSG_AUXV_AT_SUN_EXECNAME, MSG_AUXV_AT_SUN_MMU,
110 MSG_AUXV_AT_SUN_LDDATA, MSG_AUXV_AT_SUN_AUXFLAGS,
111 MSG_AUXV_AT_SUN_EMULATOR, MSG_AUXV_AT_SUN_BRANDNAME,
112 MSG_AUXV_AT_SUN_BRAND_AUX1, MSG_AUXV_AT_SUN_BRAND_AUX2,
113 MSG_AUXV_AT_SUN_BRAND_AUX3, MSG_AUXV_AT_SUN_HWCAP2,
114 MSG_AUXV_AT_SUN_BRAND_NROOT, MSG_AUXV_AT_SUN_COMMPAGE
115 };
116 static const conv_ds_msg_t ds_types_2014_2025 = {
117 CONV_DS_MSG_INIT(2014, types_2014_2025) };
118
119 static const conv_ds_t *ds[] = {
120 CONV_DS_ADDR(ds_types_0_25), CONV_DS_ADDR(ds_types_2000_2011),
121 CONV_DS_ADDR(ds_types_2014_2025), NULL };
122
123 return (conv_map_ds(ELFOSABI_NONE, EM_NONE, type, ds, fmt_flags,
124 inv_buf));
125 }
126
127
128 const char *
129 conv_cnote_signal(Word sig, Conv_fmt_flags_t fmt_flags,
130 Conv_inv_buf_t *inv_buf)
131 {
132 static const Msg sigarr[] = {
133 MSG_SIGHUP, MSG_SIGINT,
134 MSG_SIGQUIT, MSG_SIGILL,
135 MSG_SIGTRAP, MSG_SIGABRT,
136 MSG_SIGEMT, MSG_SIGFPE,
137 MSG_SIGKILL, MSG_SIGBUS,
138 MSG_SIGSEGV, MSG_SIGSYS,
139 MSG_SIGPIPE, MSG_SIGALRM,
140 MSG_SIGTERM, MSG_SIGUSR1,
141 MSG_SIGUSR2, MSG_SIGCHLD,
|