aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/os
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-01-30 07:04:39 +0100
committerSven Gothel <[email protected]>2015-01-30 07:04:39 +0100
commit30933c60156c67a9624fefae2be6504300ce71bb (patch)
treed69de1e3568cb72655680124ac8f36ca614d05e5 /src/java/com/jogamp/common/os
parentb6e3878d253abab0dc864279eb1ae01fff220acf (diff)
Bug 1122: Add AArch64 support (Android, GNU/Linux and in general)
- Add AArch64 detection via - Elf Parser - Android properties - Java properties - Android: Validate CPUType.Family _and_ ABIType - MachineDescription - Remove redundant Type ID and its field - Reuse X86_64_UNIX for AArch64 (static config) New ARCH 'aarch64' for ant: <os arch> armv8a aarch64 New CPUType.ARM64 (ARM): java: os.arch aarch64 arm64 New CPUType.ARMv8_A (ARM): java: os.arch armv8-a arm64-v8a New ABIType: EABI_AARCH64
Diffstat (limited to 'src/java/com/jogamp/common/os')
-rw-r--r--src/java/com/jogamp/common/os/AndroidVersion.java11
-rw-r--r--src/java/com/jogamp/common/os/MachineDescription.java57
-rw-r--r--src/java/com/jogamp/common/os/Platform.java15
3 files changed, 36 insertions, 47 deletions
diff --git a/src/java/com/jogamp/common/os/AndroidVersion.java b/src/java/com/jogamp/common/os/AndroidVersion.java
index adfb1ef..0e30602 100644
--- a/src/java/com/jogamp/common/os/AndroidVersion.java
+++ b/src/java/com/jogamp/common/os/AndroidVersion.java
@@ -85,10 +85,16 @@ public class AndroidVersion {
private static final CPUType getCPUTypeImpl(final String cpuABI) {
if( null == cpuABI ) {
return null;
+ } else if( cpuABI.equals("armv8-a") ||
+ cpuABI.equals("arm64-v8a") ) {
+ return CPUType.ARMv8_A;
+ } else if( cpuABI.equals("aarch64") ||
+ cpuABI.startsWith("arm64") ) {
+ return CPUType.ARM64;
} else if( cpuABI.equals("armeabi-v7a") ) {
return CPUType.ARMv7;
} else if( cpuABI.equals("armeabi") ||
- cpuABI.startsWith("arm") ) { // last chance ..
+ cpuABI.startsWith("arm") ) { // last 32bit chance ..
return CPUType.ARM;
} else if( cpuABI.equals("x86") ) {
return CPUType.X86_32;
@@ -103,6 +109,9 @@ public class AndroidVersion {
return null;
} else if( CPUFamily.ARM != cpuType.family ) {
return ABIType.GENERIC_ABI;
+ } else if( CPUType.ARM64 == cpuType ||
+ CPUType.ARMv8_A == cpuType ) {
+ return ABIType.EABI_AARCH64;
}
return ABIType.EABI_GNU_ARMEL; // FIXME: How will they name ABIType.EABI_GNU_ARMHF
}
diff --git a/src/java/com/jogamp/common/os/MachineDescription.java b/src/java/com/jogamp/common/os/MachineDescription.java
index ca9819a..a9a46b2 100644
--- a/src/java/com/jogamp/common/os/MachineDescription.java
+++ b/src/java/com/jogamp/common/os/MachineDescription.java
@@ -46,29 +46,6 @@ import jogamp.common.os.PlatformPropsImpl;
* For alignment and size see {@link com.jogamp.gluegen}
*/
public class MachineDescription {
- public enum ID {
- /** {@link Platform.CPUType#ARM} EABI Little Endian */
- ARMle_EABI(Platform.CPUType.ARM),
- /** {@link Platform.CPUType#X86_32} Little Endian Unix */
- X86_32_UNIX(Platform.CPUType.X86_32),
- /** {@link Platform.CPUType#X86_64} Little Endian Unix */
- X86_64_UNIX(Platform.CPUType.X86_64),
- /** {@link Platform.CPUType#X86_32} Little Endian MacOS (Special case gcc4/OSX) */
- X86_32_MACOS(Platform.CPUType.X86_32),
- /** {@link Platform.CPUType#X86_64} Little Endian MacOS */
- X86_32_WINDOWS(Platform.CPUType.X86_32),
- /** {@link Platform.CPUType#X86_64} Little Endian Windows */
- X86_64_WINDOWS(Platform.CPUType.X86_64),
- /** {@link Platform.CPUType#SPARC_32} Big Endian Solaris */
- SPARC_32_SUNOS(Platform.CPUType.SPARC_32);
-
- public final Platform.CPUType cpu;
-
- ID(final Platform.CPUType cpu){
- this.cpu = cpu;
- }
- }
-
/* arch os int, long, float, doubl, ldoubl, ptr, page */
private final static int[] size_armeabi = { 4, 4, 4, 8, 8, 4, 4096 };
private final static int[] size_x86_32_unix = { 4, 4, 4, 8, 12, 4, 4096 };
@@ -88,26 +65,24 @@ public class MachineDescription {
private final static int[] align_sparc_32_sunos = { 1, 2, 4, 8, 4, 4, 4, 8, 8, 4 };
public enum StaticConfig {
- /** {@link MachineDescription.ID#ARMle_EABI } */
- ARMle_EABI(ID.ARMle_EABI, true, size_armeabi, align_armeabi),
- /** {@link MachineDescription.ID#X86_32_UNIX } */
- X86_32_UNIX(ID.X86_32_UNIX, true, size_x86_32_unix, align_x86_32_unix),
- /** {@link MachineDescription.ID#X86_64_UNIX } */
- X86_64_UNIX(ID.X86_64_UNIX, true, size_x86_64_unix, align_x86_64_unix),
- /** {@link MachineDescription.ID#X86_32_MACOS } */
- X86_32_MACOS(ID.X86_32_MACOS, true, size_x86_32_macos, align_x86_32_macos),
- /** {@link MachineDescription.ID#X86_32_WINDOWS } */
- X86_32_WINDOWS(ID.X86_32_WINDOWS, true, size_x86_32_windows, align_x86_32_windows),
- /** {@link MachineDescription.ID#X86_64_WINDOWS } */
- X86_64_WINDOWS(ID.X86_64_WINDOWS, true, size_x86_64_windows, align_x86_64_windows),
- /** {@link MachineDescription.ID#SPARC_32_SUNOS } */
- SPARC_32_SUNOS(ID.SPARC_32_SUNOS, false, size_sparc_32_sunos, align_sparc_32_sunos);
-
- public final ID id;
+ /** {@link Platform.CPUType#ARM} EABI Little Endian */
+ ARMle_EABI(true, size_armeabi, align_armeabi),
+ /** {@link Platform.CPUType#X86_32} Little Endian Unix */
+ X86_32_UNIX(true, size_x86_32_unix, align_x86_32_unix),
+ /** {@link Platform.CPUType#X86_64} Little Endian Unix, {@link Platform.CPUType#ARM64} EABI Little Endian */
+ X86_64_UNIX(true, size_x86_64_unix, align_x86_64_unix),
+ /** {@link Platform.CPUType#X86_32} Little Endian MacOS (Special case gcc4/OSX) */
+ X86_32_MACOS(true, size_x86_32_macos, align_x86_32_macos),
+ /** {@link Platform.CPUType#X86_32} Little Endian Windows */
+ X86_32_WINDOWS(true, size_x86_32_windows, align_x86_32_windows),
+ /** {@link Platform.CPUType#X86_64} Little Endian Windows */
+ X86_64_WINDOWS(true, size_x86_64_windows, align_x86_64_windows),
+ /** {@link Platform.CPUType#SPARC_32} Big Endian Solaris */
+ SPARC_32_SUNOS(false, size_sparc_32_sunos, align_sparc_32_sunos);
+
public final MachineDescription md;
- StaticConfig(final ID id, final boolean littleEndian, final int[] sizes, final int[] alignments) {
- this.id = id;
+ StaticConfig(final boolean littleEndian, final int[] sizes, final int[] alignments) {
int i=0, j=0;
this.md = new MachineDescription(false, littleEndian,
sizes[i++],
diff --git a/src/java/com/jogamp/common/os/Platform.java b/src/java/com/jogamp/common/os/Platform.java
index 513d215..5b3befa 100644
--- a/src/java/com/jogamp/common/os/Platform.java
+++ b/src/java/com/jogamp/common/os/Platform.java
@@ -103,6 +103,10 @@ public class Platform extends PlatformPropsImpl {
ARMv6( CPUFamily.ARM, 0x0002),
/** ARM Cortex */
ARMv7( CPUFamily.ARM, 0x0004),
+ /** ARM64 default (64bit) */
+ ARM64( CPUFamily.ARM, 0x0008),
+ /** ARM AArch64 (64bit) and AArch32 (32bit) */
+ ARMv8_A( CPUFamily.ARM, 0x0010),
/** PPC default */
PPC( CPUFamily.PPC, 0x0000),
/** SPARC 32bit */
@@ -130,11 +134,13 @@ public class Platform extends PlatformPropsImpl {
}
public enum ABIType {
- GENERIC_ABI ( 0x0000 ),
+ GENERIC_ABI ( 0x0000 ),
/** ARM GNU-EABI ARMEL -mfloat-abi=softfp */
- EABI_GNU_ARMEL ( 0x0001 ),
+ EABI_GNU_ARMEL ( 0x0001 ),
/** ARM GNU-EABI ARMHF -mfloat-abi=hard */
- EABI_GNU_ARMHF ( 0x0002 );
+ EABI_GNU_ARMHF ( 0x0002 ),
+ /** ARM EABI AARCH64 (64bit) */
+ EABI_AARCH64 ( 0x0003 );
public final int id;
@@ -225,13 +231,12 @@ public class Platform extends PlatformPropsImpl {
USE_TEMP_JAR_CACHE = _USE_TEMP_JAR_CACHE[0];
AWT_AVAILABLE = _AWT_AVAILABLE[0];
+ final MachineDescription.StaticConfig smd = MachineDescriptionRuntime.getStatic();
MachineDescription md = MachineDescriptionRuntime.getRuntime();
if(null == md) {
- final MachineDescription.StaticConfig smd = MachineDescriptionRuntime.getStatic();
md = smd.md;
System.err.println("Warning: Using static MachineDescription: "+smd);
} else {
- final MachineDescription.StaticConfig smd = MachineDescriptionRuntime.getStatic();
if(!md.compatible(smd.md)) {
throw new RuntimeException("Incompatible MachineDescriptions:"+PlatformPropsImpl.NEWLINE+
" Static "+smd+PlatformPropsImpl.NEWLINE+