From 791a2749886f02ec7b8db25bf8862e8269b96da5 Mon Sep 17 00:00:00 2001
From: Harvey Harrison packageName
is returned.
*/
public static final int getPackageInfoVersionCode(String packageName) {
@@ -64,10 +64,10 @@ public class AndroidUtils {
}
return -1;
}
-
+
/**
- * @return null if platform is not Android or no Android Context is registered
- * via {@link jogamp.common.os.android.StaticContext#init(android.content.Context) StaticContext.init(..)},
+ * @return null if platform is not Android or no Android Context is registered
+ * via {@link jogamp.common.os.android.StaticContext#init(android.content.Context) StaticContext.init(..)},
* otherwise the found package version name of packageName
is returned.
*/
public static final String getPackageInfoVersionName(String packageName) {
@@ -76,18 +76,18 @@ public class AndroidUtils {
}
return null;
}
-
+
/**
- * @return null if platform is not Android or no Android Context is registered
- * via {@link jogamp.common.os.android.StaticContext#init(android.content.Context) StaticContext.init(..)},
- * otherwise the context relative world readable temp
directory returned.
+ * @return null if platform is not Android or no Android Context is registered
+ * via {@link jogamp.common.os.android.StaticContext#init(android.content.Context) StaticContext.init(..)},
+ * otherwise the context relative world readable temp
directory returned.
*/
public static File getTempRoot()
throws RuntimeException {
if(null != androidGetTempRootMethod) {
return (File) ReflectionUtil.callMethod(null, androidGetTempRootMethod);
}
- return null;
- }
-
+ return null;
+ }
+
}
diff --git a/src/java/jogamp/common/os/BionicDynamicLinkerImpl.java b/src/java/jogamp/common/os/BionicDynamicLinkerImpl.java
index 453f200..09057f8 100644
--- a/src/java/jogamp/common/os/BionicDynamicLinkerImpl.java
+++ b/src/java/jogamp/common/os/BionicDynamicLinkerImpl.java
@@ -37,7 +37,7 @@ package jogamp.common.os;
public final class BionicDynamicLinkerImpl extends UnixDynamicLinkerImpl {
private static final long RTLD_DEFAULT = 0xffffffffL;
// static final long RTLD_NEXT = 0xfffffffeL;
-
+
private static final int RTLD_LAZY = 0x00001;
// static final int RTLD_NOW = 0x00000;
private static final int RTLD_LOCAL = 0x00000;
@@ -52,10 +52,10 @@ public final class BionicDynamicLinkerImpl extends UnixDynamicLinkerImpl {
public final long openLibraryGlobal(String pathname, boolean debug) throws SecurityException {
return this.openLibraryImpl(pathname, RTLD_LAZY | RTLD_GLOBAL, debug);
}
-
+
@Override
- public final long lookupSymbolGlobal(String symbolName) throws SecurityException {
+ public final long lookupSymbolGlobal(String symbolName) throws SecurityException {
return this.lookupSymbolGlobalImpl(RTLD_DEFAULT, symbolName);
}
-
+
}
diff --git a/src/java/jogamp/common/os/DynamicLinkerImpl.java b/src/java/jogamp/common/os/DynamicLinkerImpl.java
index 4686cd2..39c112e 100644
--- a/src/java/jogamp/common/os/DynamicLinkerImpl.java
+++ b/src/java/jogamp/common/os/DynamicLinkerImpl.java
@@ -37,9 +37,9 @@ import com.jogamp.common.util.LongObjectHashMap;
// and sealed jogamp.common.* package definition
// ensuring no abuse via subclassing.
//
-
+
private final LongObjectHashMap libHandle2Name = new LongObjectHashMap( 16 /* initialCapacity */ );
-
+
protected static final class LibRef {
public LibRef(String name) {
this.name = name;
@@ -48,18 +48,18 @@ import com.jogamp.common.util.LongObjectHashMap;
public final int incrRefCount() { return ++refCount; }
public final int decrRefCount() { return --refCount; }
public final int getRefCount() { return refCount; }
-
+
public final String getName() { return name; }
public final String toString() { return "LibRef["+name+", refCount "+refCount+"]"; }
-
+
private final String name;
private int refCount;
}
-
+
protected final synchronized LibRef getLibRef(long handle) {
return (LibRef) libHandle2Name.get(handle);
}
-
+
protected final synchronized LibRef incrLibRefCount(long handle, String libName) {
LibRef libRef = getLibRef(handle);
if( null == libRef ) {
@@ -73,7 +73,7 @@ import com.jogamp.common.util.LongObjectHashMap;
}
return libRef;
}
-
+
protected final synchronized LibRef decrLibRefCount(long handle) {
LibRef libRef = getLibRef(handle);
if( null != libRef ) {
diff --git a/src/java/jogamp/common/os/MacOSXDynamicLinkerImpl.java b/src/java/jogamp/common/os/MacOSXDynamicLinkerImpl.java
index 18dcf97..b2f0f31 100644
--- a/src/java/jogamp/common/os/MacOSXDynamicLinkerImpl.java
+++ b/src/java/jogamp/common/os/MacOSXDynamicLinkerImpl.java
@@ -45,15 +45,15 @@ public final class MacOSXDynamicLinkerImpl extends UnixDynamicLinkerImpl {
public final long openLibraryLocal(String pathname, boolean debug) throws SecurityException {
return this.openLibraryImpl(pathname, RTLD_LAZY | RTLD_LOCAL, debug);
}
-
+
@Override
public final long openLibraryGlobal(String pathname, boolean debug) throws SecurityException {
return this.openLibraryImpl(pathname, RTLD_LAZY | RTLD_GLOBAL, debug);
}
-
+
@Override
public final long lookupSymbolGlobal(String symbolName) throws SecurityException {
return this.lookupSymbolGlobalImpl(RTLD_DEFAULT, symbolName);
}
-
+
}
diff --git a/src/java/jogamp/common/os/MachineDescriptionRuntime.java b/src/java/jogamp/common/os/MachineDescriptionRuntime.java
index a58accd..01559b9 100644
--- a/src/java/jogamp/common/os/MachineDescriptionRuntime.java
+++ b/src/java/jogamp/common/os/MachineDescriptionRuntime.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package jogamp.common.os;
import com.jogamp.common.os.MachineDescription;
@@ -39,7 +39,7 @@ public class MachineDescriptionRuntime {
static volatile boolean smdQueried = false;
static MachineDescription.StaticConfig smd = null;
-
+
public static MachineDescription.StaticConfig getStatic() {
if(!smdQueried) {
synchronized(MachineDescription.class) { // volatile dbl-checked-locking OK
@@ -50,8 +50,8 @@ public class MachineDescriptionRuntime {
}
}
return smd;
- }
-
+ }
+
private static boolean isCPUArch32Bit() throws RuntimeException {
switch( PlatformPropsImpl.CPU_ARCH ) {
case X86_32:
@@ -71,7 +71,7 @@ public class MachineDescriptionRuntime {
throw new RuntimeException("Please port CPU detection (32/64 bit) to your platform (" + PlatformPropsImpl.OS_lower + "/" + PlatformPropsImpl.ARCH_lower + "("+PlatformPropsImpl.CPU_ARCH+"))");
}
}
-
+
private static MachineDescription.StaticConfig getStaticImpl() {
if(isCPUArch32Bit()) {
if(PlatformPropsImpl.CPU_ARCH.getFamily() == Platform.CPUFamily.ARM && PlatformPropsImpl.LITTLE_ENDIAN) {
@@ -94,7 +94,7 @@ public class MachineDescriptionRuntime {
return StaticConfig.X86_64_UNIX;
}
}
-
+
static volatile boolean rmdQueried = false;
static MachineDescription rmd = null;
@@ -108,14 +108,14 @@ public class MachineDescriptionRuntime {
}
}
return rmd;
- }
+ }
private static MachineDescription getRuntimeImpl() {
try {
Platform.initSingleton(); // loads native gluegen-rt library
} catch (UnsatisfiedLinkError err) {
return null;
}
-
+
int pointerSizeInBytes = getPointerSizeInBytesImpl();
switch(pointerSizeInBytes) {
case 4:
@@ -129,25 +129,25 @@ public class MachineDescriptionRuntime {
if(Integer.MAX_VALUE < pageSizeL) {
throw new InternalError("PageSize exceeds integer value: " + pageSizeL);
}
-
+
// size: int, long, float, double, pointer, pageSize
// alignment: int8, int16, int32, int64, int, long, float, double, pointer
- return new MachineDescription(
+ return new MachineDescription(
true /* runtime validated */, PlatformPropsImpl.LITTLE_ENDIAN,
-
+
getSizeOfIntImpl(), getSizeOfLongImpl(),
- getSizeOfFloatImpl(), getSizeOfDoubleImpl(), getSizeOfLongDoubleImpl(),
+ getSizeOfFloatImpl(), getSizeOfDoubleImpl(), getSizeOfLongDoubleImpl(),
pointerSizeInBytes, (int)pageSizeL,
-
+
getAlignmentInt8Impl(), getAlignmentInt16Impl(), getAlignmentInt32Impl(), getAlignmentInt64Impl(),
- getAlignmentIntImpl(), getAlignmentLongImpl(),
- getAlignmentFloatImpl(), getAlignmentDoubleImpl(), getAlignmentLongDoubleImpl(),
- getAlignmentPointerImpl());
+ getAlignmentIntImpl(), getAlignmentLongImpl(),
+ getAlignmentFloatImpl(), getAlignmentDoubleImpl(), getAlignmentLongDoubleImpl(),
+ getAlignmentPointerImpl());
}
private static native int getPointerSizeInBytesImpl();
private static native long getPageSizeInBytesImpl();
-
+
private static native int getAlignmentInt8Impl();
private static native int getAlignmentInt16Impl();
private static native int getAlignmentInt32Impl();
@@ -162,7 +162,7 @@ public class MachineDescriptionRuntime {
private static native int getSizeOfLongImpl();
private static native int getSizeOfPointerImpl();
private static native int getSizeOfFloatImpl();
- private static native int getSizeOfDoubleImpl();
- private static native int getSizeOfLongDoubleImpl();
+ private static native int getSizeOfDoubleImpl();
+ private static native int getSizeOfLongDoubleImpl();
}
diff --git a/src/java/jogamp/common/os/PlatformPropsImpl.java b/src/java/jogamp/common/os/PlatformPropsImpl.java
index 819fe9c..e632647 100644
--- a/src/java/jogamp/common/os/PlatformPropsImpl.java
+++ b/src/java/jogamp/common/os/PlatformPropsImpl.java
@@ -37,16 +37,16 @@ import com.jogamp.common.util.VersionNumber;
*/
public abstract class PlatformPropsImpl {
static final boolean DEBUG = Debug.debug("Platform");
-
+
//
// static initialization order:
//
-
+
/** Version 1.6. As a JVM version, it enables certain JVM 1. features. */
public static final VersionNumber Version16;
/** Version 1.7. As a JVM version, it enables certain JVM 1.7 features. */
public static final VersionNumber Version17;
-
+
public static final String OS;
public static final String OS_lower;
public static final String OS_VERSION;
@@ -62,17 +62,17 @@ public abstract class PlatformPropsImpl {
public static final String JAVA_RUNTIME_NAME;
/** True if having {@link java.nio.LongBuffer} and {@link java.nio.DoubleBuffer} available. */
public static final boolean JAVA_SE;
- /** True if being compatible w/ language level 6, e.g. JRE 1.6. Implies {@link #JAVA_SE}. Note: We claim Android is compatible. */
+ /** True if being compatible w/ language level 6, e.g. JRE 1.6. Implies {@link #JAVA_SE}. Note: We claim Android is compatible. */
public static final boolean JAVA_6;
-
+
public static final String NEWLINE;
public static final boolean LITTLE_ENDIAN;
-
+
public static final CPUType CPU_ARCH;
public static final ABIType ABI_TYPE;
public static final OSType OS_TYPE;
public static final String os_and_arch;
-
+
static {
Version16 = new VersionNumber(1, 6, 0);
Version17 = new VersionNumber(1, 7, 0);
@@ -103,10 +103,10 @@ public abstract class PlatformPropsImpl {
JAVA_RUNTIME_NAME = getJavaRuntimeNameImpl();
JAVA_SE = initIsJavaSE();
JAVA_6 = JAVA_SE && ( AndroidVersion.isAvailable || JAVA_VERSION_NUMBER.compareTo(Version16) >= 0 ) ;
-
+
NEWLINE = System.getProperty("line.separator");
LITTLE_ENDIAN = queryIsLittleEndianImpl();
-
+
CPU_ARCH = getCPUTypeImpl(ARCH_lower);
OS_TYPE = getOSTypeImpl();
ABI_TYPE = queryABITypeImpl(OS_TYPE, CPU_ARCH);
@@ -114,7 +114,7 @@ public abstract class PlatformPropsImpl {
}
protected PlatformPropsImpl() {}
-
+
private static final String getJavaRuntimeNameImpl() {
// the fast path, check property Java SE instead of traversing through the ClassLoader
return AccessController.doPrivileged(new PrivilegedAction
*
+ *
*
*
+ *
*
- * For Elf parsing either the current executable is used (Linux) or a found java/jvm native library. + * For Elf parsing either the current executable is used (Linux) or a found java/jvm native library. *
** Elf ARM Tags are read using {@link ElfHeader}, .. and {@link SectionArmAttributes#abiVFPArgsAcceptsVFPVariant(byte)}. *
* @param osType * @param cpuType - * + * * @return */ private static final ABIType queryABITypeImpl(final OSType osType, final CPUType cpuType) { if( CPUFamily.ARM != cpuType.family ) { return ABIType.GENERIC_ABI; } - if( OSType.ANDROID == osType ) { // EACCES (Permission denied) - We assume a not rooted device! + if( OSType.ANDROID == osType ) { // EACCES (Permission denied) - We assume a not rooted device! return ABIType.EABI_GNU_ARMEL; } return AccessController.doPrivileged(new PrivilegedActionos.and.arch
strings:
* int dlclose(void * );
*/
protected static native int dlclose(long arg0);
@@ -59,16 +59,16 @@ import com.jogamp.common.util.SecurityUtil;
}
return handle;
}
-
+
protected final long lookupSymbolGlobalImpl(long dlSymGlobalFlag, String symbolName) throws SecurityException {
SecurityUtil.checkAllLinkPermission();
final long addr = dlsym(dlSymGlobalFlag, symbolName);
if(DEBUG_LOOKUP) {
System.err.println("DynamicLinkerImpl.lookupSymbolGlobal("+symbolName+") -> 0x"+Long.toHexString(addr));
}
- return addr;
+ return addr;
}
-
+
@Override
public final long lookupSymbol(long libraryHandle, String symbolName) throws IllegalArgumentException {
if( null == getLibRef( libraryHandle ) ) {
@@ -78,7 +78,7 @@ import com.jogamp.common.util.SecurityUtil;
if(DEBUG_LOOKUP) {
System.err.println("DynamicLinkerImpl.lookupSymbol(0x"+Long.toHexString(libraryHandle)+", "+symbolName+") -> 0x"+Long.toHexString(addr));
}
- return addr;
+ return addr;
}
@Override
@@ -88,7 +88,7 @@ import com.jogamp.common.util.SecurityUtil;
}
dlclose(libraryHandle);
}
-
+
@Override
public final String getLastError() {
return dlerror();
diff --git a/src/java/jogamp/common/os/WindowsDynamicLinkerImpl.java b/src/java/jogamp/common/os/WindowsDynamicLinkerImpl.java
index adb2492..76bb2f8 100644
--- a/src/java/jogamp/common/os/WindowsDynamicLinkerImpl.java
+++ b/src/java/jogamp/common/os/WindowsDynamicLinkerImpl.java
@@ -49,7 +49,7 @@ public final class WindowsDynamicLinkerImpl extends DynamicLinkerImpl {
// Don't know .. so it's an alias for the time being
return openLibraryGlobal(libraryName, debug);
}
-
+
@Override
public final long openLibraryGlobal(String libraryName, boolean debug) throws SecurityException {
SecurityUtil.checkLinkPermission(libraryName);
@@ -62,7 +62,7 @@ public final class WindowsDynamicLinkerImpl extends DynamicLinkerImpl {
}
return handle;
}
-
+
@Override
public final long lookupSymbolGlobal(String symbolName) throws SecurityException {
SecurityUtil.checkAllLinkPermission();
@@ -95,7 +95,7 @@ public final class WindowsDynamicLinkerImpl extends DynamicLinkerImpl {
}
return addr;
}
-
+
@Override
public final void closeLibrary(long libraryHandle) throws IllegalArgumentException {
if( null == decrLibRefCount( libraryHandle ) ) {
@@ -109,5 +109,5 @@ public final class WindowsDynamicLinkerImpl extends DynamicLinkerImpl {
final int err = GetLastError();
return "Last error: 0x"+Integer.toHexString(err)+" ("+err+")";
}
-
+
}
diff --git a/src/java/jogamp/common/os/elf/ElfHeader.java b/src/java/jogamp/common/os/elf/ElfHeader.java
index 88562cf..d76dbab 100644
--- a/src/java/jogamp/common/os/elf/ElfHeader.java
+++ b/src/java/jogamp/common/os/elf/ElfHeader.java
@@ -53,7 +53,7 @@ import static jogamp.common.os.elf.IOUtils.toHexString;
public class ElfHeader {
/** Size of e_ident array - {@value} */
public static int EI_NIDENT = 16;
-
+
/** ident byte #0 - {@value} */
public static final byte ELFMAG0 = 0x7f;
/** ident byte #1 - {@value} */
@@ -62,13 +62,13 @@ public class ElfHeader {
public static final byte ELFMAG2 = 'L';
/** ident byte #3 - {@value} */
public static final byte ELFMAG3 = 'F';
-
+
/** ident byte #4 */
public static final int EI_CLASS = 4;
public static final byte ELFCLASSNONE = 0;
public static final byte ELFCLASS32 = 1;
public static final byte ELFCLASS64 = 2;
-
+
/** ident byte #5 */
public static final int EI_DATA = 5;
public static final byte ELFDATANONE = 0;
@@ -79,7 +79,7 @@ public class ElfHeader {
public static final int EI_VERSION = 6;
public static final byte EV_NONE = 0;
public static final byte EV_CURRENT = 1;
-
+
/** ident byte #7 */
public static final int EI_OSABI = 7;
/** Unix System V ABI - {@value} */
@@ -114,29 +114,29 @@ public class ElfHeader {
/** Amiga Research OS ABI - {@value} **/
public static final byte ELFOSABI_AROS = 15;
/** The FenixOS highly scalable multi-core OS 64-255 Architecture-specific value range - {@value} */
- public static final byte ELFOSABI_FENIXOS = 16;
-
+ public static final byte ELFOSABI_FENIXOS = 16;
+
/** ident byte #8
* - * This byte identifies the version of the ABI to which the object is targeted. - * This field is used to distinguish among incompatible versions of an ABI. - * The interpretation of this version number is dependent on the ABI identified by the EI_OSABI field. + * This byte identifies the version of the ABI to which the object is targeted. + * This field is used to distinguish among incompatible versions of an ABI. + * The interpretation of this version number is dependent on the ABI identified by the EI_OSABI field. * Applications conforming to this specification use the value 0. - *
+ * */ public static final int EI_ABIVERSION = 8; - + /** * ident byte #9 .. ? *- * Start of padding. - * These bytes are reserved and set to zero. - * Programs which read them should ignore them. + * Start of padding. + * These bytes are reserved and set to zero. + * Programs which read them should ignore them. * The value for EI_PAD will change in the future if currently unused bytes are given meanings. *
*/ public static final int EI_PAD = 9; - + /** * This masks an 8-bit version number, the version of the ABI to which this * ELF file conforms. This ABI is version 5. A value of 0 denotes unknown conformance. @@ -144,27 +144,27 @@ public class ElfHeader { */ public static final int EF_ARM_ABIMASK = 0xFF000000; public static final int EF_ARM_ABISHIFT = 24; - + /** * ARM ABI version 5. * {@value} */ public static final int EF_ARM_ABI5 = 0x05000000; - + /** * The ELF file contains BE-8 code, suitable for execution on an ARM * Architecture v6 processor. This flag must only be set on an executable file. * {@value} */ public static final int EF_ARM_BE8 = 0x00800000; - + /** * Legacy code (ABI version 4 and earlier) generated by gcc-arm-xxx might * use these bits. * {@value} */ public static final int EF_ARM_GCCMASK = 0x00400FFF; - + /** * Set in executable file headers (e_type = ET_EXEC or ET_DYN) to note that * the executable file was built to conform to the hardware floating-point @@ -173,28 +173,28 @@ public class ElfHeader { * Compatible with legacy (pre version 5) gcc use as EF_ARM_VFP_FLOAT. * *- * Note: This is not used (anymore) - *
+ * Note: This is not used (anymore) + * * {@value} */ public static final int EF_ARM_ABI_FLOAT_HARD = 0x00000400; - + /** * Set in executable file headers (e_type = ET_EXEC or ET_DYN) to note * explicitly that the executable file was built to conform to the software * floating-point procedure-call standard (the base standard). If both - * {@link #EF_ARM_ABI_FLOAT_HARD} and {@link #EF_ARM_ABI_FLOAT_SOFT} are clear, + * {@link #EF_ARM_ABI_FLOAT_HARD} and {@link #EF_ARM_ABI_FLOAT_SOFT} are clear, * conformance to the base procedure-call standard is implied. ** Compatible with legacy (pre version 5) gcc use as EF_ARM_SOFT_FLOAT. *
*- * Note: This is not used (anymore) - *
+ * Note: This is not used (anymore) + * * {@value} */ public static final int EF_ARM_ABI_FLOAT_SOFT = 0x00000200; - + /** An unknown type - {@value} */ public static final short ET_NONE = 0; /** A relocatable file - {@value} */ @@ -205,7 +205,7 @@ public class ElfHeader { public static final short ET_DYN = 3; /** A core file - {@value} */ public static final short ET_CORE = 4; - + public static final short EM_NONE = 0; public static final short EM_M32 = 1; public static final short EM_SPARC = 2; @@ -357,34 +357,34 @@ public class ElfHeader { public static final short EM_TILEPRO = 188; public static final short EM_MICROBLAZE = 189; public static final short EM_CUDA = 190; - + public static final boolean isIdentityValid(byte[] ident) { return ELFMAG0 == ident[0] && ELFMAG1 == ident[1] && ELFMAG2 == ident[2] && ELFMAG3 == ident[3] ; } - + /** Public access to the raw elf header */ public final Ehdr d; - + /** Public access to the {@link SectionHeader} */ - public final SectionHeader[] sht; - + public final SectionHeader[] sht; + private final String string; - + /** * Note: The input stream shall stay untouch to be able to read sections! - * + * * @param in input stream of a binary file at position zero * @return - * @throws IOException if reading from the given input stream fails or less then ELF Header size bytes + * @throws IOException if reading from the given input stream fails or less then ELF Header size bytes * @throws IllegalArgumentException if the given input stream does not represent an ELF Header */ public static ElfHeader read(RandomAccessFile in) throws IOException, IllegalArgumentException { final int eh_sz = Ehdr.size(); final byte[] buf = new byte[eh_sz]; - readBytes (in, buf, 0, eh_sz); + readBytes (in, buf, 0, eh_sz); final ElfHeader eh = new ElfHeader(ByteBuffer.wrap(buf, 0, buf.length), in); return eh; } @@ -392,7 +392,7 @@ public class ElfHeader { /** * @param buf ELF Header bytes * @throws IllegalArgumentException if the given buffer does not represent an ELF Header - * @throws IOException + * @throws IOException */ ElfHeader(java.nio.ByteBuffer buf, RandomAccessFile in) throws IllegalArgumentException, IOException { d = Ehdr.create(buf); @@ -404,11 +404,11 @@ public class ElfHeader { } public final short getSize() { return d.getE_ehsize(); } - - /** - * Returns the architecture class in bits, - * 32 for {@link #ELFCLASS32}, 64 for {@link #ELFCLASS64} - * and 0 for {@link #ELFCLASSNONE}. + + /** + * Returns the architecture class in bits, + * 32 for {@link #ELFCLASS32}, 64 for {@link #ELFCLASS64} + * and 0 for {@link #ELFCLASSNONE}. */ public final int getArchClassBits() { switch( d.getE_ident()[EI_CLASS] ) { @@ -417,48 +417,48 @@ public class ElfHeader { default: return 0; } } - - /** - * Returns the processor's data encoding, i.e. - * {@link #ELFDATA2LSB}, {@link #ELFDATA2MSB} or {@link #ELFDATANONE}; + + /** + * Returns the processor's data encoding, i.e. + * {@link #ELFDATA2LSB}, {@link #ELFDATA2MSB} or {@link #ELFDATANONE}; */ public final byte getDataEncodingMode() { return d.getE_ident()[EI_DATA]; } - + /** Returns the ELF file version, should be {@link #EV_CURRENT}. */ public final byte getVersion() { return d.getE_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]; } - + /** Returns the version of the {@link #getOSABI() OSABI} for this file. */ public final byte getOSABIVersion() { return d.getE_ident()[EI_ABIVERSION]; } - /** Returns the object file type, e.g. {@link #ET_EXEC}, .. */ + /** Returns the object file type, e.g. {@link #ET_EXEC}, .. */ public final short getType() { return d.getE_type(); } - /** Returns the required architecture for the file, e.g. {@link #EM_386}, .. */ + /** Returns the required architecture for the file, e.g. {@link #EM_386}, .. */ public final short getMachine() { - return d.getE_machine(); + return d.getE_machine(); } - - /** + + /** * Returns true if {@link #getMachine() machine} is a 32 or 64 bit ARM CPU * of type {@link #EM_ARM}. */ public final boolean isArm() { return getMachine() == EM_ARM; } - - /** + + /** * 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 isIntel() { @@ -467,30 +467,30 @@ public class ElfHeader { EM_486 == m || EM_X86_64 == m; } - + /** Returns the processor-specific flags associated with the file. */ public final int getFlags() { return d.getE_flags(); } - + /** Returns the ARM EABI version from {@link #getFlags() flags}, maybe 0 if not an ARM EABI. */ public byte getArmABI() { - return (byte) ( ( ( EF_ARM_ABIMASK & d.getE_flags() ) >> EF_ARM_ABISHIFT ) & 0xff ); + return (byte) ( ( ( EF_ARM_ABIMASK & d.getE_flags() ) >> EF_ARM_ABISHIFT ) & 0xff ); } - + /** Returns the ARM EABI legacy GCC {@link #getFlags() flags}, maybe 0 if not an ARM EABI or not having legacy GCC flags. */ public int getArmLegacyGCCFlags() { final int f = d.getE_flags(); - return 0 != ( EF_ARM_ABIMASK & f ) ? ( EF_ARM_GCCMASK & f ) : 0; + return 0 != ( EF_ARM_ABIMASK & f ) ? ( EF_ARM_GCCMASK & f ) : 0; } - - /** + + /** * Returns the ARM EABI float mode from {@link #getFlags() flags}, * i.e. 1 for {@link #EF_ARM_ABI_FLOAT_SOFT}, 2 for {@link #EF_ARM_ABI_FLOAT_HARD} * or 0 for none. *- * Note: This is not used (anymore) - *
+ * Note: This is not used (anymore) + * */ public byte getArmFloatMode() { final int f = d.getE_flags(); @@ -515,7 +515,7 @@ public class ElfHeader { } return null; } - + /** Returns the 1st occurence of matching SectionHeader {@link SectionHeader#getName() name}, or null if not exists. */ public final SectionHeader getSectionHeader(String name) { for(int i=0; isb_off
,
+ * @param remaining remaining numbers of bytes to parse beginning w/ sb_off
,
* which shall not exceed sb.length - offset
.
* @param offset_post optional integer array holding offset post parsing
* @return the parsed string
- * @throws IndexOutOfBoundsException if offset + remaining > sb.length
.
+ * @throws IndexOutOfBoundsException if offset + remaining > sb.length
.
*/
static String getString(final byte[] sb, final int offset, final int remaining, int[] offset_post) throws IndexOutOfBoundsException {
checkBounds(sb, offset, remaining);
@@ -104,14 +104,14 @@ class IOUtils {
}
return s;
}
-
+
/**
* @param sb byte source buffer to parse
* @param offset offset within byte source buffer to start parsing
- * @param remaining remaining numbers of bytes to parse beginning w/ sb_off
,
+ * @param remaining remaining numbers of bytes to parse beginning w/ sb_off
,
* which shall not exceed sb.length - offset
.
* @return the number of parsed strings
- * @throws IndexOutOfBoundsException if offset + remaining > sb.length
.
+ * @throws IndexOutOfBoundsException if offset + remaining > sb.length
.
*/
static int getStringCount(final byte[] sb, int offset, final int remaining) throws IndexOutOfBoundsException {
checkBounds(sb, offset, remaining);
@@ -120,21 +120,21 @@ class IOUtils {
for(; i < remaining && sb[i + offset] != 0; i++) { }
strnum++;
}
- return strnum;
+ return strnum;
}
-
+
/**
* @param sb byte source buffer to parse
* @param offset offset within byte source buffer to start parsing
- * @param remaining remaining numbers of bytes to parse beginning w/ sb_off
,
+ * @param remaining remaining numbers of bytes to parse beginning w/ sb_off
,
* which shall not exceed sb.length - offset
.
* @return the parsed strings
- * @throws IndexOutOfBoundsException if offset + remaining > sb.length
.
+ * @throws IndexOutOfBoundsException if offset + remaining > sb.length
.
*/
public static String[] getStrings(final byte[] sb, int offset, final int remaining) throws IndexOutOfBoundsException {
final int strnum = getStringCount(sb, offset, remaining);
// System.err.println("XXX: strnum "+strnum+", sb_off "+sb_off+", sb_len "+sb_len);
-
+
final String[] sa = new String[strnum];
final int[] io_off = new int[] { offset };
for(int i=0; i < strnum; i++) {
@@ -142,7 +142,7 @@ class IOUtils {
sa[i] = getString(sb, io_off[0], remaining - io_off[0], io_off);
// System.err.println(".. "+io_off[0]+"[ "+sa[i]);
}
- return sa;
+ return sa;
}
-
+
}
diff --git a/src/java/jogamp/common/os/elf/Section.java b/src/java/jogamp/common/os/elf/Section.java
index 99c762c..a653668 100644
--- a/src/java/jogamp/common/os/elf/Section.java
+++ b/src/java/jogamp/common/os/elf/Section.java
@@ -32,19 +32,19 @@ public class Section {
public byte[] data;
public int offset;
public int length;
-
+
Section(SectionHeader sh, byte[] data, int offset, int length) {
this.sh = sh;
this.data = data;
this.offset = offset;
this.length = length;
}
-
+
public String toString() {
return "Section["+toSubString()+"]";
}
String toSubString() {
return sh+", data[off "+offset+", len "+length+"/"+data.length+"]";
}
-
+
}
diff --git a/src/java/jogamp/common/os/elf/SectionArmAttributes.java b/src/java/jogamp/common/os/elf/SectionArmAttributes.java
index 7b85bb9..413250a 100644
--- a/src/java/jogamp/common/os/elf/SectionArmAttributes.java
+++ b/src/java/jogamp/common/os/elf/SectionArmAttributes.java
@@ -23,17 +23,17 @@ import java.util.List;
*/
public class SectionArmAttributes extends Section {
public static final byte FORMAT_VERSION_A = 0x41; // 'A';
-
+
public static enum Type {
/** No Value */
- None,
+ None,
/** A Sub-Section - following the 4 byte sub section total size (tag + size + content) - byte order of the ELF file */
SubSection,
/** Null Terminated Byte-String */
NTBS,
ULEB128,
}
-
+
/** ULEB128 Value for {@link Tag#ABI_VFP_args}: FP parameter/result passing conforms to AAPCS, BASE variant. */
public static final byte ABI_VFP_ARGS_IS_BASE_VARIANT = 0;
/** ULEB128 Value for {@link Tag#ABI_VFP_args}: FP parameter/result passing conforms to AAPCS, VFP variant. */
@@ -41,18 +41,18 @@ public class SectionArmAttributes extends Section {
/** ULEB128 Value for {@link Tag#ABI_VFP_args}: FP parameter/result passing conforms to custom toolchain. */
public static final byte ABI_VFP_ARGS_IS_CUSTOM_VARIANT = 2;
/** ULEB128 Value for {@link Tag#ABI_VFP_args}: FP parameter/result passing conforms to both , BASE and VFP variant. */
- public static final byte ABI_VFP_ARGS_IS_BOTH_BASE_AND_VFP_VARIANT = 3;
-
- /**
+ public static final byte ABI_VFP_ARGS_IS_BOTH_BASE_AND_VFP_VARIANT = 3;
+
+ /**
* Returns true if value is either {@link #ABI_VFP_ARGS_IS_VFP_VARIANT} or {@link #ABI_VFP_ARGS_IS_BOTH_BASE_AND_VFP_VARIANT}
* @param v ULEB128 Value from {@link Tag#ABI_VFP_args} attribute
*/
public static final boolean abiVFPArgsAcceptsVFPVariant(byte v) {
return ABI_VFP_ARGS_IS_VFP_VARIANT == v || ABI_VFP_ARGS_IS_BOTH_BASE_AND_VFP_VARIANT == v;
}
-
+
public static enum Tag {
- None(0, Type.None),
+ None(0, Type.None),
File(1, Type.SubSection), Section(2, Type.SubSection), Symbol(3, Type.SubSection),
CPU_raw_name( 4, Type.NTBS ),
CPU_name( 5, Type.NTBS ),
@@ -96,10 +96,10 @@ public class SectionArmAttributes extends Section {
undefined69( 69, Type.None ),
MPextension_use_legacy( 70, Type.ULEB128 )
;
-
+
public final int id;
- public final Type type;
-
+ public final Type type;
+
/** Slow O(n) transition of a native tag value to a Tag. */
public static Tag get(final int id) {
final Tag[] tags = Tag.values();
@@ -117,16 +117,16 @@ public class SectionArmAttributes extends Section {
this.type = type;
}
}
-
+
public static class Attribute {
public final Tag tag;
private final Object value;
-
+
Attribute(Tag tag, Object value) {
this.tag = tag;
this.value = value;
}
-
+
public final boolean isNTBS() {
return Type.NTBS == tag.type;
}
@@ -136,7 +136,7 @@ public class SectionArmAttributes extends Section {
}
throw new IllegalArgumentException("Not NTBS but "+tag.type);
}
-
+
public final boolean isULEB128() {
return Type.ULEB128 == tag.type;
}
@@ -146,41 +146,41 @@ public class SectionArmAttributes extends Section {
}
throw new IllegalArgumentException("Not ULEB128 but "+tag.type);
}
-
+
public String toString() {
return tag+" = "+value;
}
}
-
+
public static class VendorAttributes {
public final String vendor;
public final Listsb_off
,
* which shall not exceed sb.length - offset
.
- * @throws IndexOutOfBoundsException if offset + remaining > sb.length
.
- * @throws IllegalArgumentException if section parsing failed, i.e. incompatible version or data.
+ * @throws IndexOutOfBoundsException if offset + remaining > sb.length
.
+ * @throws IllegalArgumentException if section parsing failed, i.e. incompatible version or data.
*/
static Listsb_off
,
+ * @param remaining remaining numbers of bytes to parse beginning w/ sb_off
,
* which shall not exceed sb.length - offset
.
- * @throws IndexOutOfBoundsException if offset + remaining > sb.length
.
- * @throws IllegalArgumentException if section parsing failed, i.e. incompatible version or data.
+ * @throws IndexOutOfBoundsException if offset + remaining > sb.length
.
+ * @throws IllegalArgumentException if section parsing failed, i.e. incompatible version or data.
*/
static void parseSub(final byte[] in, final int offset, final int remaining, int[] offset_post, List