From 7db9df61142694965b50f2e0553d4c9e5668439b Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 2 Feb 2015 00:22:29 +0100 Subject: Bug 1126 - Remove static query requirement of MachineDescriptor, find matching StaticConfig at runtime; Fix PPC (Bug 1056) and MIPSLE (Bug 1014) issues. Currently the StaticConfig is being queried via the key[OSType, CPUType ..] as pre-determined by Java properties or the ELF parser. This adds complication to maintain different platforms and the key query might not even be sufficient. The MachineDescriptor's StaticConfig only purpose shall be to speed-up native data size and offset/alignment retrieval. This is done by using the StaticConfig index within all StaticConfig[]s as a lookup-index for the precomputed struct's size and offset tables. +++ Solution: Rename: MachineDescriptor -> MachineDataInfo Rename: MachineDescriptorRuntime -> MachineDataInfoRuntime After having defined os.and.arch (OSType, CPUType and ABIType) w/ the optional help of the now self containing ELF Reader (Bug 1125), the native gluegen-rt library gets loaded enabling JNI methods. It is satisfactory to retrieve MachineDataInfo at runtime w/ JNI and find the matching/compatible StaticConfig. Only in case none is found, the program needs to abort. Otherwise the found MachineDataInfo.StaticConfig and MachineDataInfo are stored for further use (see above). This removes above complication and key to StaticConfig mapping. New platforms simply need to add a new unique entry into the StaticConfig[] table. ++ Also fixes Bug 1056 (PPC), thanks to tmancill [@] debian [.] org, and Bug 1014 (MIPSLE), thanks to Dejan Latinovic. Parts of the patch for Bug 1014 from Dejan Latinovic are included. also solved by this change set. --- .../jogamp/common/os/MachineDataInfoRuntime.java | 178 +++++++++++++++++++++ .../common/os/MachineDescriptionRuntime.java | 156 ------------------ src/java/jogamp/common/os/PlatformPropsImpl.java | 83 ++++++---- src/java/jogamp/common/os/elf/Ehdr_p1.java | 28 ++-- src/java/jogamp/common/os/elf/Ehdr_p2.java | 52 +++--- src/java/jogamp/common/os/elf/ElfHeaderPart1.java | 31 ++-- src/java/jogamp/common/os/elf/ElfHeaderPart2.java | 3 +- src/java/jogamp/common/os/elf/Shdr.java | 52 +++--- 8 files changed, 315 insertions(+), 268 deletions(-) create mode 100644 src/java/jogamp/common/os/MachineDataInfoRuntime.java delete mode 100644 src/java/jogamp/common/os/MachineDescriptionRuntime.java (limited to 'src/java/jogamp') diff --git a/src/java/jogamp/common/os/MachineDataInfoRuntime.java b/src/java/jogamp/common/os/MachineDataInfoRuntime.java new file mode 100644 index 0000000..af90cc5 --- /dev/null +++ b/src/java/jogamp/common/os/MachineDataInfoRuntime.java @@ -0,0 +1,178 @@ +/** + * Copyright 2010 JogAmp Community. All rights reserved. + * + * 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 + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * 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.MachineDataInfo; +import com.jogamp.common.os.Platform; +import com.jogamp.common.os.MachineDataInfo.StaticConfig; + +/** + * Runtime operations of {@link MachineDataInfo}. + */ +public class MachineDataInfoRuntime { + + static volatile boolean initialized = false; + static volatile MachineDataInfo runtimeMD = null; + static volatile MachineDataInfo.StaticConfig staticMD = null; + + public static void initialize() { + if( !initialized ) { + synchronized(MachineDataInfo.class) { // volatile dbl-checked-locking OK + if( !initialized ) { + MachineDataInfo.StaticConfig.validateUniqueMachineDataInfo(); + + final MachineDataInfo runtimeMD = getRuntimeImpl(); + final MachineDataInfo.StaticConfig staticMD = MachineDataInfo.StaticConfig.findCompatible(runtimeMD); + if( null == staticMD ) { + throw new RuntimeException("No compatible MachineDataInfo.StaticConfig for runtime:"+PlatformPropsImpl.NEWLINE+runtimeMD); + } + if( !staticMD.md.compatible(runtimeMD) ) { + throw new RuntimeException("Incompatible MachineDataInfo:"+PlatformPropsImpl.NEWLINE+ + " Static "+staticMD+PlatformPropsImpl.NEWLINE+ + " Runtime "+runtimeMD); + } + MachineDataInfoRuntime.runtimeMD = runtimeMD; + MachineDataInfoRuntime.staticMD = staticMD; + initialized=true; + if( PlatformPropsImpl.DEBUG ) { + System.err.println("MachineDataInfoRuntime.initialize():"+PlatformPropsImpl.NEWLINE+ + " Static "+staticMD+PlatformPropsImpl.NEWLINE+ + " Runtime "+runtimeMD); + } + return; + } + } + } + throw new InternalError("Already initialized"); + } + public static MachineDataInfo.StaticConfig getStatic() { + if(!initialized) { + synchronized(MachineDataInfo.class) { // volatile dbl-checked-locking OK + if(!initialized) { + throw new InternalError("Not set"); + } + } + } + return staticMD; + } + public static MachineDataInfo getRuntime() { + if(!initialized) { + synchronized(MachineDataInfo.class) { // volatile dbl-checked-locking OK + if(!initialized) { + throw new InternalError("Not set"); + } + } + } + return runtimeMD; + } + + public static MachineDataInfo.StaticConfig guessStaticMachineDataInfo(final Platform.OSType osType, final Platform.CPUType cpuType) { + if( cpuType.is32Bit ) { + if( Platform.CPUFamily.ARM == cpuType.family || + Platform.CPUType.MIPS_32 == cpuType ) { + return StaticConfig.ARM_MIPS_32; + } else if( Platform.OSType.WINDOWS == osType ) { + return StaticConfig.X86_32_WINDOWS; + } else if( Platform.OSType.MACOS == osType ) { + return StaticConfig.X86_32_MACOS; + } else if ( Platform.OSType.SUNOS == osType && + Platform.CPUType.SPARC_32 == cpuType ) { + return StaticConfig.SPARC_32_SUNOS; + } else if ( Platform.CPUType.PPC == cpuType ) { + return StaticConfig.PPC_32_UNIX; + } else { + return StaticConfig.X86_32_UNIX; + } + } else { + if( osType == Platform.OSType.WINDOWS ) { + return StaticConfig.X86_64_WINDOWS; + } else { + // for all 64bit unix types (x86_64, aarch64, sparcv9, ..) + return StaticConfig.LP64_UNIX; + } + } + } + + private static MachineDataInfo getRuntimeImpl() { + try { + Platform.initSingleton(); // loads native gluegen-rt library + } catch (final UnsatisfiedLinkError err) { + return null; + } + + final int pointerSizeInBytes = getPointerSizeInBytesImpl(); + switch(pointerSizeInBytes) { + case 4: + case 8: + break; + default: + throw new RuntimeException("Unsupported pointer size "+pointerSizeInBytes+"bytes, please implement."); + } + + final long pageSizeL = getPageSizeInBytesImpl(); + 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 MachineDataInfo( + true /* runtime validated */, + + getSizeOfIntImpl(), getSizeOfLongImpl(), + getSizeOfFloatImpl(), getSizeOfDoubleImpl(), getSizeOfLongDoubleImpl(), + pointerSizeInBytes, (int)pageSizeL, + + getAlignmentInt8Impl(), getAlignmentInt16Impl(), getAlignmentInt32Impl(), getAlignmentInt64Impl(), + 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(); + private static native int getAlignmentInt64Impl(); + private static native int getAlignmentIntImpl(); + private static native int getAlignmentLongImpl(); + private static native int getAlignmentPointerImpl(); + private static native int getAlignmentFloatImpl(); + private static native int getAlignmentDoubleImpl(); + private static native int getAlignmentLongDoubleImpl(); + private static native int getSizeOfIntImpl(); + 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(); +} + diff --git a/src/java/jogamp/common/os/MachineDescriptionRuntime.java b/src/java/jogamp/common/os/MachineDescriptionRuntime.java deleted file mode 100644 index 9becd21..0000000 --- a/src/java/jogamp/common/os/MachineDescriptionRuntime.java +++ /dev/null @@ -1,156 +0,0 @@ -/** - * Copyright 2010 JogAmp Community. All rights reserved. - * - * 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 - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * 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; -import com.jogamp.common.os.Platform; -import com.jogamp.common.os.MachineDescription.StaticConfig; - -/** - * Runtime MachineDescription - */ -public class MachineDescriptionRuntime { - - static volatile boolean smdHardQueried = false; - static MachineDescription.StaticConfig smdHard = null; - - static volatile boolean smdSoftQueried = false; - static MachineDescription.StaticConfig smdSoft = null; - - public static MachineDescription.StaticConfig getStatic() { - if(!smdHardQueried) { - synchronized(MachineDescription.class) { // volatile dbl-checked-locking OK - if(!smdHardQueried) { - smdHard = get(PlatformPropsImpl.OS_TYPE, PlatformPropsImpl.CPU_ARCH, PlatformPropsImpl.LITTLE_ENDIAN); - smdHardQueried=true; - if( PlatformPropsImpl.DEBUG ) { - System.err.println("MachineDescription.StaticConfig.getStatic_Hard(os "+PlatformPropsImpl.OS_TYPE+", CpuType "+PlatformPropsImpl.CPU_ARCH+", little "+PlatformPropsImpl.LITTLE_ENDIAN+"): "+smdHard.toShortString()); - } - } - } - } - return smdHard; - } - - public static MachineDescription.StaticConfig get(final Platform.OSType osType, final Platform.CPUType cpuType, final boolean littleEndian) { - if( cpuType.is32Bit ) { - if( cpuType.family == Platform.CPUFamily.ARM && littleEndian) { - return StaticConfig.ARMle_EABI; - } else if( osType == Platform.OSType.WINDOWS ) { - return StaticConfig.X86_32_WINDOWS; - } else if( osType == Platform.OSType.MACOS ) { - return StaticConfig.X86_32_MACOS; - } else if ( osType == Platform.OSType.SUNOS ) { - if ( cpuType == Platform.CPUType.SPARC_32 ) { - return StaticConfig.SPARC_32_SUNOS; - } - // TODO SPARCv9 description is missing - } - return StaticConfig.X86_32_UNIX; - } else { - if( osType == Platform.OSType.WINDOWS ) { - return StaticConfig.X86_64_WINDOWS; - } else { - // for all 64bit unix types (x86_64, aarch64, ..) - return StaticConfig.LP64_UNIX; - } - } - } - - static volatile boolean rmdQueried = false; - static MachineDescription rmd = null; - - public static MachineDescription getRuntime() { - if(!rmdQueried) { - synchronized(MachineDescription.class) { // volatile dbl-checked-locking OK - if(!rmdQueried) { - rmd = getRuntimeImpl(); - rmdQueried=true; - } - } - } - return rmd; - } - private static MachineDescription getRuntimeImpl() { - try { - Platform.initSingleton(); // loads native gluegen-rt library - } catch (final UnsatisfiedLinkError err) { - return null; - } - - final int pointerSizeInBytes = getPointerSizeInBytesImpl(); - switch(pointerSizeInBytes) { - case 4: - case 8: - break; - default: - throw new RuntimeException("Unsupported pointer size "+pointerSizeInBytes+"bytes, please implement."); - } - - final long pageSizeL = getPageSizeInBytesImpl(); - 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( - true /* runtime validated */, PlatformPropsImpl.LITTLE_ENDIAN, - - getSizeOfIntImpl(), getSizeOfLongImpl(), - getSizeOfFloatImpl(), getSizeOfDoubleImpl(), getSizeOfLongDoubleImpl(), - pointerSizeInBytes, (int)pageSizeL, - - getAlignmentInt8Impl(), getAlignmentInt16Impl(), getAlignmentInt32Impl(), getAlignmentInt64Impl(), - 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(); - private static native int getAlignmentInt64Impl(); - private static native int getAlignmentIntImpl(); - private static native int getAlignmentLongImpl(); - private static native int getAlignmentPointerImpl(); - private static native int getAlignmentFloatImpl(); - private static native int getAlignmentDoubleImpl(); - private static native int getAlignmentLongDoubleImpl(); - private static native int getSizeOfIntImpl(); - 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(); -} - diff --git a/src/java/jogamp/common/os/PlatformPropsImpl.java b/src/java/jogamp/common/os/PlatformPropsImpl.java index b35533f..0d0063c 100644 --- a/src/java/jogamp/common/os/PlatformPropsImpl.java +++ b/src/java/jogamp/common/os/PlatformPropsImpl.java @@ -140,15 +140,6 @@ public abstract class PlatformPropsImpl { OS_TYPE = getOSTypeImpl(OS_lower, isAndroid); // Hard values, i.e. w/ probing binaries - // - // FIXME / HACK: - // We use preCpuType for MachineDescriptionRuntime.getStatic() - // until we have determined the final CPU_TYPE, etc. - // MachineDescriptionRuntime gets notified via MachineDescriptionRuntime.notifyPropsInitialized() below. - // - // We could use Elf Ehdr's machine value to determine the bit-size - // used for it's offset table! - // However, 'os.arch' should be a good guess for this task. final String elfCpuName; final CPUType elfCpuType; final ABIType elfABIType; @@ -324,7 +315,7 @@ public abstract class PlatformPropsImpl { if( DEBUG ) { System.err.println("Platform.Hard: ARCH "+ARCH+", CPU_ARCH "+CPU_ARCH+", ABI_TYPE "+ABI_TYPE+" - strategy "+strategy+"(isAndroid "+isAndroid+", elfValid "+elfValid+")"); } - os_and_arch = getOSAndArch(OS_TYPE, CPU_ARCH, ABI_TYPE); + os_and_arch = getOSAndArch(OS_TYPE, CPU_ARCH, ABI_TYPE, LITTLE_ENDIAN); } protected PlatformPropsImpl() {} @@ -504,20 +495,34 @@ public abstract class PlatformPropsImpl { public static void initSingleton() { } /** - * Returns the GlueGen common name for the given OSType and CPUType - * as implemented in the build system in 'gluegen-cpptasks-base.xml'.
+ * Returns the GlueGen common name for the given + * {@link OSType}, {@link CPUType}, {@link ABIType} and {@code littleEndian}. + *

+ * Consult 'gluegen/make/gluegen-cpptasks-base.xml' to complete/sync mapping! + *

* - * A list of currently supported os.and.arch strings: + * An excerpt of supported os.and.arch strings: * * @return The os.and.arch value. */ - public static final String getOSAndArch(final OSType osType, final CPUType cpuType, final ABIType abiType) { + public static final String getOSAndArch(final OSType osType, final CPUType cpuType, final ABIType abiType, final boolean littleEndian) { final String os_; final String _and_arch_tmp, _and_arch_final; switch( cpuType ) { - case X86_32: - _and_arch_tmp = "i586"; - break; case ARM: case ARMv5: case ARMv6: case ARMv7: if( ABIType.EABI_GNU_ARMHF == abiType ) { - _and_arch_tmp = "armv6hf" ; // TODO: sync with gluegen-cpptasks-base.xml + _and_arch_tmp = "armv6hf"; } else { - _and_arch_tmp = "armv6"; // TODO: sync with gluegen-cpptasks-base.xml + _and_arch_tmp = "armv6"; } break; - case ARM64: - case ARMv8_A: - _and_arch_tmp = "aarch64"; + case X86_32: + _and_arch_tmp = "i586"; + break; + case PPC: + _and_arch_tmp = "ppc"; + break; + case MIPS_32: + _and_arch_tmp = littleEndian ? "mipsel" : "mips"; + break; + case SuperH: + _and_arch_tmp = "superh"; break; case SPARC_32: _and_arch_tmp = "sparc"; break; - case PPC64: - _and_arch_tmp = "ppc64"; // TODO: sync with gluegen-cpptasks-base.xml - break; - case PPC: - _and_arch_tmp = "ppc"; // TODO: sync with gluegen-cpptasks-base.xml + + case ARM64: + case ARMv8_A: + _and_arch_tmp = "aarch64"; break; case X86_64: _and_arch_tmp = "amd64"; break; + case PPC64: + _and_arch_tmp = "ppc64"; + break; + case MIPS_64: + _and_arch_tmp = "mips64"; + break; case IA64: _and_arch_tmp = "ia64"; break; @@ -569,7 +584,7 @@ public abstract class PlatformPropsImpl { _and_arch_tmp = "sparcv9"; break; case PA_RISC2_0: - _and_arch_tmp = "risc2.0"; // TODO: sync with gluegen-cpptasks-base.xml + _and_arch_tmp = "risc2.0"; break; default: throw new InternalError("Unhandled CPUType: "+cpuType); diff --git a/src/java/jogamp/common/os/elf/Ehdr_p1.java b/src/java/jogamp/common/os/elf/Ehdr_p1.java index 0d23a0a..8953776 100644 --- a/src/java/jogamp/common/os/elf/Ehdr_p1.java +++ b/src/java/jogamp/common/os/elf/Ehdr_p1.java @@ -1,4 +1,4 @@ -/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/JavaEmitter.java on Sun Feb 01 03:27:25 CET 2015 ----! */ +/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/JavaEmitter.java on Sun Feb 01 23:28:47 CET 2015 ----! */ package jogamp.common.os.elf; @@ -8,7 +8,7 @@ import java.nio.*; import com.jogamp.gluegen.runtime.*; import com.jogamp.common.os.*; import com.jogamp.common.nio.*; -import jogamp.common.os.MachineDescriptionRuntime; +import jogamp.common.os.MachineDataInfoRuntime; public class Ehdr_p1 { @@ -16,17 +16,17 @@ public class Ehdr_p1 { StructAccessor accessor; private static final int mdIdx = 0; - private final MachineDescription md; - - private static final int[] Ehdr_p1_size = new int[] { 24 /* ARMle_EABI */, 24 /* X86_32_UNIX */, 24 /* LP64_UNIX */, 24 /* X86_32_MACOS */, 24 /* X86_32_WINDOWS */, 24 /* X86_64_WINDOWS */, 24 /* SPARC_32_SUNOS */ }; - private static final int[] e_ident_offset = new int[] { 0 /* ARMle_EABI */, 0 /* X86_32_UNIX */, 0 /* LP64_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 /* LP64_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 /* LP64_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 /* LP64_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 /* LP64_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 /* LP64_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 /* LP64_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 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 4 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ }; + private final MachineDataInfo md; + + private static final int[] Ehdr_p1_size = 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 */, 24 /* LP64_UNIX */, 24 /* X86_64_WINDOWS */ }; + private static final int[] e_ident_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 */ }; + private static final int[] e_ident_size = 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 */, 16 /* LP64_UNIX */, 16 /* X86_64_WINDOWS */ }; + private static final int[] e_type_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 */, 16 /* LP64_UNIX */, 16 /* X86_64_WINDOWS */ }; +//private static final int[] e_type_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 */ }; + private static final int[] e_machine_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 */, 18 /* LP64_UNIX */, 18 /* X86_64_WINDOWS */ }; +//private static final int[] e_machine_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 */ }; + private static final int[] e_version_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 */, 20 /* LP64_UNIX */, 20 /* X86_64_WINDOWS */ }; +//private static final int[] e_version_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 */ }; public static int size() { return Ehdr_p1_size[mdIdx]; @@ -41,7 +41,7 @@ public class Ehdr_p1 { } Ehdr_p1(java.nio.ByteBuffer buf) { - md = MachineDescription.StaticConfig.values()[mdIdx].md; + md = MachineDataInfo.StaticConfig.values()[mdIdx].md; accessor = new StructAccessor(buf); } diff --git a/src/java/jogamp/common/os/elf/Ehdr_p2.java b/src/java/jogamp/common/os/elf/Ehdr_p2.java index 9dc561a..0842e15 100644 --- a/src/java/jogamp/common/os/elf/Ehdr_p2.java +++ b/src/java/jogamp/common/os/elf/Ehdr_p2.java @@ -1,4 +1,4 @@ -/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/JavaEmitter.java on Sun Feb 01 03:27:25 CET 2015 ----! */ +/* !---- DO NOT EDIT: This file autogenerated by com/jogamp/gluegen/JavaEmitter.java on Sun Feb 01 23:28:47 CET 2015 ----! */ package jogamp.common.os.elf; @@ -8,7 +8,7 @@ import java.nio.*; import com.jogamp.gluegen.runtime.*; import com.jogamp.common.os.*; import com.jogamp.common.nio.*; -import jogamp.common.os.MachineDescriptionRuntime; +import jogamp.common.os.MachineDataInfoRuntime; public class Ehdr_p2 { @@ -16,29 +16,29 @@ public class Ehdr_p2 { StructAccessor accessor; private final int mdIdx; - private final MachineDescription md; - - private static final int[] Ehdr_p2_size = new int[] { 28 /* ARMle_EABI */, 28 /* X86_32_UNIX */, 40 /* LP64_UNIX */, 28 /* X86_32_MACOS */, 28 /* X86_32_WINDOWS */, 40 /* X86_64_WINDOWS */, 28 /* SPARC_32_SUNOS */ }; - private static final int[] e_entry_offset = new int[] { 0 /* ARMle_EABI */, 0 /* X86_32_UNIX */, 0 /* LP64_UNIX */, 0 /* X86_32_MACOS */, 0 /* X86_32_WINDOWS */, 0 /* X86_64_WINDOWS */, 0 /* SPARC_32_SUNOS */ }; -//private static final int[] e_entry_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* LP64_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[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* LP64_UNIX */, 4 /* X86_32_MACOS */, 4 /* X86_32_WINDOWS */, 8 /* X86_64_WINDOWS */, 4 /* SPARC_32_SUNOS */ }; -//private static final int[] e_phoff_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* LP64_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[] { 8 /* ARMle_EABI */, 8 /* X86_32_UNIX */, 16 /* LP64_UNIX */, 8 /* X86_32_MACOS */, 8 /* X86_32_WINDOWS */, 16 /* X86_64_WINDOWS */, 8 /* SPARC_32_SUNOS */ }; -//private static final int[] e_shoff_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 8 /* LP64_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[] { 12 /* ARMle_EABI */, 12 /* X86_32_UNIX */, 24 /* LP64_UNIX */, 12 /* X86_32_MACOS */, 12 /* X86_32_WINDOWS */, 24 /* X86_64_WINDOWS */, 12 /* SPARC_32_SUNOS */ }; -//private static final int[] e_flags_size = new int[] { 4 /* ARMle_EABI */, 4 /* X86_32_UNIX */, 4 /* LP64_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[] { 16 /* ARMle_EABI */, 16 /* X86_32_UNIX */, 28 /* LP64_UNIX */, 16 /* X86_32_MACOS */, 16 /* X86_32_WINDOWS */, 28 /* X86_64_WINDOWS */, 16 /* SPARC_32_SUNOS */ }; -//private static final int[] e_ehsize_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* LP64_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[] { 18 /* ARMle_EABI */, 18 /* X86_32_UNIX */, 30 /* LP64_UNIX */, 18 /* X86_32_MACOS */, 18 /* X86_32_WINDOWS */, 30 /* X86_64_WINDOWS */, 18 /* SPARC_32_SUNOS */ }; -//private static final int[] e_phentsize_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* LP64_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[] { 20 /* ARMle_EABI */, 20 /* X86_32_UNIX */, 32 /* LP64_UNIX */, 20 /* X86_32_MACOS */, 20 /* X86_32_WINDOWS */, 32 /* X86_64_WINDOWS */, 20 /* SPARC_32_SUNOS */ }; -//private static final int[] e_phnum_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* LP64_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[] { 22 /* ARMle_EABI */, 22 /* X86_32_UNIX */, 34 /* LP64_UNIX */, 22 /* X86_32_MACOS */, 22 /* X86_32_WINDOWS */, 34 /* X86_64_WINDOWS */, 22 /* SPARC_32_SUNOS */ }; -//private static final int[] e_shentsize_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* LP64_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[] { 24 /* ARMle_EABI */, 24 /* X86_32_UNIX */, 36 /* LP64_UNIX */, 24 /* X86_32_MACOS */, 24 /* X86_32_WINDOWS */, 36 /* X86_64_WINDOWS */, 24 /* SPARC_32_SUNOS */ }; -//private static final int[] e_shnum_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* LP64_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[] { 26 /* ARMle_EABI */, 26 /* X86_32_UNIX */, 38 /* LP64_UNIX */, 26 /* X86_32_MACOS */, 26 /* X86_32_WINDOWS */, 38 /* X86_64_WINDOWS */, 26 /* SPARC_32_SUNOS */ }; -//private static final int[] e_shstrndx_size = new int[] { 2 /* ARMle_EABI */, 2 /* X86_32_UNIX */, 2 /* LP64_UNIX */, 2 /* X86_32_MACOS */, 2 /* X86_32_WINDOWS */, 2 /* X86_64_WINDOWS */, 2 /* SPARC_32_SUNOS */ }; + private final MachineDataInfo md; + + 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 */ }; + 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 */ }; +//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 */ }; + 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 */ }; +//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 */ }; + 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 */ }; +//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 */ }; + 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 */ }; +//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 */ }; + 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 */ }; +//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 */ }; + 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 */ }; +//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 */ }; + 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 */ }; +//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 */ }; + 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 */ }; +//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 */ }; + 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 */ }; +//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 */ }; + 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 */ }; +//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 */ }; public java.nio.ByteBuffer getBuffer() { return accessor.getBuffer(); @@ -169,7 +169,7 @@ public class Ehdr_p2 { Ehdr_p2(final int mdIdx, final java.nio.ByteBuffer buf) { this.mdIdx = mdIdx; - this.md = MachineDescription.StaticConfig.values()[mdIdx].md; + this.md = MachineDataInfo.StaticConfig.values()[mdIdx].md; this.accessor = new StructAccessor(buf); } // ---- End CustomJavaCode .cfg declarations diff --git a/src/java/jogamp/common/os/elf/ElfHeaderPart1.java b/src/java/jogamp/common/os/elf/ElfHeaderPart1.java index ec926e9..4f5b135 100644 --- a/src/java/jogamp/common/os/elf/ElfHeaderPart1.java +++ b/src/java/jogamp/common/os/elf/ElfHeaderPart1.java @@ -32,9 +32,9 @@ import java.io.RandomAccessFile; import java.nio.ByteBuffer; import jogamp.common.Debug; -import jogamp.common.os.MachineDescriptionRuntime; +import jogamp.common.os.MachineDataInfoRuntime; -import com.jogamp.common.os.MachineDescription; +import com.jogamp.common.os.MachineDataInfo; import com.jogamp.common.os.Platform.ABIType; import com.jogamp.common.os.Platform.CPUType; import com.jogamp.common.os.Platform.OSType; @@ -49,8 +49,9 @@ import static jogamp.common.os.elf.IOUtils.readBytes; *

* References: *