diff options
author | Sven Gothel <[email protected]> | 2015-01-30 06:50:50 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-01-30 06:50:50 +0100 |
commit | b6e3878d253abab0dc864279eb1ae01fff220acf (patch) | |
tree | d0e2fc809e422139604f8b0a62eee302eb42ef65 /src | |
parent | 0676d6f8b3ddf947b297be4de68517faf334dde0 (diff) |
Bug 1122 - Elf Parser: EM_res183 -> EM_AARCH64, detecting AArch64; Updating Shdr and Ehdr via GlueGen
Diffstat (limited to 'src')
-rw-r--r-- | src/java/jogamp/common/os/elf/Ehdr.java | 141 | ||||
-rw-r--r-- | src/java/jogamp/common/os/elf/ElfHeader.java | 27 | ||||
-rw-r--r-- | src/java/jogamp/common/os/elf/Shdr.java | 82 |
3 files changed, 182 insertions, 68 deletions
diff --git a/src/java/jogamp/common/os/elf/Ehdr.java b/src/java/jogamp/common/os/elf/Ehdr.java index e12ef4f..1aac1c1 100644 --- a/src/java/jogamp/common/os/elf/Ehdr.java +++ b/src/java/jogamp/common/os/elf/Ehdr.java @@ -1,8 +1,12 @@ -/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/JavaEmitter.java on Thu Feb 07 17:54:18 CET 2013 ----! */ +/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/JavaEmitter.java on Fri Jan 30 06:44:16 CET 2015 ----! */ package jogamp.common.os.elf; +import java.nio.*; + +import com.jogamp.gluegen.runtime.*; +import com.jogamp.common.os.*; import com.jogamp.common.nio.*; import jogamp.common.os.MachineDescriptionRuntime; @@ -13,21 +17,35 @@ public class Ehdr { private static final int mdIdx = MachineDescriptionRuntime.getStatic().ordinal(); - private static final int[] Ehdr_size = new int[] { 52 /* ARMle_EABI */, 52 /* X86_32_UNIX */, 64 /* X86_64_UNIX */, 52 /* X86_32_MACOS */, 52 /* X86_32_WINDOWS */, 64 /* X86_64_WINDOWS */ }; - private static final int[] e_ident_offset = new int[] { 0 /* ARMle_EABI */, 0 /* X86_32_UNIX */, 0 /* X86_64_UNIX */, 0 /* X86_32_MACOS */, 0 /* X86_32_WINDOWS */, 0 /* X86_64_WINDOWS */ }; - private static final int[] e_type_offset = new int[] { 16 /* ARMle_EABI */, 16 /* X86_32_UNIX */, 16 /* X86_64_UNIX */, 16 /* X86_32_MACOS */, 16 /* X86_32_WINDOWS */, 16 /* X86_64_WINDOWS */ }; - private static final int[] e_machine_offset = new int[] { 18 /* ARMle_EABI */, 18 /* X86_32_UNIX */, 18 /* X86_64_UNIX */, 18 /* X86_32_MACOS */, 18 /* X86_32_WINDOWS */, 18 /* X86_64_WINDOWS */ }; - private static final int[] e_version_offset = new int[] { 20 /* ARMle_EABI */, 20 /* X86_32_UNIX */, 20 /* X86_64_UNIX */, 20 /* X86_32_MACOS */, 20 /* X86_32_WINDOWS */, 20 /* X86_64_WINDOWS */ }; - private static final int[] e_entry_offset = new int[] { 24 /* ARMle_EABI */, 24 /* X86_32_UNIX */, 24 /* X86_64_UNIX */, 24 /* X86_32_MACOS */, 24 /* X86_32_WINDOWS */, 24 /* X86_64_WINDOWS */ }; - private static final int[] e_phoff_offset = new int[] { 28 /* ARMle_EABI */, 28 /* X86_32_UNIX */, 32 /* X86_64_UNIX */, 28 /* X86_32_MACOS */, 28 /* X86_32_WINDOWS */, 32 /* X86_64_WINDOWS */ }; - private static final int[] e_shoff_offset = new int[] { 32 /* ARMle_EABI */, 32 /* X86_32_UNIX */, 40 /* X86_64_UNIX */, 32 /* X86_32_MACOS */, 32 /* X86_32_WINDOWS */, 40 /* X86_64_WINDOWS */ }; - private static final int[] e_flags_offset = new int[] { 36 /* ARMle_EABI */, 36 /* X86_32_UNIX */, 48 /* X86_64_UNIX */, 36 /* X86_32_MACOS */, 36 /* X86_32_WINDOWS */, 48 /* X86_64_WINDOWS */ }; - private static final int[] e_ehsize_offset = new int[] { 40 /* ARMle_EABI */, 40 /* X86_32_UNIX */, 52 /* X86_64_UNIX */, 40 /* X86_32_MACOS */, 40 /* X86_32_WINDOWS */, 52 /* X86_64_WINDOWS */ }; - private static final int[] e_phentsize_offset = new int[] { 42 /* ARMle_EABI */, 42 /* X86_32_UNIX */, 54 /* X86_64_UNIX */, 42 /* X86_32_MACOS */, 42 /* X86_32_WINDOWS */, 54 /* X86_64_WINDOWS */ }; - private static final int[] e_phnum_offset = new int[] { 44 /* ARMle_EABI */, 44 /* X86_32_UNIX */, 56 /* X86_64_UNIX */, 44 /* X86_32_MACOS */, 44 /* X86_32_WINDOWS */, 56 /* X86_64_WINDOWS */ }; - private static final int[] e_shentsize_offset = new int[] { 46 /* ARMle_EABI */, 46 /* X86_32_UNIX */, 58 /* X86_64_UNIX */, 46 /* X86_32_MACOS */, 46 /* X86_32_WINDOWS */, 58 /* X86_64_WINDOWS */ }; - private static final int[] e_shnum_offset = new int[] { 48 /* ARMle_EABI */, 48 /* X86_32_UNIX */, 60 /* X86_64_UNIX */, 48 /* X86_32_MACOS */, 48 /* X86_32_WINDOWS */, 60 /* X86_64_WINDOWS */ }; - private static final int[] e_shstrndx_offset = new int[] { 50 /* ARMle_EABI */, 50 /* X86_32_UNIX */, 62 /* X86_64_UNIX */, 50 /* X86_32_MACOS */, 50 /* X86_32_WINDOWS */, 62 /* X86_64_WINDOWS */ }; + private static final int[] Ehdr_size = new int[] { 52 /* ARMle_EABI */, 52 /* X86_32_UNIX */, 64 /* X86_64_UNIX */, 52 /* X86_32_MACOS */, 52 /* X86_32_WINDOWS */, 64 /* X86_64_WINDOWS */, 52 /* SPARC_32_SUNOS */ }; + private static final int[] e_ident_offset = new int[] { 0 /* ARMle_EABI */, 0 /* X86_32_UNIX */, 0 /* X86_64_UNIX */, 0 /* X86_32_MACOS */, 0 /* X86_32_WINDOWS */, 0 /* X86_64_WINDOWS */, 0 /* SPARC_32_SUNOS */ }; + private static final int[] e_ident_size = new int[] { 16 /* ARMle_EABI */, 16 /* X86_32_UNIX */, 16 /* X86_64_UNIX */, 16 /* X86_32_MACOS */, 16 /* X86_32_WINDOWS */, 16 /* X86_64_WINDOWS */, 16 /* SPARC_32_SUNOS */ }; + private static final int[] e_type_offset = new int[] { 16 /* ARMle_EABI */, 16 /* X86_32_UNIX */, 16 /* X86_64_UNIX */, 16 /* X86_32_MACOS */, 16 /* X86_32_WINDOWS */, 16 /* X86_64_WINDOWS */, 16 /* SPARC_32_SUNOS */ }; +//private static final int[] e_type_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* X86_64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */ }; + private static final int[] e_machine_offset = new int[] { 18 /* ARMle_EABI */, 18 /* X86_32_UNIX */, 18 /* X86_64_UNIX */, 18 /* X86_32_MACOS */, 18 /* X86_32_WINDOWS */, 18 /* X86_64_WINDOWS */, 18 /* SPARC_32_SUNOS */ }; +//private static final int[] e_machine_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* X86_64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */ }; + private static final int[] e_version_offset = new int[] { 20 /* ARMle_EABI */, 20 /* X86_32_UNIX */, 20 /* X86_64_UNIX */, 20 /* X86_32_MACOS */, 20 /* X86_32_WINDOWS */, 20 /* X86_64_WINDOWS */, 20 /* SPARC_32_SUNOS */ }; +//private static final int[] e_version_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 4 /* X86_64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 4 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ }; + private static final int[] e_entry_offset = new int[] { 24 /* ARMle_EABI */, 24 /* X86_32_UNIX */, 24 /* X86_64_UNIX */, 24 /* X86_32_MACOS */, 24 /* X86_32_WINDOWS */, 24 /* X86_64_WINDOWS */, 24 /* SPARC_32_SUNOS */ }; +//private static final int[] e_entry_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* X86_64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ }; + private static final int[] e_phoff_offset = new int[] { 28 /* ARMle_EABI */, 28 /* X86_32_UNIX */, 32 /* X86_64_UNIX */, 28 /* X86_32_MACOS */, 28 /* X86_32_WINDOWS */, 32 /* X86_64_WINDOWS */, 28 /* SPARC_32_SUNOS */ }; +//private static final int[] e_phoff_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* X86_64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ }; + private static final int[] e_shoff_offset = new int[] { 32 /* ARMle_EABI */, 32 /* X86_32_UNIX */, 40 /* X86_64_UNIX */, 32 /* X86_32_MACOS */, 32 /* X86_32_WINDOWS */, 40 /* X86_64_WINDOWS */, 32 /* SPARC_32_SUNOS */ }; +//private static final int[] e_shoff_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* X86_64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ }; + private static final int[] e_flags_offset = new int[] { 36 /* ARMle_EABI */, 36 /* X86_32_UNIX */, 48 /* X86_64_UNIX */, 36 /* X86_32_MACOS */, 36 /* X86_32_WINDOWS */, 48 /* X86_64_WINDOWS */, 36 /* SPARC_32_SUNOS */ }; +//private static final int[] e_flags_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 4 /* X86_64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 4 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ }; + private static final int[] e_ehsize_offset = new int[] { 40 /* ARMle_EABI */, 40 /* X86_32_UNIX */, 52 /* X86_64_UNIX */, 40 /* X86_32_MACOS */, 40 /* X86_32_WINDOWS */, 52 /* X86_64_WINDOWS */, 40 /* SPARC_32_SUNOS */ }; +//private static final int[] e_ehsize_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* X86_64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */ }; + private static final int[] e_phentsize_offset = new int[] { 42 /* ARMle_EABI */, 42 /* X86_32_UNIX */, 54 /* X86_64_UNIX */, 42 /* X86_32_MACOS */, 42 /* X86_32_WINDOWS */, 54 /* X86_64_WINDOWS */, 42 /* SPARC_32_SUNOS */ }; +//private static final int[] e_phentsize_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* X86_64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */ }; + private static final int[] e_phnum_offset = new int[] { 44 /* ARMle_EABI */, 44 /* X86_32_UNIX */, 56 /* X86_64_UNIX */, 44 /* X86_32_MACOS */, 44 /* X86_32_WINDOWS */, 56 /* X86_64_WINDOWS */, 44 /* SPARC_32_SUNOS */ }; +//private static final int[] e_phnum_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* X86_64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */ }; + private static final int[] e_shentsize_offset = new int[] { 46 /* ARMle_EABI */, 46 /* X86_32_UNIX */, 58 /* X86_64_UNIX */, 46 /* X86_32_MACOS */, 46 /* X86_32_WINDOWS */, 58 /* X86_64_WINDOWS */, 46 /* SPARC_32_SUNOS */ }; +//private static final int[] e_shentsize_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* X86_64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */ }; + private static final int[] e_shnum_offset = new int[] { 48 /* ARMle_EABI */, 48 /* X86_32_UNIX */, 60 /* X86_64_UNIX */, 48 /* X86_32_MACOS */, 48 /* X86_32_WINDOWS */, 60 /* X86_64_WINDOWS */, 48 /* SPARC_32_SUNOS */ }; +//private static final int[] e_shnum_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* X86_64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */ }; + private static final int[] e_shstrndx_offset = new int[] { 50 /* ARMle_EABI */, 50 /* X86_32_UNIX */, 62 /* X86_64_UNIX */, 50 /* X86_32_MACOS */, 50 /* X86_32_WINDOWS */, 62 /* X86_64_WINDOWS */, 50 /* SPARC_32_SUNOS */ }; +//private static final int[] e_shstrndx_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* X86_64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */ }; public static int size() { return Ehdr_size[mdIdx]; @@ -37,11 +55,11 @@ public class Ehdr { return create(Buffers.newDirectByteBuffer(size())); } - public static Ehdr create(final java.nio.ByteBuffer buf) { + public static Ehdr create(java.nio.ByteBuffer buf) { return new Ehdr(buf); } - Ehdr(final java.nio.ByteBuffer buf) { + Ehdr(java.nio.ByteBuffer buf) { accessor = new StructAccessor(buf); } @@ -49,126 +67,179 @@ public class Ehdr { return accessor.getBuffer(); } - public Ehdr setE_ident(final byte[] val) { - accessor.setBytesAt(e_ident_offset[mdIdx], val); return this; + /** Getter for native field: CType['char *', size [fixed false, lnx64 16], [array*1]], with array length of <code>16</code> */ + public static final int getE_identArrayLength() { + return 16; + } + + /** Setter for native field: CType['char *', size [fixed false, lnx64 16], [array*1]], with array length of <code>16</code> */ + public Ehdr setE_ident(final int offset, byte[] val) { + final int arrayLength = 16; + if( offset + val.length > arrayLength ) { throw new IndexOutOfBoundsException("offset "+offset+" + val.length "+val.length+" > array-length "+arrayLength); }; + final int elemSize = Buffers.SIZEOF_BYTE; + final ByteBuffer destB = getBuffer(); + final int bTotal = arrayLength * elemSize; + if( bTotal > e_ident_size[mdIdx] ) { throw new IndexOutOfBoundsException("bTotal "+bTotal+" > size "+e_ident_size[mdIdx]+", elemSize "+elemSize+" * "+arrayLength); }; + int bOffset = e_ident_offset[mdIdx]; + final int bLimes = bOffset + bTotal; + if( bLimes > destB.limit() ) { throw new IndexOutOfBoundsException("bLimes "+bLimes+" > buffer.limit "+destB.limit()+", elemOff "+bOffset+", elemSize "+elemSize+" * "+arrayLength); }; + bOffset += elemSize * offset; + accessor.setBytesAt(bOffset, val); + return this; + } + + /** Getter for native field: CType['char *', size [fixed false, lnx64 16], [array*1]], with array length of <code>16</code> */ + public ByteBuffer getE_ident() { + return accessor.slice(e_ident_offset[mdIdx], Buffers.SIZEOF_BYTE * 16); + } + + /** Getter for native field: CType['char *', size [fixed false, lnx64 16], [array*1]], with array length of <code>16</code> */ + public byte[] getE_ident(final int offset, byte result[]) { + final int arrayLength = 16; + if( offset + result.length > arrayLength ) { throw new IndexOutOfBoundsException("offset "+offset+" + result.length "+result.length+" > array-length "+arrayLength); }; + return accessor.getBytesAt(e_ident_offset[mdIdx] + (Buffers.SIZEOF_BYTE * offset), result); } - public byte[] getE_ident() { - return accessor.getBytesAt(e_ident_offset[mdIdx], new byte[16]); } - public Ehdr setE_type(final short val) { + /** Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */ + public Ehdr setE_type(short val) { accessor.setShortAt(e_type_offset[mdIdx], val); return this; } + /** Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */ public short getE_type() { return accessor.getShortAt(e_type_offset[mdIdx]); } - public Ehdr setE_machine(final short val) { + /** Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */ + public Ehdr setE_machine(short val) { accessor.setShortAt(e_machine_offset[mdIdx], val); return this; } + /** Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */ public short getE_machine() { return accessor.getShortAt(e_machine_offset[mdIdx]); } - public Ehdr setE_version(final int val) { + /** Setter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]] */ + public Ehdr setE_version(int val) { accessor.setIntAt(e_version_offset[mdIdx], val); return this; } + /** Getter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]] */ public int getE_version() { return accessor.getIntAt(e_version_offset[mdIdx]); } - public Ehdr setE_entry(final long val) { + /** Setter for native field: CType['ElfN_Addr' (typedef), size [fixed false, lnx64 8], [int]] */ + public Ehdr setE_entry(long val) { accessor.setLongAt(e_entry_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; } + /** Getter for native field: CType['ElfN_Addr' (typedef), size [fixed false, lnx64 8], [int]] */ public long getE_entry() { return accessor.getLongAt(e_entry_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); } - public Ehdr setE_phoff(final long val) { + /** Setter for native field: CType['ElfN_Off' (typedef), size [fixed false, lnx64 8], [int]] */ + public Ehdr setE_phoff(long val) { accessor.setLongAt(e_phoff_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; } + /** Getter for native field: CType['ElfN_Off' (typedef), size [fixed false, lnx64 8], [int]] */ public long getE_phoff() { return accessor.getLongAt(e_phoff_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); } - public Ehdr setE_shoff(final long val) { + /** Setter for native field: CType['ElfN_Off' (typedef), size [fixed false, lnx64 8], [int]] */ + public Ehdr setE_shoff(long val) { accessor.setLongAt(e_shoff_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; } + /** Getter for native field: CType['ElfN_Off' (typedef), size [fixed false, lnx64 8], [int]] */ public long getE_shoff() { return accessor.getLongAt(e_shoff_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); } - public Ehdr setE_flags(final int val) { + /** Setter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]] */ + public Ehdr setE_flags(int val) { accessor.setIntAt(e_flags_offset[mdIdx], val); return this; } + /** Getter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]] */ public int getE_flags() { return accessor.getIntAt(e_flags_offset[mdIdx]); } - public Ehdr setE_ehsize(final short val) { + /** Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */ + public Ehdr setE_ehsize(short val) { accessor.setShortAt(e_ehsize_offset[mdIdx], val); return this; } + /** Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */ public short getE_ehsize() { return accessor.getShortAt(e_ehsize_offset[mdIdx]); } - public Ehdr setE_phentsize(final short val) { + /** Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */ + public Ehdr setE_phentsize(short val) { accessor.setShortAt(e_phentsize_offset[mdIdx], val); return this; } + /** Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */ public short getE_phentsize() { return accessor.getShortAt(e_phentsize_offset[mdIdx]); } - public Ehdr setE_phnum(final short val) { + /** Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */ + public Ehdr setE_phnum(short val) { accessor.setShortAt(e_phnum_offset[mdIdx], val); return this; } + /** Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */ public short getE_phnum() { return accessor.getShortAt(e_phnum_offset[mdIdx]); } - public Ehdr setE_shentsize(final short val) { + /** Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */ + public Ehdr setE_shentsize(short val) { accessor.setShortAt(e_shentsize_offset[mdIdx], val); return this; } + /** Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */ public short getE_shentsize() { return accessor.getShortAt(e_shentsize_offset[mdIdx]); } - public Ehdr setE_shnum(final short val) { + /** Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */ + public Ehdr setE_shnum(short val) { accessor.setShortAt(e_shnum_offset[mdIdx], val); return this; } + /** Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */ public short getE_shnum() { return accessor.getShortAt(e_shnum_offset[mdIdx]); } - public Ehdr setE_shstrndx(final short val) { + /** Setter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */ + public Ehdr setE_shstrndx(short val) { accessor.setShortAt(e_shstrndx_offset[mdIdx], val); return this; } + /** Getter for native field: CType['uint16_t', size [fixed true, lnx64 2], [int]] */ public short getE_shstrndx() { return accessor.getShortAt(e_shstrndx_offset[mdIdx]); } diff --git a/src/java/jogamp/common/os/elf/ElfHeader.java b/src/java/jogamp/common/os/elf/ElfHeader.java index 3447107..60b6d50 100644 --- a/src/java/jogamp/common/os/elf/ElfHeader.java +++ b/src/java/jogamp/common/os/elf/ElfHeader.java @@ -349,8 +349,8 @@ public class ElfHeader { public static final short EM_L1OM = 180; public static final short EM_INTEL181 = 181; public static final short EM_INTEL182 = 182; - public static final short EM_res183 = 183; - public static final short EM_res184 = 184; + public static final short EM_AARCH64 = 183; + public static final short EM_ARM184 = 184; public static final short EM_AVR32 = 185; public static final short EM_STM8 = 186; public static final short EM_TILE64 = 187; @@ -372,6 +372,7 @@ public class ElfHeader { public final SectionHeader[] sht; private final String string; + private final byte[] E_ident; /** * Note: The input stream shall stay untouch to be able to read sections! @@ -396,7 +397,8 @@ public class ElfHeader { */ ElfHeader(final java.nio.ByteBuffer buf, final RandomAccessFile in) throws IllegalArgumentException, IOException { d = Ehdr.create(buf); - if( !isIdentityValid(d.getE_ident()) ) { + E_ident = d.getE_ident(0, new byte[Ehdr.getE_identArrayLength()]); + if( !isIdentityValid(E_ident) ) { throw new IllegalArgumentException("Buffer is not an ELF Header"); } sht = readSectionHeaderTable(in); @@ -411,7 +413,7 @@ public class ElfHeader { * and 0 for {@link #ELFCLASSNONE}. */ public final int getArchClassBits() { - switch( d.getE_ident()[EI_CLASS] ) { + switch( E_ident[EI_CLASS] ) { case ELFCLASS32: return 32; case ELFCLASS64: return 64; default: return 0; @@ -423,22 +425,22 @@ public class ElfHeader { * {@link #ELFDATA2LSB}, {@link #ELFDATA2MSB} or {@link #ELFDATANONE}; */ public final byte getDataEncodingMode() { - return d.getE_ident()[EI_DATA]; + return E_ident[EI_DATA]; } /** Returns the ELF file version, should be {@link #EV_CURRENT}. */ public final byte getVersion() { - return d.getE_ident()[EI_VERSION]; + return E_ident[EI_VERSION]; } /** Returns the operating system and ABI for this file, 3 == Linux. Note: Often not used. */ public final byte getOSABI() { - return d.getE_ident()[EI_OSABI]; + return E_ident[EI_OSABI]; } /** Returns the version of the {@link #getOSABI() OSABI} for this file. */ public final byte getOSABIVersion() { - return d.getE_ident()[EI_ABIVERSION]; + return E_ident[EI_ABIVERSION]; } /** Returns the object file type, e.g. {@link #ET_EXEC}, .. */ @@ -452,13 +454,20 @@ public class ElfHeader { } /** - * Returns true if {@link #getMachine() machine} is a 32 or 64 bit ARM CPU + * Returns true if {@link #getMachine() machine} is a 32 bit ARM CPU * of type {@link #EM_ARM}. */ public final boolean isArm() { return getMachine() == EM_ARM; } /** + * Returns true if {@link #getMachine() machine} is a 64 bit AARCH64 ARM CPU + * of type {@link #EM_AARCH64}. */ + public final boolean isAARCH64() { + return getMachine() == EM_AARCH64; + } + + /** * Returns true if {@link #getMachine() machine} is a 32 or 64 bit Intel CPU * of type {@link #EM_386}, {@link #EM_486} or {@link #EM_X86_64}. */ public final boolean isX86_32() { diff --git a/src/java/jogamp/common/os/elf/Shdr.java b/src/java/jogamp/common/os/elf/Shdr.java index d31aec2..e5fe147 100644 --- a/src/java/jogamp/common/os/elf/Shdr.java +++ b/src/java/jogamp/common/os/elf/Shdr.java @@ -1,8 +1,12 @@ -/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/JavaEmitter.java on Thu Feb 07 17:54:18 CET 2013 ----! */ +/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/JavaEmitter.java on Fri Jan 30 06:44:16 CET 2015 ----! */ package jogamp.common.os.elf; +import java.nio.*; + +import com.jogamp.gluegen.runtime.*; +import com.jogamp.common.os.*; import com.jogamp.common.nio.*; import jogamp.common.os.MachineDescriptionRuntime; @@ -13,17 +17,27 @@ public class Shdr { private static final int mdIdx = MachineDescriptionRuntime.getStatic().ordinal(); - private static final int[] Shdr_size = new int[] { 40 /* ARMle_EABI */, 40 /* X86_32_UNIX */, 64 /* X86_64_UNIX */, 40 /* X86_32_MACOS */, 40 /* X86_32_WINDOWS */, 64 /* X86_64_WINDOWS */ }; - private static final int[] sh_name_offset = new int[] { 0 /* ARMle_EABI */, 0 /* X86_32_UNIX */, 0 /* X86_64_UNIX */, 0 /* X86_32_MACOS */, 0 /* X86_32_WINDOWS */, 0 /* X86_64_WINDOWS */ }; - private static final int[] sh_type_offset = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 4 /* X86_64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 4 /* X86_64_WINDOWS */ }; - private static final int[] sh_flags_offset = new int[] { 8 /* ARMle_EABI */, 8 /* X86_32_UNIX */, 8 /* X86_64_UNIX */, 8 /* X86_32_MACOS */, 8 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */ }; - private static final int[] sh_addr_offset = new int[] { 12 /* ARMle_EABI */, 12 /* X86_32_UNIX */, 16 /* X86_64_UNIX */, 12 /* X86_32_MACOS */, 12 /* X86_32_WINDOWS */, 16 /* X86_64_WINDOWS */ }; - private static final int[] sh_offset_offset = new int[] { 16 /* ARMle_EABI */, 16 /* X86_32_UNIX */, 24 /* X86_64_UNIX */, 16 /* X86_32_MACOS */, 16 /* X86_32_WINDOWS */, 24 /* X86_64_WINDOWS */ }; - private static final int[] sh_size_offset = new int[] { 20 /* ARMle_EABI */, 20 /* X86_32_UNIX */, 32 /* X86_64_UNIX */, 20 /* X86_32_MACOS */, 20 /* X86_32_WINDOWS */, 32 /* X86_64_WINDOWS */ }; - private static final int[] sh_link_offset = new int[] { 24 /* ARMle_EABI */, 24 /* X86_32_UNIX */, 40 /* X86_64_UNIX */, 24 /* X86_32_MACOS */, 24 /* X86_32_WINDOWS */, 40 /* X86_64_WINDOWS */ }; - private static final int[] sh_info_offset = new int[] { 28 /* ARMle_EABI */, 28 /* X86_32_UNIX */, 44 /* X86_64_UNIX */, 28 /* X86_32_MACOS */, 28 /* X86_32_WINDOWS */, 44 /* X86_64_WINDOWS */ }; - private static final int[] sh_addralign_offset = new int[] { 32 /* ARMle_EABI */, 32 /* X86_32_UNIX */, 48 /* X86_64_UNIX */, 32 /* X86_32_MACOS */, 32 /* X86_32_WINDOWS */, 48 /* X86_64_WINDOWS */ }; - private static final int[] sh_entsize_offset = new int[] { 36 /* ARMle_EABI */, 36 /* X86_32_UNIX */, 56 /* X86_64_UNIX */, 36 /* X86_32_MACOS */, 36 /* X86_32_WINDOWS */, 56 /* X86_64_WINDOWS */ }; + private static final int[] Shdr_size = new int[] { 40 /* ARMle_EABI */, 40 /* X86_32_UNIX */, 64 /* X86_64_UNIX */, 40 /* X86_32_MACOS */, 40 /* X86_32_WINDOWS */, 64 /* X86_64_WINDOWS */, 40 /* SPARC_32_SUNOS */ }; + private static final int[] sh_name_offset = new int[] { 0 /* ARMle_EABI */, 0 /* X86_32_UNIX */, 0 /* X86_64_UNIX */, 0 /* X86_32_MACOS */, 0 /* X86_32_WINDOWS */, 0 /* X86_64_WINDOWS */, 0 /* SPARC_32_SUNOS */ }; +//private static final int[] sh_name_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 4 /* X86_64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 4 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ }; + private static final int[] sh_type_offset = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 4 /* X86_64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 4 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ }; +//private static final int[] sh_type_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 4 /* X86_64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 4 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ }; + private static final int[] sh_flags_offset = new int[] { 8 /* ARMle_EABI */, 8 /* X86_32_UNIX */, 8 /* X86_64_UNIX */, 8 /* X86_32_MACOS */, 8 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 8 /* SPARC_32_SUNOS */ }; +//private static final int[] sh_flags_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* X86_64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ }; + private static final int[] sh_addr_offset = new int[] { 12 /* ARMle_EABI */, 12 /* X86_32_UNIX */, 16 /* X86_64_UNIX */, 12 /* X86_32_MACOS */, 12 /* X86_32_WINDOWS */, 16 /* X86_64_WINDOWS */, 12 /* SPARC_32_SUNOS */ }; +//private static final int[] sh_addr_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* X86_64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ }; + private static final int[] sh_offset_offset = new int[] { 16 /* ARMle_EABI */, 16 /* X86_32_UNIX */, 24 /* X86_64_UNIX */, 16 /* X86_32_MACOS */, 16 /* X86_32_WINDOWS */, 24 /* X86_64_WINDOWS */, 16 /* SPARC_32_SUNOS */ }; +//private static final int[] sh_offset_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* X86_64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ }; + private static final int[] sh_size_offset = new int[] { 20 /* ARMle_EABI */, 20 /* X86_32_UNIX */, 32 /* X86_64_UNIX */, 20 /* X86_32_MACOS */, 20 /* X86_32_WINDOWS */, 32 /* X86_64_WINDOWS */, 20 /* SPARC_32_SUNOS */ }; +//private static final int[] sh_size_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* X86_64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ }; + private static final int[] sh_link_offset = new int[] { 24 /* ARMle_EABI */, 24 /* X86_32_UNIX */, 40 /* X86_64_UNIX */, 24 /* X86_32_MACOS */, 24 /* X86_32_WINDOWS */, 40 /* X86_64_WINDOWS */, 24 /* SPARC_32_SUNOS */ }; +//private static final int[] sh_link_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 4 /* X86_64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 4 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ }; + private static final int[] sh_info_offset = new int[] { 28 /* ARMle_EABI */, 28 /* X86_32_UNIX */, 44 /* X86_64_UNIX */, 28 /* X86_32_MACOS */, 28 /* X86_32_WINDOWS */, 44 /* X86_64_WINDOWS */, 28 /* SPARC_32_SUNOS */ }; +//private static final int[] sh_info_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 4 /* X86_64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 4 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ }; + private static final int[] sh_addralign_offset = new int[] { 32 /* ARMle_EABI */, 32 /* X86_32_UNIX */, 48 /* X86_64_UNIX */, 32 /* X86_32_MACOS */, 32 /* X86_32_WINDOWS */, 48 /* X86_64_WINDOWS */, 32 /* SPARC_32_SUNOS */ }; +//private static final int[] sh_addralign_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* X86_64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ }; + private static final int[] sh_entsize_offset = new int[] { 36 /* ARMle_EABI */, 36 /* X86_32_UNIX */, 56 /* X86_64_UNIX */, 36 /* X86_32_MACOS */, 36 /* X86_32_WINDOWS */, 56 /* X86_64_WINDOWS */, 36 /* SPARC_32_SUNOS */ }; +//private static final int[] sh_entsize_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* X86_64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ }; public static int size() { return Shdr_size[mdIdx]; @@ -33,11 +47,11 @@ public class Shdr { return create(Buffers.newDirectByteBuffer(size())); } - public static Shdr create(final java.nio.ByteBuffer buf) { + public static Shdr create(java.nio.ByteBuffer buf) { return new Shdr(buf); } - Shdr(final java.nio.ByteBuffer buf) { + Shdr(java.nio.ByteBuffer buf) { accessor = new StructAccessor(buf); } @@ -45,92 +59,112 @@ public class Shdr { return accessor.getBuffer(); } - public Shdr setSh_name(final int val) { + /** Setter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]] */ + public Shdr setSh_name(int val) { accessor.setIntAt(sh_name_offset[mdIdx], val); return this; } + /** Getter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]] */ public int getSh_name() { return accessor.getIntAt(sh_name_offset[mdIdx]); } - public Shdr setSh_type(final int val) { + /** Setter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]] */ + public Shdr setSh_type(int val) { accessor.setIntAt(sh_type_offset[mdIdx], val); return this; } + /** Getter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]] */ public int getSh_type() { return accessor.getIntAt(sh_type_offset[mdIdx]); } - public Shdr setSh_flags(final long val) { + /** Setter for native field: CType['ElfN_size' (typedef), size [fixed false, lnx64 8], [int]] */ + public Shdr setSh_flags(long val) { accessor.setLongAt(sh_flags_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; } + /** Getter for native field: CType['ElfN_size' (typedef), size [fixed false, lnx64 8], [int]] */ public long getSh_flags() { return accessor.getLongAt(sh_flags_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); } - public Shdr setSh_addr(final long val) { + /** Setter for native field: CType['ElfN_Addr' (typedef), size [fixed false, lnx64 8], [int]] */ + public Shdr setSh_addr(long val) { accessor.setLongAt(sh_addr_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; } + /** Getter for native field: CType['ElfN_Addr' (typedef), size [fixed false, lnx64 8], [int]] */ public long getSh_addr() { return accessor.getLongAt(sh_addr_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); } - public Shdr setSh_offset(final long val) { + /** Setter for native field: CType['ElfN_Off' (typedef), size [fixed false, lnx64 8], [int]] */ + public Shdr setSh_offset(long val) { accessor.setLongAt(sh_offset_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; } + /** Getter for native field: CType['ElfN_Off' (typedef), size [fixed false, lnx64 8], [int]] */ public long getSh_offset() { return accessor.getLongAt(sh_offset_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); } - public Shdr setSh_size(final long val) { + /** Setter for native field: CType['ElfN_size' (typedef), size [fixed false, lnx64 8], [int]] */ + public Shdr setSh_size(long val) { accessor.setLongAt(sh_size_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; } + /** Getter for native field: CType['ElfN_size' (typedef), size [fixed false, lnx64 8], [int]] */ public long getSh_size() { return accessor.getLongAt(sh_size_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); } - public Shdr setSh_link(final int val) { + /** Setter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]] */ + public Shdr setSh_link(int val) { accessor.setIntAt(sh_link_offset[mdIdx], val); return this; } + /** Getter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]] */ public int getSh_link() { return accessor.getIntAt(sh_link_offset[mdIdx]); } - public Shdr setSh_info(final int val) { + /** Setter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]] */ + public Shdr setSh_info(int val) { accessor.setIntAt(sh_info_offset[mdIdx], val); return this; } + /** Getter for native field: CType['uint32_t', size [fixed true, lnx64 4], [int]] */ public int getSh_info() { return accessor.getIntAt(sh_info_offset[mdIdx]); } - public Shdr setSh_addralign(final long val) { + /** Setter for native field: CType['ElfN_size' (typedef), size [fixed false, lnx64 8], [int]] */ + public Shdr setSh_addralign(long val) { accessor.setLongAt(sh_addralign_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; } + /** Getter for native field: CType['ElfN_size' (typedef), size [fixed false, lnx64 8], [int]] */ public long getSh_addralign() { return accessor.getLongAt(sh_addralign_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); } - public Shdr setSh_entsize(final long val) { + /** Setter for native field: CType['ElfN_size' (typedef), size [fixed false, lnx64 8], [int]] */ + public Shdr setSh_entsize(long val) { accessor.setLongAt(sh_entsize_offset[mdIdx], val, MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); return this; } + /** Getter for native field: CType['ElfN_size' (typedef), size [fixed false, lnx64 8], [int]] */ public long getSh_entsize() { return accessor.getLongAt(sh_entsize_offset[mdIdx], MachineDescriptionRuntime.getStatic().md.longSizeInBytes()); } |