summaryrefslogtreecommitdiffstats
path: root/src/java/jogamp/common/os/MachineDescriptionRuntime.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-02-01 05:21:39 +0100
committerSven Gothel <[email protected]>2015-02-01 05:21:39 +0100
commita3f2d08801c5a54048faca52f422bcededf81b2a (patch)
tree96e83956b62ae3e25043ccc67f4cb1c2c1f232a1 /src/java/jogamp/common/os/MachineDescriptionRuntime.java
parent0deceee37d943faa7c34971388863a27f395d6a5 (diff)
Bug 1125 - Make ELF Reader 'jogamp.common.os.elf' Stateless
ELF Reader 'jogamp.common.os.elf' currently uses Platform's pre-determined OS_TYPE and CPUType. It also uses the host platforms MachineDescription, hence can not read ELF files from other machines. This also forbids Platform to determine CPUType etc w/o having a valid 'os.arch' property. +++ ElfHeader should be split in - ElfHeaderPart1 (CPUType independent) - ElfHeaderPart2 (CPUType dependent) Fix shall make the ELF Reader self containing by only using ELF CPUType data, etc. This requires customization of struct parsing, where MachineDescription.Static index shall be - defined in ElfHeaderPart1 using e_Ident's CPUType. - used in ElfHeaderPart2 and all its struct types.
Diffstat (limited to 'src/java/jogamp/common/os/MachineDescriptionRuntime.java')
-rw-r--r--src/java/jogamp/common/os/MachineDescriptionRuntime.java33
1 files changed, 10 insertions, 23 deletions
diff --git a/src/java/jogamp/common/os/MachineDescriptionRuntime.java b/src/java/jogamp/common/os/MachineDescriptionRuntime.java
index 8df29f6..9becd21 100644
--- a/src/java/jogamp/common/os/MachineDescriptionRuntime.java
+++ b/src/java/jogamp/common/os/MachineDescriptionRuntime.java
@@ -43,37 +43,24 @@ public class MachineDescriptionRuntime {
static volatile boolean smdSoftQueried = false;
static MachineDescription.StaticConfig smdSoft = null;
- static volatile boolean smdHardEnabled = false;
-
- /* pp */ static void notifyPropsInitialized() { smdHardEnabled = true; }
-
public static MachineDescription.StaticConfig getStatic() {
- if(!smdHardEnabled) {
- if(!smdSoftQueried) {
- synchronized(MachineDescription.class) { // volatile dbl-checked-locking OK
- if(!smdSoftQueried) {
- smdSoft = get(PlatformPropsImpl.OS_TYPE, PlatformPropsImpl.sCpuType, PlatformPropsImpl.LITTLE_ENDIAN);
- smdSoftQueried=true;
- }
- }
- }
- return smdSoft;
- } else {
- 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(!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;
}
+ return smdHard;
}
- private static MachineDescription.StaticConfig get(final Platform.OSType osType, final Platform.CPUType cpuType, final boolean littleEndian) {
+ public static MachineDescription.StaticConfig get(final Platform.OSType osType, final Platform.CPUType cpuType, final boolean littleEndian) {
if( cpuType.is32Bit ) {
- if( cpuType.getFamily() == Platform.CPUFamily.ARM && littleEndian) {
+ if( cpuType.family == Platform.CPUFamily.ARM && littleEndian) {
return StaticConfig.ARMle_EABI;
} else if( osType == Platform.OSType.WINDOWS ) {
return StaticConfig.X86_32_WINDOWS;