jaulib v1.3.6
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
Ehdr_p2.java
Go to the documentation of this file.
1/**
2 * Author: Sven Gothel <sgothel@jausoft.com>
3 * Copyright (c) 2021 Gothel Software e.K.
4 * Copyright (c) 2013 Gothel Software e.K.
5 * Copyright (c) 2013 JogAmp Community.
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining
8 * a copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sublicense, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be
16 * included in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26package org.jau.sys.elf;
27
28import org.jau.io.Buffers;
29import org.jau.io.StructAccessor;
30import org.jau.sys.MachineDataInfo;
31
32public class Ehdr_p2 {
33
34 StructAccessor accessor;
35
36 private final int mdIdx;
37 private final MachineDataInfo md;
38
39 private static final int[] Ehdr_p2_size = new int[] { 28 /* ARM_MIPS_32 */, 28 /* X86_32_UNIX */, 28 /* X86_32_MACOS */, 28 /* PPC_32_UNIX */, 28 /* SPARC_32_SUNOS */, 28 /* X86_32_WINDOWS */, 40 /* LP64_UNIX */, 40 /* X86_64_WINDOWS */ };
40 private static final int[] e_entry_offset = new int[] { 0 /* ARM_MIPS_32 */, 0 /* X86_32_UNIX */, 0 /* X86_32_MACOS */, 0 /* PPC_32_UNIX */, 0 /* SPARC_32_SUNOS */, 0 /* X86_32_WINDOWS */, 0 /* LP64_UNIX */, 0 /* X86_64_WINDOWS */ };
41//private static final int[] e_entry_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 8 /* LP64_UNIX */, 8 /* X86_64_WINDOWS */ };
42 private static final int[] e_phoff_offset = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 8 /* LP64_UNIX */, 8 /* X86_64_WINDOWS */ };
43//private static final int[] e_phoff_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 8 /* LP64_UNIX */, 8 /* X86_64_WINDOWS */ };
44 private static final int[] e_shoff_offset = new int[] { 8 /* ARM_MIPS_32 */, 8 /* X86_32_UNIX */, 8 /* X86_32_MACOS */, 8 /* PPC_32_UNIX */, 8 /* SPARC_32_SUNOS */, 8 /* X86_32_WINDOWS */, 16 /* LP64_UNIX */, 16 /* X86_64_WINDOWS */ };
45//private static final int[] e_shoff_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 8 /* LP64_UNIX */, 8 /* X86_64_WINDOWS */ };
46 private static final int[] e_flags_offset = new int[] { 12 /* ARM_MIPS_32 */, 12 /* X86_32_UNIX */, 12 /* X86_32_MACOS */, 12 /* PPC_32_UNIX */, 12 /* SPARC_32_SUNOS */, 12 /* X86_32_WINDOWS */, 24 /* LP64_UNIX */, 24 /* X86_64_WINDOWS */ };
47//private static final int[] e_flags_size = new int[] { 4 /* ARM_MIPS_32 */, 4 /* X86_32_UNIX */, 4 /* X86_32_MACOS */, 4 /* PPC_32_UNIX */, 4 /* SPARC_32_SUNOS */, 4 /* X86_32_WINDOWS */, 4 /* LP64_UNIX */, 4 /* X86_64_WINDOWS */ };
48 private static final int[] e_ehsize_offset = new int[] { 16 /* ARM_MIPS_32 */, 16 /* X86_32_UNIX */, 16 /* X86_32_MACOS */, 16 /* PPC_32_UNIX */, 16 /* SPARC_32_SUNOS */, 16 /* X86_32_WINDOWS */, 28 /* LP64_UNIX */, 28 /* X86_64_WINDOWS */ };
49//private static final int[] e_ehsize_size = new int[] { 2 /* ARM_MIPS_32 */, 2 /* X86_32_UNIX */, 2 /* X86_32_MACOS */, 2 /* PPC_32_UNIX */, 2 /* SPARC_32_SUNOS */, 2 /* X86_32_WINDOWS */, 2 /* LP64_UNIX */, 2 /* X86_64_WINDOWS */ };
50 private static final int[] e_phentsize_offset = new int[] { 18 /* ARM_MIPS_32 */, 18 /* X86_32_UNIX */, 18 /* X86_32_MACOS */, 18 /* PPC_32_UNIX */, 18 /* SPARC_32_SUNOS */, 18 /* X86_32_WINDOWS */, 30 /* LP64_UNIX */, 30 /* X86_64_WINDOWS */ };
51//private static final int[] e_phentsize_size = new int[] { 2 /* ARM_MIPS_32 */, 2 /* X86_32_UNIX */, 2 /* X86_32_MACOS */, 2 /* PPC_32_UNIX */, 2 /* SPARC_32_SUNOS */, 2 /* X86_32_WINDOWS */, 2 /* LP64_UNIX */, 2 /* X86_64_WINDOWS */ };
52 private static final int[] e_phnum_offset = new int[] { 20 /* ARM_MIPS_32 */, 20 /* X86_32_UNIX */, 20 /* X86_32_MACOS */, 20 /* PPC_32_UNIX */, 20 /* SPARC_32_SUNOS */, 20 /* X86_32_WINDOWS */, 32 /* LP64_UNIX */, 32 /* X86_64_WINDOWS */ };
53//private static final int[] e_phnum_size = new int[] { 2 /* ARM_MIPS_32 */, 2 /* X86_32_UNIX */, 2 /* X86_32_MACOS */, 2 /* PPC_32_UNIX */, 2 /* SPARC_32_SUNOS */, 2 /* X86_32_WINDOWS */, 2 /* LP64_UNIX */, 2 /* X86_64_WINDOWS */ };
54 private static final int[] e_shentsize_offset = new int[] { 22 /* ARM_MIPS_32 */, 22 /* X86_32_UNIX */, 22 /* X86_32_MACOS */, 22 /* PPC_32_UNIX */, 22 /* SPARC_32_SUNOS */, 22 /* X86_32_WINDOWS */, 34 /* LP64_UNIX */, 34 /* X86_64_WINDOWS */ };
55//private static final int[] e_shentsize_size = new int[] { 2 /* ARM_MIPS_32 */, 2 /* X86_32_UNIX */, 2 /* X86_32_MACOS */, 2 /* PPC_32_UNIX */, 2 /* SPARC_32_SUNOS */, 2 /* X86_32_WINDOWS */, 2 /* LP64_UNIX */, 2 /* X86_64_WINDOWS */ };
56 private static final int[] e_shnum_offset = new int[] { 24 /* ARM_MIPS_32 */, 24 /* X86_32_UNIX */, 24 /* X86_32_MACOS */, 24 /* PPC_32_UNIX */, 24 /* SPARC_32_SUNOS */, 24 /* X86_32_WINDOWS */, 36 /* LP64_UNIX */, 36 /* X86_64_WINDOWS */ };
57//private static final int[] e_shnum_size = new int[] { 2 /* ARM_MIPS_32 */, 2 /* X86_32_UNIX */, 2 /* X86_32_MACOS */, 2 /* PPC_32_UNIX */, 2 /* SPARC_32_SUNOS */, 2 /* X86_32_WINDOWS */, 2 /* LP64_UNIX */, 2 /* X86_64_WINDOWS */ };
58 private static final int[] e_shstrndx_offset = new int[] { 26 /* ARM_MIPS_32 */, 26 /* X86_32_UNIX */, 26 /* X86_32_MACOS */, 26 /* PPC_32_UNIX */, 26 /* SPARC_32_SUNOS */, 26 /* X86_32_WINDOWS */, 38 /* LP64_UNIX */, 38 /* X86_64_WINDOWS */ };
59//private static final int[] e_shstrndx_size = new int[] { 2 /* ARM_MIPS_32 */, 2 /* X86_32_UNIX */, 2 /* X86_32_MACOS */, 2 /* PPC_32_UNIX */, 2 /* SPARC_32_SUNOS */, 2 /* X86_32_WINDOWS */, 2 /* LP64_UNIX */, 2 /* X86_64_WINDOWS */ };
60
61 public java.nio.ByteBuffer getBuffer() {
62 return accessor.getBuffer();
63 }
64
65 /** Setter for native field: CType['ElfN_Addr' (typedef), size [fixed false, lnx64 8], [int]] */
66 public Ehdr_p2 setE_entry(final long val) {
67 accessor.setLongAt(e_entry_offset[mdIdx], val, md.longSizeInBytes());
68 return this;
69 }
70
71 /** Getter for native field: CType['ElfN_Addr' (typedef), size [fixed false, lnx64 8], [int]] */
72 public long getE_entry() {
73 return accessor.getLongAt(e_entry_offset[mdIdx], md.longSizeInBytes());
74 }
75
76 /** Setter for native field: CType['ElfN_Off' (typedef), size [fixed false, lnx64 8], [int]] */
77 public Ehdr_p2 setE_phoff(final long val) {
78 accessor.setLongAt(e_phoff_offset[mdIdx], val, md.longSizeInBytes());
79 return this;
80 }
81
82 /** Getter for native field: CType['ElfN_Off' (typedef), size [fixed false, lnx64 8], [int]] */
83 public long getE_phoff() {
84 return accessor.getLongAt(e_phoff_offset[mdIdx], md.longSizeInBytes());
85 }
86
87 /** Setter for native field: CType['ElfN_Off' (typedef), size [fixed false, lnx64 8], [int]] */
88 public Ehdr_p2 setE_shoff(final long val) {
89 accessor.setLongAt(e_shoff_offset[mdIdx], val, md.longSizeInBytes());
90 return this;
91 }
92
93 /** Getter for native field: CType['ElfN_Off' (typedef), size [fixed false, lnx64 8], [int]] */
94 public long getE_shoff() {
95 return accessor.getLongAt(e_shoff_offset[mdIdx], md.longSizeInBytes());
96 }
97
98 /** Setter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]] */
99 public Ehdr_p2 setE_flags(final int val) {
100 accessor.setIntAt(e_flags_offset[mdIdx], val);
101 return this;
102 }
103
104 /** Getter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]] */
105 public int getE_flags() {
106 return accessor.getIntAt(e_flags_offset[mdIdx]);
107 }
108
109 /** Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */
110 public Ehdr_p2 setE_ehsize(final short val) {
111 accessor.setShortAt(e_ehsize_offset[mdIdx], val);
112 return this;
113 }
114
115 /** Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */
116 public short getE_ehsize() {
117 return accessor.getShortAt(e_ehsize_offset[mdIdx]);
118 }
119
120 /** Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */
121 public Ehdr_p2 setE_phentsize(final short val) {
122 accessor.setShortAt(e_phentsize_offset[mdIdx], val);
123 return this;
124 }
125
126 /** Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */
127 public short getE_phentsize() {
128 return accessor.getShortAt(e_phentsize_offset[mdIdx]);
129 }
130
131 /** Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */
132 public Ehdr_p2 setE_phnum(final short val) {
133 accessor.setShortAt(e_phnum_offset[mdIdx], val);
134 return this;
135 }
136
137 /** Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */
138 public short getE_phnum() {
139 return accessor.getShortAt(e_phnum_offset[mdIdx]);
140 }
141
142 /** Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */
143 public Ehdr_p2 setE_shentsize(final short val) {
144 accessor.setShortAt(e_shentsize_offset[mdIdx], val);
145 return this;
146 }
147
148 /** Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */
149 public short getE_shentsize() {
150 return accessor.getShortAt(e_shentsize_offset[mdIdx]);
151 }
152
153 /** Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */
154 public Ehdr_p2 setE_shnum(final short val) {
155 accessor.setShortAt(e_shnum_offset[mdIdx], val);
156 return this;
157 }
158
159 /** Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */
160 public short getE_shnum() {
161 return accessor.getShortAt(e_shnum_offset[mdIdx]);
162 }
163
164 /** Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */
165 public Ehdr_p2 setE_shstrndx(final short val) {
166 accessor.setShortAt(e_shstrndx_offset[mdIdx], val);
167 return this;
168 }
169
170 /** Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */
171 public short getE_shstrndx() {
172 return accessor.getShortAt(e_shstrndx_offset[mdIdx]);
173 }
174
175 // --- Begin CustomJavaCode .cfg declarations
176 public static int size(final int mdIdx) {
177 return Ehdr_p2_size[mdIdx];
178 }
179
180 public static Ehdr_p2 create(final int mdIdx) {
181 return create(mdIdx, Buffers.newDirectByteBuffer( size(mdIdx) ) );
182 }
183
184 public static Ehdr_p2 create(final int mdIdx, final java.nio.ByteBuffer buf) {
185 return new Ehdr_p2(mdIdx, buf);
186 }
187
188 Ehdr_p2(final int mdIdx, final java.nio.ByteBuffer buf) {
189 this.mdIdx = mdIdx;
190 this.md = MachineDataInfo.StaticConfig.values()[mdIdx].md;
191 this.accessor = new StructAccessor(buf);
192 }
193 // ---- End CustomJavaCode .cfg declarations
194}
Utility methods allowing easy java.nio.Buffer manipulations.
Definition Buffers.java:43
static ByteBuffer newDirectByteBuffer(final int size)
Allocates a new direct ByteBuffer with the specified number of elements.
Definition Buffers.java:61
Machine data description for alignment and size onle, see com.jogamp.gluegen.
Ehdr_p2 setE_flags(final int val)
Setter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]].
Definition Ehdr_p2.java:99
Ehdr_p2 setE_shstrndx(final short val)
Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]].
Definition Ehdr_p2.java:165
Ehdr_p2 setE_shnum(final short val)
Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]].
Definition Ehdr_p2.java:154
Ehdr_p2 setE_entry(final long val)
Setter for native field: CType['ElfN_Addr' (typedef), size [fixed false, lnx64 8],...
Definition Ehdr_p2.java:66
static Ehdr_p2 create(final int mdIdx)
Definition Ehdr_p2.java:180
long getE_phoff()
Getter for native field: CType['ElfN_Off' (typedef), size [fixed false, lnx64 8], [int]].
Definition Ehdr_p2.java:83
short getE_shnum()
Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]].
Definition Ehdr_p2.java:160
int getE_flags()
Getter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]].
Definition Ehdr_p2.java:105
Ehdr_p2 setE_phoff(final long val)
Setter for native field: CType['ElfN_Off' (typedef), size [fixed false, lnx64 8], [int]].
Definition Ehdr_p2.java:77
static Ehdr_p2 create(final int mdIdx, final java.nio.ByteBuffer buf)
Definition Ehdr_p2.java:184
Ehdr_p2 setE_shentsize(final short val)
Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]].
Definition Ehdr_p2.java:143
Ehdr_p2 setE_shoff(final long val)
Setter for native field: CType['ElfN_Off' (typedef), size [fixed false, lnx64 8], [int]].
Definition Ehdr_p2.java:88
long getE_entry()
Getter for native field: CType['ElfN_Addr' (typedef), size [fixed false, lnx64 8],...
Definition Ehdr_p2.java:72
Ehdr_p2 setE_phentsize(final short val)
Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]].
Definition Ehdr_p2.java:121
short getE_shstrndx()
Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]].
Definition Ehdr_p2.java:171
static int size(final int mdIdx)
Definition Ehdr_p2.java:176
short getE_phentsize()
Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]].
Definition Ehdr_p2.java:127
short getE_phnum()
Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]].
Definition Ehdr_p2.java:138
java.nio.ByteBuffer getBuffer()
Definition Ehdr_p2.java:61
short getE_shentsize()
Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]].
Definition Ehdr_p2.java:149
Ehdr_p2 setE_ehsize(final short val)
Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]].
Definition Ehdr_p2.java:110
short getE_ehsize()
Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]].
Definition Ehdr_p2.java:116
long getE_shoff()
Getter for native field: CType['ElfN_Off' (typedef), size [fixed false, lnx64 8], [int]].
Definition Ehdr_p2.java:94
Ehdr_p2 setE_phnum(final short val)
Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]].
Definition Ehdr_p2.java:132
Static enumeration of MachineDataInfo instances used for high performance data size and alignment loo...