26package org.jau.sys.elf;
28import org.jau.io.Buffers;
29import org.jau.io.StructAccessor;
30import org.jau.sys.MachineDataInfo;
36 private final int mdIdx;
39 private static final int[] Shdr_size =
new int[] { 40 , 40 , 40 , 40 , 40 , 40 , 64 , 64 };
40 private static final int[] sh_name_offset =
new int[] { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 };
42 private static final int[] sh_type_offset =
new int[] { 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 };
44 private static final int[] sh_flags_offset =
new int[] { 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 };
46 private static final int[] sh_addr_offset =
new int[] { 12 , 12 , 12 , 12 , 12 , 12 , 16 , 16 };
48 private static final int[] sh_offset_offset =
new int[] { 16 , 16 , 16 , 16 , 16 , 16 , 24 , 24 };
50 private static final int[] sh_size_offset =
new int[] { 20 , 20 , 20 , 20 , 20 , 20 , 32 , 32 };
52 private static final int[] sh_link_offset =
new int[] { 24 , 24 , 24 , 24 , 24 , 24 , 40 , 40 };
54 private static final int[] sh_info_offset =
new int[] { 28 , 28 , 28 , 28 , 28 , 28 , 44 , 44 };
56 private static final int[] sh_addralign_offset =
new int[] { 32 , 32 , 32 , 32 , 32 , 32 , 48 , 48 };
58 private static final int[] sh_entsize_offset =
new int[] { 36 , 36 , 36 , 36 , 36 , 36 , 56 , 56 };
67 accessor.
setIntAt(sh_name_offset[mdIdx], val);
73 return accessor.
getIntAt(sh_name_offset[mdIdx]);
78 accessor.
setIntAt(sh_type_offset[mdIdx], val);
84 return accessor.
getIntAt(sh_type_offset[mdIdx]);
89 accessor.
setLongAt(sh_flags_offset[mdIdx], val, md.longSizeInBytes());
95 return accessor.
getLongAt(sh_flags_offset[mdIdx], md.longSizeInBytes());
100 accessor.
setLongAt(sh_addr_offset[mdIdx], val, md.longSizeInBytes());
106 return accessor.
getLongAt(sh_addr_offset[mdIdx], md.longSizeInBytes());
111 accessor.
setLongAt(sh_offset_offset[mdIdx], val, md.longSizeInBytes());
117 return accessor.
getLongAt(sh_offset_offset[mdIdx], md.longSizeInBytes());
122 accessor.
setLongAt(sh_size_offset[mdIdx], val, md.longSizeInBytes());
128 return accessor.
getLongAt(sh_size_offset[mdIdx], md.longSizeInBytes());
133 accessor.
setIntAt(sh_link_offset[mdIdx], val);
139 return accessor.
getIntAt(sh_link_offset[mdIdx]);
144 accessor.
setIntAt(sh_info_offset[mdIdx], val);
150 return accessor.
getIntAt(sh_info_offset[mdIdx]);
155 accessor.
setLongAt(sh_addralign_offset[mdIdx], val, md.longSizeInBytes());
161 return accessor.
getLongAt(sh_addralign_offset[mdIdx], md.longSizeInBytes());
166 accessor.
setLongAt(sh_entsize_offset[mdIdx], val, md.longSizeInBytes());
172 return accessor.
getLongAt(sh_entsize_offset[mdIdx], md.longSizeInBytes());
176 public static int size(
final int mdIdx) {
177 return Shdr_size[mdIdx];
184 public static Shdr create(
final int mdIdx,
final java.nio.ByteBuffer buf) {
185 return new Shdr(mdIdx, buf);
188 Shdr(
final int mdIdx,
final java.nio.ByteBuffer buf) {
Utility methods allowing easy java.nio.Buffer manipulations.
static ByteBuffer newDirectByteBuffer(final int size)
Allocates a new direct ByteBuffer with the specified number of elements.
final void setLongAt(final int byteOffset, final long v)
Puts a long at the specified byteOffset.
final void setIntAt(final int byteOffset, final int v)
Puts a int at the specified byteOffset.
final ByteBuffer getBuffer()
final int getIntAt(final int byteOffset)
Retrieves the int at the specified byteOffset.
final long getLongAt(final int byteOffset)
Retrieves the long at the specified byteOffset.
Machine data description for alignment and size onle, see com.jogamp.gluegen.
int getSh_name()
Getter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]].
static int size(final int mdIdx)
long getSh_addr()
Getter for native field: CType['ElfN_Addr' (typedef), size [fixed false, lnx64 8],...
Shdr setSh_info(final int val)
Setter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]].
Shdr setSh_name(final int val)
Setter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]].
long getSh_flags()
Getter for native field: CType['ElfN_size' (typedef), size [fixed false, lnx64 8],...
Shdr setSh_addralign(final long val)
Setter for native field: CType['ElfN_size' (typedef), size [fixed false, lnx64 8],...
Shdr setSh_entsize(final long val)
Setter for native field: CType['ElfN_size' (typedef), size [fixed false, lnx64 8],...
long getSh_entsize()
Getter for native field: CType['ElfN_size' (typedef), size [fixed false, lnx64 8],...
Shdr setSh_flags(final long val)
Setter for native field: CType['ElfN_size' (typedef), size [fixed false, lnx64 8],...
Shdr setSh_addr(final long val)
Setter for native field: CType['ElfN_Addr' (typedef), size [fixed false, lnx64 8],...
Shdr setSh_link(final int val)
Setter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]].
int getSh_info()
Getter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]].
Shdr setSh_size(final long val)
Setter for native field: CType['ElfN_size' (typedef), size [fixed false, lnx64 8],...
int getSh_link()
Getter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]].
java.nio.ByteBuffer getBuffer()
Shdr setSh_offset(final long val)
Setter for native field: CType['ElfN_Off' (typedef), size [fixed false, lnx64 8], [int]].
static Shdr create(final int mdIdx)
long getSh_size()
Getter for native field: CType['ElfN_size' (typedef), size [fixed false, lnx64 8],...
long getSh_addralign()
Getter for native field: CType['ElfN_size' (typedef), size [fixed false, lnx64 8],...
int getSh_type()
Getter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]].
static Shdr create(final int mdIdx, final java.nio.ByteBuffer buf)
long getSh_offset()
Getter for native field: CType['ElfN_Off' (typedef), size [fixed false, lnx64 8], [int]].
Shdr setSh_type(final int val)
Setter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]].
Static enumeration of MachineDataInfo instances used for high performance data size and alignment loo...