diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtAnalyzer.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtAnalyzer.java index c82da005b4..f2a000a3fa 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtAnalyzer.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtAnalyzer.java @@ -72,7 +72,7 @@ public class ArtAnalyzer extends FileFormatAnalyzer { BinaryReader reader = new BinaryReader(provider, !program.getLanguage().isBigEndian()); try { - ArtHeader header = ArtFactory.newArtHeader(reader); + ArtHeader header = ArtHeaderFactory.newArtHeader(reader); DataType headerDataType = header.toDataType(); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtConstants.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtConstants.java index 6054c7a6d4..f953524089 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtConstants.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtConstants.java @@ -30,54 +30,54 @@ public final class ArtConstants { public final static int VERSION_LENGTH = 4; - /** kitkat-release/runtime/image.c */ - public final static String VERSION_KITKAT_RELEASE = "005"; - /** lollipop-release/runtime/image.c */ - public final static String VERSION_LOLLIPOP_RELEASE = "009"; - /** lollipop-mr1-wfc-release/runtime/image.c */ - public final static String VERSION_LOLLIPOP_MR1_WFC_RELEASE = "012"; - /** marshmallow-release/runtime/image.c */ - public final static String VERSION_MARSHMALLOW_RELEASE = "017"; - /** nougat-release/runtime/image.c */ - public final static String VERSION_NOUGAT_RELEASE = "029"; - /** nougat-mr2-pixel-release/runtime/image.c */ - public final static String VERSION_NOUGAT_MR2_PIXEL_RELEASE = "030"; - /** oreo-release/runtime/image.c */ - public final static String VERSION_OREO_RELEASE = "043"; - /** oreo-dr1-release/runtime/image.c */ - public final static String VERSION_OREO_DR1_RELEASE = "044"; - /** oreo-mr1-release/runtime/image.c */ - public final static String VERSION_OREO_MR1_RELEASE = "046"; - /** pie-release/runtime/image.c */ - public final static String VERSION_PIE_RELEASE = "056"; - /** android10-release/runtime/image.c */ - public final static String VERSION_10_RELEASE = "074";//Q - /** android11-release/runtime/image.c */ - public final static String VERSION_11_RELEASE = "085";//R - /** android12-release/runtime/image.c */ - public final static String VERSION_12_RELEASE = "099";//S - /** android13-release/runtime/image.c */ - public final static String VERSION_13_RELEASE = "106";//S v2, 13 + /** kitkat-release/runtime/image.c */ + public final static String ART_VERSION_005 = "005"; + /** lollipop-release/runtime/image.c */ + public final static String ART_VERSION_009 = "009"; + /** lollipop-mr1-wfc-release/runtime/image.c */ + public final static String ART_VERSION_012 = "012"; + /** marshmallow-release/runtime/image.c */ + public final static String ART_VERSION_017 = "017"; + /** nougat-release/runtime/image.c */ + public final static String ART_VERSION_029 = "029"; + /** nougat-mr2-pixel-release/runtime/image.c */ + public final static String ART_VERSION_030 = "030"; + /** oreo-release/runtime/image.c */ + public final static String ART_VERSION_043 = "043"; + /** oreo-dr1-release/runtime/image.c */ + public final static String ART_VERSION_044 = "044"; + /** oreo-mr1-release/runtime/image.c */ + public final static String ART_VERSION_046 = "046"; + /** pie-release/runtime/image.c */ + public final static String ART_VERSION_056 = "056"; + /** android10-release/runtime/image.c */ + public final static String ART_VERSION_074 = "074";//Q + /** android11-release/runtime/image.c */ + public final static String ART_VERSION_085 = "085";//R + /** android12-release/runtime/image.c */ + public final static String ART_VERSION_099 = "099";//S + /** android13-release/runtime/image.c */ + public final static String ART_VERSION_106 = "106";//S v2, 13 /** * NOTE: only going to support RELEASE versions */ public final static String[] SUPPORTED_VERSIONS = new String[] { //@formatter:off - VERSION_KITKAT_RELEASE, - VERSION_LOLLIPOP_RELEASE, - VERSION_LOLLIPOP_MR1_WFC_RELEASE, - VERSION_MARSHMALLOW_RELEASE, - VERSION_NOUGAT_RELEASE, - VERSION_NOUGAT_MR2_PIXEL_RELEASE, - VERSION_OREO_RELEASE, - VERSION_OREO_DR1_RELEASE, - VERSION_OREO_MR1_RELEASE, - VERSION_PIE_RELEASE, - VERSION_10_RELEASE, - VERSION_11_RELEASE, - VERSION_12_RELEASE, - VERSION_13_RELEASE, + ART_VERSION_005, + ART_VERSION_009, + ART_VERSION_012, + ART_VERSION_017, + ART_VERSION_029, + ART_VERSION_030, + ART_VERSION_043, + ART_VERSION_044, + ART_VERSION_046, + ART_VERSION_056, + ART_VERSION_074, + ART_VERSION_085, + ART_VERSION_099, + ART_VERSION_106, //@formatter:on }; diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtFactory.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtFactory.java deleted file mode 100644 index 49f537ef34..0000000000 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtFactory.java +++ /dev/null @@ -1,83 +0,0 @@ -/* ### - * IP: GHIDRA - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package ghidra.file.formats.android.art; - -import java.io.IOException; - -import ghidra.app.util.bin.BinaryReader; -import ghidra.file.formats.android.art.android10.ArtHeader_10; -import ghidra.file.formats.android.art.android11.ArtHeader_11; -import ghidra.file.formats.android.art.android12.ArtHeader_12; -import ghidra.file.formats.android.art.kitkat.ArtHeader_KitKat; -import ghidra.file.formats.android.art.lollipop.ArtHeader_Lollipop; -import ghidra.file.formats.android.art.lollipop.ArtHeader_LollipopMR1WFC; -import ghidra.file.formats.android.art.marshmallow.ArtHeader_Marshmallow; -import ghidra.file.formats.android.art.nougat.ArtHeader_Nougat; -import ghidra.file.formats.android.art.nougat.ArtHeader_NougatMR2Pixel; -import ghidra.file.formats.android.art.oreo.ArtHeader_Oreo; -import ghidra.file.formats.android.art.oreo.ArtHeader_OreoMR1; -import ghidra.file.formats.android.art.pie.ArtHeader_Pie; - -public final class ArtFactory { - - /** - * Returns an ArtHeader of the correct version. - * @param reader the BinaryReader to the ART header - * @return the specific version of the ART header - * @throws IOException should an error occur during reading or parsing - * @throws UnsupportedArtVersionException when the provided version is invalid or not yet implemented. - */ - public final static ArtHeader newArtHeader(BinaryReader reader) - throws IOException, UnsupportedArtVersionException { - String magic = new String(reader.readByteArray(0, ArtConstants.MAGIC.length())); - String version = reader.readAsciiString(4, 4); - if (magic.equals(ArtConstants.MAGIC)) { - if (ArtConstants.isSupportedVersion(version)) { - switch (version) { - case ArtConstants.VERSION_KITKAT_RELEASE: - return new ArtHeader_KitKat(reader); - case ArtConstants.VERSION_LOLLIPOP_RELEASE: - return new ArtHeader_Lollipop(reader); - case ArtConstants.VERSION_LOLLIPOP_MR1_WFC_RELEASE: - return new ArtHeader_LollipopMR1WFC(reader); - case ArtConstants.VERSION_MARSHMALLOW_RELEASE: - return new ArtHeader_Marshmallow(reader); - case ArtConstants.VERSION_NOUGAT_RELEASE: - return new ArtHeader_Nougat(reader); - case ArtConstants.VERSION_NOUGAT_MR2_PIXEL_RELEASE: - return new ArtHeader_NougatMR2Pixel(reader); - case ArtConstants.VERSION_OREO_RELEASE: - return new ArtHeader_Oreo(reader); - case ArtConstants.VERSION_OREO_DR1_RELEASE: - return new ArtHeader_Oreo(reader);//v043 and v044 are same format - case ArtConstants.VERSION_OREO_MR1_RELEASE: - return new ArtHeader_OreoMR1(reader); - case ArtConstants.VERSION_PIE_RELEASE: - return new ArtHeader_Pie(reader); - case ArtConstants.VERSION_10_RELEASE: - return new ArtHeader_10(reader); - case ArtConstants.VERSION_11_RELEASE: - return new ArtHeader_11(reader); - case ArtConstants.VERSION_12_RELEASE: - case ArtConstants.VERSION_13_RELEASE: - return new ArtHeader_12(reader); - } - } - } - throw new UnsupportedArtVersionException(magic, version); - } - -} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtHeader.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtHeader.java index a79f8df095..8d17ea400d 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtHeader.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtHeader.java @@ -138,7 +138,8 @@ public abstract class ArtHeader implements StructConverter { @Override public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = new StructureDataType(ArtHeader.class.getSimpleName(), 0); + Structure structure = + new StructureDataType(ArtHeader.class.getSimpleName() + "_" + version_, 0); structure.add(STRING, 4, "magic_", null); structure.add(STRING, 4, "version_", null); structure.setCategoryPath(new CategoryPath("/art")); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtHeaderFactory.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtHeaderFactory.java new file mode 100644 index 0000000000..16aaaf66b2 --- /dev/null +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtHeaderFactory.java @@ -0,0 +1,73 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ghidra.file.formats.android.art; + +import java.io.IOException; + +import ghidra.app.util.bin.BinaryReader; +import ghidra.file.formats.android.art.headers.*; + +public final class ArtHeaderFactory { + + /** + * Returns an ArtHeader of the correct version. + * @param reader the BinaryReader to the ART header + * @return the specific version of the ART header + * @throws IOException should an error occur during reading or parsing + * @throws UnsupportedArtVersionException when the provided version is invalid or not yet implemented. + */ + public final static ArtHeader newArtHeader(BinaryReader reader) + throws IOException, UnsupportedArtVersionException { + String magic = new String(reader.readByteArray(0, ArtConstants.MAGIC.length())); + String version = reader.readAsciiString(4, 4); + if (magic.equals(ArtConstants.MAGIC)) { + if (ArtConstants.isSupportedVersion(version)) { + switch (version) { + case ArtConstants.ART_VERSION_005: + return new ArtHeader_005(reader); + case ArtConstants.ART_VERSION_009: + return new ArtHeader_009(reader); + case ArtConstants.ART_VERSION_012: + return new ArtHeader_012(reader); + case ArtConstants.ART_VERSION_017: + return new ArtHeader_017(reader); + case ArtConstants.ART_VERSION_029: + return new ArtHeader_029(reader); + case ArtConstants.ART_VERSION_030: + return new ArtHeader_030(reader); + case ArtConstants.ART_VERSION_043: + return new ArtHeader_043(reader); + case ArtConstants.ART_VERSION_044: + return new ArtHeader_044(reader); + case ArtConstants.ART_VERSION_046: + return new ArtHeader_046(reader); + case ArtConstants.ART_VERSION_056: + return new ArtHeader_056(reader); + case ArtConstants.ART_VERSION_074: + return new ArtHeader_074(reader); + case ArtConstants.ART_VERSION_085: + return new ArtHeader_085(reader); + case ArtConstants.ART_VERSION_099: + return new ArtHeader_099(reader); + case ArtConstants.ART_VERSION_106: + return new ArtHeader_106(reader); + } + } + } + throw new UnsupportedArtVersionException(magic, version); + } + +} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtImageSections.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtImageSections.java index 34afc91c56..eb79f6d6ce 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtImageSections.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtImageSections.java @@ -115,7 +115,7 @@ public abstract class ArtImageSections { reader.setPointerIndex(kSectionArtFields.getOffset()); while (reader.getPointerIndex() < Integer .toUnsignedLong(kSectionArtFields.getEnd())) { - if (ArtConstants.VERSION_MARSHMALLOW_RELEASE.equals(header.getVersion())) { + if (ArtConstants.ART_VERSION_017.equals(header.getVersion())) { ArtField field = new ArtField(reader); fieldList.add(field); } @@ -135,7 +135,7 @@ public abstract class ArtImageSections { reader.setPointerIndex(kSectionArtMethods.getOffset()); while (reader.getPointerIndex() < Integer .toUnsignedLong(kSectionArtMethods.getEnd())) { - if (ArtConstants.VERSION_MARSHMALLOW_RELEASE.equals(header.getVersion())) { + if (ArtConstants.ART_VERSION_017.equals(header.getVersion())) { ArtMethod method = new ArtMethod(reader, header.getPointerSize(), header.getVersion()); methodList.add(method); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtImageSectionsFactory.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtImageSectionsFactory.java index 22eca50fcf..710fa6fa2d 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtImageSectionsFactory.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtImageSectionsFactory.java @@ -18,14 +18,7 @@ package ghidra.file.formats.android.art; import java.io.IOException; import ghidra.app.util.bin.BinaryReader; -import ghidra.file.formats.android.art.android10.ImageSections_10; -import ghidra.file.formats.android.art.android12.ImageSections_12; -import ghidra.file.formats.android.art.marshmallow.ImageSections_Marshmallow; -import ghidra.file.formats.android.art.nougat.ImageSections_Nougat; -import ghidra.file.formats.android.art.nougat.ImageSections_NougatMR2Pixel; -import ghidra.file.formats.android.art.oreo.ImageSections_Oreo; -import ghidra.file.formats.android.art.oreo.ImageSections_OreoMR1; -import ghidra.file.formats.android.art.pie.ImageSections_Pie; +import ghidra.file.formats.android.art.image_sections.*; public final class ArtImageSectionsFactory { @@ -39,25 +32,25 @@ public final class ArtImageSectionsFactory { public static ArtImageSections getArtImageSections(BinaryReader reader, ArtHeader artHeader) throws IOException { switch (artHeader.getVersion()) { - case ArtConstants.VERSION_MARSHMALLOW_RELEASE: + case ArtConstants.ART_VERSION_017: return new ImageSections_Marshmallow(reader, artHeader); - case ArtConstants.VERSION_NOUGAT_RELEASE: + case ArtConstants.ART_VERSION_029: return new ImageSections_Nougat(reader, artHeader); - case ArtConstants.VERSION_NOUGAT_MR2_PIXEL_RELEASE: + case ArtConstants.ART_VERSION_030: return new ImageSections_NougatMR2Pixel(reader, artHeader); - case ArtConstants.VERSION_OREO_RELEASE: - case ArtConstants.VERSION_OREO_DR1_RELEASE: + case ArtConstants.ART_VERSION_043: + case ArtConstants.ART_VERSION_044: return new ImageSections_Oreo(reader, artHeader); - case ArtConstants.VERSION_OREO_MR1_RELEASE: + case ArtConstants.ART_VERSION_046: return new ImageSections_OreoMR1(reader, artHeader); - case ArtConstants.VERSION_PIE_RELEASE: + case ArtConstants.ART_VERSION_056: return new ImageSections_Pie(reader, artHeader); - case ArtConstants.VERSION_10_RELEASE: - case ArtConstants.VERSION_11_RELEASE: - return new ImageSections_10(reader, artHeader); - case ArtConstants.VERSION_12_RELEASE: - case ArtConstants.VERSION_13_RELEASE: - return new ImageSections_12(reader, artHeader); + case ArtConstants.ART_VERSION_074: + case ArtConstants.ART_VERSION_085: + return new ImageSections_Q_R(reader, artHeader); + case ArtConstants.ART_VERSION_099: + case ArtConstants.ART_VERSION_106: + return new ImageSections_S_T(reader, artHeader); } throw new IOException( "Unsupported ART version for ImageSections: " + artHeader.getVersion()); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtMethod.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtMethod.java index 74ab7cb760..bd9682cf48 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtMethod.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/ArtMethod.java @@ -51,7 +51,7 @@ public class ArtMethod implements StructConverter { this.pointerSize = pointerSize; this.artVersion = artVersion; - if (ArtConstants.VERSION_MARSHMALLOW_RELEASE.equals(artVersion)) { + if (ArtConstants.ART_VERSION_017.equals(artVersion)) { if (pointerSize == 4) { declaring_class_ = reader.readNextInt(); dex_cache_resolved_methods_ = Integer.toUnsignedLong(reader.readNextInt()); @@ -70,8 +70,8 @@ public class ArtMethod implements StructConverter { throw new IOException("Unsupported 64-bit ART method format: " + artVersion); } } - else if (ArtConstants.VERSION_NOUGAT_RELEASE.equals(artVersion) || - ArtConstants.VERSION_NOUGAT_MR2_PIXEL_RELEASE.equals(artVersion)) { + else if (ArtConstants.ART_VERSION_029.equals(artVersion) || + ArtConstants.ART_VERSION_030.equals(artVersion)) { if (pointerSize == 4) { declaring_class_ = reader.readNextInt(); @@ -101,9 +101,9 @@ public class ArtMethod implements StructConverter { entry_point_from_quick_compiled_code_ = reader.readNextLong(); } } - else if (ArtConstants.VERSION_OREO_RELEASE.equals(artVersion) || - ArtConstants.VERSION_OREO_DR1_RELEASE.equals(artVersion) || - ArtConstants.VERSION_OREO_MR1_RELEASE.equals(artVersion)) { + else if (ArtConstants.ART_VERSION_043.equals(artVersion) || + ArtConstants.ART_VERSION_044.equals(artVersion) || + ArtConstants.ART_VERSION_046.equals(artVersion)) { if (pointerSize == 4) { declaring_class_ = reader.readNextInt(); @@ -130,7 +130,7 @@ public class ArtMethod implements StructConverter { entry_point_from_quick_compiled_code_ = reader.readNextLong(); } } - else if (ArtConstants.VERSION_PIE_RELEASE.equals(artVersion)) { + else if (ArtConstants.ART_VERSION_056.equals(artVersion)) { declaring_class_ = reader.readNextInt(); access_flags_ = reader.readNextInt(); dex_code_item_offset_ = reader.readNextInt(); @@ -149,7 +149,7 @@ public class ArtMethod implements StructConverter { } } /** https://android.googlesource.com/platform/art/+/refs/heads/android10-release/runtime/art_method.h#741 */ - else if (ArtConstants.VERSION_10_RELEASE.equals(artVersion)) { + else if (ArtConstants.ART_VERSION_074.equals(artVersion)) { declaring_class_ = reader.readNextInt(); access_flags_ = reader.readNextInt(); dex_code_item_offset_ = reader.readNextInt(); @@ -168,7 +168,7 @@ public class ArtMethod implements StructConverter { } } /** https://android.googlesource.com/platform/art/+/refs/heads/android11-release/runtime/art_method.h#798 */ - else if (ArtConstants.VERSION_11_RELEASE.equals(artVersion)) { + else if (ArtConstants.ART_VERSION_085.equals(artVersion)) { declaring_class_ = reader.readNextInt(); access_flags_ = reader.readNextInt(); dex_code_item_offset_ = reader.readNextInt(); @@ -187,7 +187,7 @@ public class ArtMethod implements StructConverter { } } /** https://android.googlesource.com/platform/art/+/refs/heads/android12-release/runtime/art_method.h#787 */ - else if (ArtConstants.VERSION_12_RELEASE.equals(artVersion)) { + else if (ArtConstants.ART_VERSION_099.equals(artVersion)) { declaring_class_ = reader.readNextInt(); access_flags_ = reader.readNextInt(); dex_method_index_ = reader.readNextInt(); @@ -206,7 +206,7 @@ public class ArtMethod implements StructConverter { } } /** https://android.googlesource.com/platform/art/+/refs/heads/android13-release/runtime/art_method.h#787 */ - else if (ArtConstants.VERSION_13_RELEASE.equals(artVersion)) { + else if (ArtConstants.ART_VERSION_106.equals(artVersion)) { declaring_class_ = reader.readNextInt(); access_flags_ = reader.readNextInt(); dex_method_index_ = reader.readNextInt(); @@ -300,7 +300,7 @@ public class ArtMethod implements StructConverter { Structure struct = new StructureDataType(ArtMethod.class.getSimpleName(), 0); struct.setCategoryPath(new CategoryPath("/art")); - if (ArtConstants.VERSION_MARSHMALLOW_RELEASE.equals(artVersion)) { + if (ArtConstants.ART_VERSION_017.equals(artVersion)) { if (pointerSize == 4) { struct.add(DWORD, "declaring_class_", null); struct.add(DWORD, "dex_cache_resolved_methods_", null); @@ -318,8 +318,8 @@ public class ArtMethod implements StructConverter { throw new IOException("Unsupported 64-bit ART method format: " + artVersion); } } - else if (ArtConstants.VERSION_NOUGAT_RELEASE.equals(artVersion) || - ArtConstants.VERSION_NOUGAT_MR2_PIXEL_RELEASE.equals(artVersion)) { + else if (ArtConstants.ART_VERSION_029.equals(artVersion) || + ArtConstants.ART_VERSION_030.equals(artVersion)) { if (pointerSize == 4) { struct.add(ptr32, "declaring_class_", null); @@ -348,9 +348,9 @@ public class ArtMethod implements StructConverter { struct.add(ptr64, "entry_point_from_quick_compiled_code_", null); } } - else if (ArtConstants.VERSION_OREO_RELEASE.equals(artVersion) || - ArtConstants.VERSION_OREO_DR1_RELEASE.equals(artVersion) || - ArtConstants.VERSION_OREO_MR1_RELEASE.equals(artVersion)) { + else if (ArtConstants.ART_VERSION_043.equals(artVersion) || + ArtConstants.ART_VERSION_044.equals(artVersion) || + ArtConstants.ART_VERSION_046.equals(artVersion)) { if (pointerSize == 4) { struct.add(ptr32, "declaring_class_", null); @@ -376,7 +376,7 @@ public class ArtMethod implements StructConverter { struct.add(ptr64, "entry_point_from_quick_compiled_code_", null); } } - else if (ArtConstants.VERSION_PIE_RELEASE.equals(artVersion)) { + else if (ArtConstants.ART_VERSION_056.equals(artVersion)) { struct.add(ptr32, "declaring_class_", null); struct.add(DWORD, "access_flags_", null); struct.add(DWORD, "dex_code_item_offset_", null); @@ -394,7 +394,7 @@ public class ArtMethod implements StructConverter { struct.add(QWORD, "entry_point_from_quick_compiled_code_", null); } } - else if (ArtConstants.VERSION_10_RELEASE.equals(artVersion)) { + else if (ArtConstants.ART_VERSION_074.equals(artVersion)) { struct.add(ptr32, "declaring_class_", null); struct.add(DWORD, "access_flags_", null); struct.add(DWORD, "dex_code_item_offset_", null); @@ -412,7 +412,7 @@ public class ArtMethod implements StructConverter { struct.add(ptr64, "entry_point_from_quick_compiled_code_", null); } } - else if (ArtConstants.VERSION_11_RELEASE.equals(artVersion)) { + else if (ArtConstants.ART_VERSION_085.equals(artVersion)) { struct.add(ptr32, "declaring_class_", null); struct.add(DWORD, "access_flags_", null); struct.add(DWORD, "dex_code_item_offset_", null); @@ -430,7 +430,7 @@ public class ArtMethod implements StructConverter { struct.add(QWORD, "entry_point_from_quick_compiled_code_", null); } } - else if (ArtConstants.VERSION_12_RELEASE.equals(artVersion)) { + else if (ArtConstants.ART_VERSION_099.equals(artVersion)) { struct.add(ptr32, "declaring_class_", null); struct.add(DWORD, "access_flags_", null); struct.add(DWORD, "dex_method_index_", null); @@ -448,7 +448,7 @@ public class ArtMethod implements StructConverter { struct.add(QWORD, "entry_point_from_quick_compiled_code_", null); } } - else if (ArtConstants.VERSION_13_RELEASE.equals(artVersion)) { + else if (ArtConstants.ART_VERSION_106.equals(artVersion)) { struct.add(ptr32, "declaring_class_", null); struct.add(DWORD, "access_flags_", null); struct.add(DWORD, "dex_method_index_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android11/BootImageLiveObjects.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android11/BootImageLiveObjects.java deleted file mode 100644 index 525912411b..0000000000 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android11/BootImageLiveObjects.java +++ /dev/null @@ -1,34 +0,0 @@ -/* ### - * IP: GHIDRA - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package ghidra.file.formats.android.art.android11; - -/** - * https://android.googlesource.com/platform/art/+/refs/heads/android11-release/runtime/image.h - */ -public enum BootImageLiveObjects { - - /** Pre-allocated OOME when throwing exception. */ - kOomeWhenThrowingException, - /** Pre-allocated OOME when throwing OOME. */ - kOomeWhenThrowingOome, - /** Pre-allocated OOME when handling StackOverflowError. */ - kOomeWhenHandlingStackOverflow, - /** Pre-allocated NoClassDefFoundError. */ - kNoClassDefFoundError, - /** Pre-allocated sentinel for cleared weak JNI references. */ - kClearedJniWeakSentinel, - kIntrinsicObjectsStart; -} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android12/ArtHeader_12.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android12/ArtHeader_12.java deleted file mode 100644 index 5a683deaa8..0000000000 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android12/ArtHeader_12.java +++ /dev/null @@ -1,54 +0,0 @@ -/* ### - * IP: GHIDRA - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package ghidra.file.formats.android.art.android12; - -import java.io.IOException; - -import ghidra.app.util.bin.BinaryReader; -import ghidra.file.formats.android.art.android11.ArtHeader_11; -import ghidra.program.model.data.DataType; -import ghidra.program.model.data.Structure; -import ghidra.util.InvalidNameException; -import ghidra.util.exception.DuplicateNameException; - -/** - * https://android.googlesource.com/platform/art/+/refs/heads/android-s-beta-4/runtime/image.h#418 - * https://android.googlesource.com/platform/art/+/refs/heads/android-s-beta-4/runtime/image.cc#33 - * - * https://android.googlesource.com/platform/art/+/refs/heads/android-s-beta-5/runtime/image.h#418 - * https://android.googlesource.com/platform/art/+/refs/heads/android-s-beta-5/runtime/image.cc#33 - * - * https://android.googlesource.com/platform/art/+/refs/heads/android12-release/runtime/image.h#418 - * https://android.googlesource.com/platform/art/+/refs/heads/android12-release/runtime/image.cc#33 - */ -public class ArtHeader_12 extends ArtHeader_11 { - - public ArtHeader_12(BinaryReader reader) throws IOException { - super(reader); - } - - @Override - public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = (Structure) super.toDataType(); - try { - structure.setName(ArtHeader_12.class.getSimpleName()); - } - catch (InvalidNameException e) { - // ignore - } - return structure; - } -} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/kitkat/ArtHeader_KitKat.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_005.java similarity index 90% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/kitkat/ArtHeader_KitKat.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_005.java index f297992fd1..f57bd52964 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/kitkat/ArtHeader_KitKat.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_005.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.kitkat; +package ghidra.file.formats.android.art.headers; import java.io.IOException; @@ -22,14 +22,13 @@ import ghidra.file.formats.android.art.ArtHeader; import ghidra.program.model.data.DataType; import ghidra.program.model.data.Structure; import ghidra.program.model.listing.Program; -import ghidra.util.InvalidNameException; import ghidra.util.exception.DuplicateNameException; import ghidra.util.task.TaskMonitor; /** - * @see https://android.googlesource.com/platform/art/+/refs/heads/kitkat-release/runtime/image.cc + * kitkat-release/runtime/image.c */ -public class ArtHeader_KitKat extends ArtHeader { +public class ArtHeader_005 extends ArtHeader { protected int image_begin_; protected int image_size_; @@ -42,7 +41,7 @@ public class ArtHeader_KitKat extends ArtHeader { protected int oat_file_end_; protected int image_roots_; - public ArtHeader_KitKat(BinaryReader reader) throws IOException { + public ArtHeader_005(BinaryReader reader) throws IOException { super(reader); parse(reader); } @@ -151,13 +150,6 @@ public class ArtHeader_KitKat extends ArtHeader { public DataType toDataType() throws DuplicateNameException, IOException { Structure structure = (Structure) super.toDataType(); - try { - structure.setName(ArtHeader_KitKat.class.getSimpleName()); - } - catch (InvalidNameException e) { - //ignore - } - structure.add(DWORD, "image_begin_", null); structure.add(DWORD, "image_size_", null); structure.add(DWORD, "image_bitmap_offset_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/lollipop/ArtHeader_Lollipop.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_009.java similarity index 88% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/lollipop/ArtHeader_Lollipop.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_009.java index e472c815f0..bfda54426a 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/lollipop/ArtHeader_Lollipop.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_009.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.lollipop; +package ghidra.file.formats.android.art.headers; import java.io.IOException; @@ -22,14 +22,13 @@ import ghidra.file.formats.android.art.ArtHeader; import ghidra.program.model.data.DataType; import ghidra.program.model.data.Structure; import ghidra.program.model.listing.Program; -import ghidra.util.InvalidNameException; import ghidra.util.exception.DuplicateNameException; import ghidra.util.task.TaskMonitor; /** - * @see https://android.googlesource.com/platform/art/+/refs/heads/lollipop-release/runtime/image.cc + * lollipop-release/runtime/image.c */ -public class ArtHeader_Lollipop extends ArtHeader { +public class ArtHeader_009 extends ArtHeader { protected int image_begin_; protected int image_size_; @@ -43,7 +42,7 @@ public class ArtHeader_Lollipop extends ArtHeader { protected int patch_delta_; protected int image_roots_; - public ArtHeader_Lollipop(BinaryReader reader) throws IOException { + public ArtHeader_009(BinaryReader reader) throws IOException { super(reader); parse(reader); } @@ -127,13 +126,6 @@ public class ArtHeader_Lollipop extends ArtHeader { public DataType toDataType() throws DuplicateNameException, IOException { Structure structure = (Structure) super.toDataType(); - try { - structure.setName(ArtHeader_Lollipop.class.getSimpleName()); - } - catch (InvalidNameException e) { - //ignore - } - structure.add(DWORD, "image_begin_", null); structure.add(DWORD, "image_size_", null); structure.add(DWORD, "image_bitmap_offset_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/lollipop/ArtHeader_LollipopMR1WFC.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_012.java similarity index 88% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/lollipop/ArtHeader_LollipopMR1WFC.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_012.java index 53a053aa89..9e46e03b50 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/lollipop/ArtHeader_LollipopMR1WFC.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_012.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.lollipop; +package ghidra.file.formats.android.art.headers; import java.io.IOException; @@ -22,14 +22,13 @@ import ghidra.file.formats.android.art.ArtHeader; import ghidra.program.model.data.DataType; import ghidra.program.model.data.Structure; import ghidra.program.model.listing.Program; -import ghidra.util.InvalidNameException; import ghidra.util.exception.DuplicateNameException; import ghidra.util.task.TaskMonitor; /** - * @see https://android.googlesource.com/platform/art/+/lollipop-mr1-wfc-release/runtime/image.h + * lollipop-mr1-wfc-release/runtime/image.c */ -public class ArtHeader_LollipopMR1WFC extends ArtHeader { +public class ArtHeader_012 extends ArtHeader { protected int image_begin_; protected int image_size_; @@ -44,7 +43,7 @@ public class ArtHeader_LollipopMR1WFC extends ArtHeader { protected int image_roots_; protected int compile_pic_; - public ArtHeader_LollipopMR1WFC(BinaryReader reader) throws IOException { + public ArtHeader_012(BinaryReader reader) throws IOException { super(reader); parse(reader); } @@ -126,13 +125,6 @@ public class ArtHeader_LollipopMR1WFC extends ArtHeader { public DataType toDataType() throws DuplicateNameException, IOException { Structure structure = (Structure) super.toDataType(); - try { - structure.setName(ArtHeader_LollipopMR1WFC.class.getSimpleName()); - } - catch (InvalidNameException e) { - //ignore - } - structure.add(DWORD, "image_begin_", null); structure.add(DWORD, "image_size_", null); structure.add(DWORD, "image_bitmap_offset_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/marshmallow/ArtHeader_Marshmallow.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_017.java similarity index 90% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/marshmallow/ArtHeader_Marshmallow.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_017.java index f143c1fbc9..2f15473c98 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/marshmallow/ArtHeader_Marshmallow.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_017.java @@ -13,23 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.marshmallow; +package ghidra.file.formats.android.art.headers; import java.io.IOException; import ghidra.app.util.bin.BinaryReader; import ghidra.file.formats.android.art.*; +import ghidra.file.formats.android.art.image_method.ImageMethod_Marshmallow; import ghidra.program.model.data.DataType; import ghidra.program.model.data.Structure; import ghidra.program.model.listing.Program; -import ghidra.util.InvalidNameException; import ghidra.util.exception.DuplicateNameException; import ghidra.util.task.TaskMonitor; /** - * @see https://android.googlesource.com/platform/art/+/marshmallow-release/runtime/image.h + * marshmallow-release/runtime/image.c */ -public class ArtHeader_Marshmallow extends ArtHeader { +public class ArtHeader_017 extends ArtHeader { protected int image_begin_; protected int image_size_; @@ -48,7 +48,7 @@ public class ArtHeader_Marshmallow extends ArtHeader { protected ArtImageSections sections; - public ArtHeader_Marshmallow(BinaryReader reader) throws IOException { + public ArtHeader_017(BinaryReader reader) throws IOException { super(reader); parse(reader); } @@ -142,12 +142,6 @@ public class ArtHeader_Marshmallow extends ArtHeader { public DataType toDataType() throws DuplicateNameException, IOException { Structure structure = (Structure) super.toDataType(); - try { - structure.setName(ArtHeader_Marshmallow.class.getSimpleName()); - } - catch (InvalidNameException e) { - } - structure.add(DWORD, "image_begin_", null); structure.add(DWORD, "image_size_", null); structure.add(DWORD, "oat_checksum_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/nougat/ArtHeader_Nougat.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_029.java similarity index 91% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/nougat/ArtHeader_Nougat.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_029.java index d66cee0e1e..ad47c25ee7 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/nougat/ArtHeader_Nougat.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_029.java @@ -13,25 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.nougat; +package ghidra.file.formats.android.art.headers; import java.io.IOException; import ghidra.app.util.bin.BinaryReader; import ghidra.file.formats.android.art.*; +import ghidra.file.formats.android.art.image_method.ImageMethod_Nougat; import ghidra.file.formats.android.util.DecompressionManager; import ghidra.program.model.data.DataType; import ghidra.program.model.data.Structure; import ghidra.program.model.listing.Program; -import ghidra.util.InvalidNameException; import ghidra.util.exception.DuplicateNameException; import ghidra.util.task.TaskMonitor; /** - * https://android.googlesource.com/platform/art/+/nougat-release/runtime/image.h - * https://android.googlesource.com/platform/art/+/nougat-release/runtime/image.cc + * nougat-release/runtime/image.c */ -public class ArtHeader_Nougat extends ArtHeader implements ArtCompression { +public class ArtHeader_029 extends ArtHeader implements ArtCompression { protected int image_begin_; protected int image_size_; @@ -56,7 +55,7 @@ public class ArtHeader_Nougat extends ArtHeader implements ArtCompression { private long _compressedOffset; - public ArtHeader_Nougat(BinaryReader reader) throws IOException { + public ArtHeader_029(BinaryReader reader) throws IOException { super(reader); parse(reader); } @@ -207,13 +206,6 @@ public class ArtHeader_Nougat extends ArtHeader implements ArtCompression { public DataType toDataType() throws DuplicateNameException, IOException { Structure structure = (Structure) super.toDataType(); - try { - structure.setName(ArtHeader_Nougat.class.getSimpleName()); - } - catch (InvalidNameException e) { - //ignore, just use original name should this fail - } - structure.add(DWORD, "image_begin_", null); structure.add(DWORD, "image_size_", null); structure.add(DWORD, "oat_checksum_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_Oreo.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_030.java similarity index 58% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_Oreo.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_030.java index 460147424b..cc7fa6a8fd 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_Oreo.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_030.java @@ -13,29 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.oat; +package ghidra.file.formats.android.art.headers; import java.io.IOException; import ghidra.app.util.bin.BinaryReader; -import ghidra.program.model.data.DataType; -import ghidra.util.exception.DuplicateNameException; +import ghidra.file.formats.android.art.image_method.ImageMethod_Nougat; -public class OatHeader_Oreo extends OatHeader_Marshmallow { +/** + * nougat-mr2-pixel-release/runtime/image.c + */ +public class ArtHeader_030 extends ArtHeader_029 { - OatHeader_Oreo(BinaryReader reader) throws IOException { + public ArtHeader_030(BinaryReader reader) throws IOException { super(reader); } @Override - public DataType toDataType() throws DuplicateNameException, IOException { - DataType dataType = super.toDataType(); - try { - dataType.setName(OatHeader_Oreo.class.getSimpleName()); - } - catch (Exception e) { - //ignore - } - return dataType; + public int getArtMethodCountForVersion() { + return ImageMethod_Nougat.kImageMethodsCount.ordinal(); } + } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_Nougat.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_043.java similarity index 57% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_Nougat.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_043.java index 89efec0cee..5460b00411 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_Nougat.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_043.java @@ -13,29 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.oat; +package ghidra.file.formats.android.art.headers; import java.io.IOException; import ghidra.app.util.bin.BinaryReader; -import ghidra.program.model.data.DataType; -import ghidra.util.exception.DuplicateNameException; +import ghidra.file.formats.android.art.image_method.ImageMethod_Oreo; -public class OatHeader_Nougat extends OatHeader_Marshmallow { +/** + * oreo-release/runtime/image.c + */ +public class ArtHeader_043 extends ArtHeader_030 { - OatHeader_Nougat(BinaryReader reader) throws IOException { + public ArtHeader_043(BinaryReader reader) throws IOException { super(reader); } @Override - public DataType toDataType() throws DuplicateNameException, IOException { - DataType dataType = super.toDataType(); - try { - dataType.setName(OatHeader_Nougat.class.getSimpleName()); - } - catch (Exception e) { - //ignore - } - return dataType; + public int getArtMethodCountForVersion() { + return ImageMethod_Oreo.kImageMethodsCount.ordinal(); } + } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_044.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_044.java new file mode 100644 index 0000000000..1760738aa0 --- /dev/null +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_044.java @@ -0,0 +1,29 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ghidra.file.formats.android.art.headers; + +import java.io.IOException; + +import ghidra.app.util.bin.BinaryReader; + +/** + * oreo-dr1-release/runtime/image.c + */ +public class ArtHeader_044 extends ArtHeader_043 { + public ArtHeader_044(BinaryReader reader) throws IOException { + super(reader); + } +} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeader_11.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_046.java similarity index 56% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeader_11.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_046.java index d5fc7cb06c..1b782a2afb 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeader_11.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_046.java @@ -13,29 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.vdex; +package ghidra.file.formats.android.art.headers; import java.io.IOException; import ghidra.app.util.bin.BinaryReader; -import ghidra.program.model.data.DataType; -import ghidra.util.exception.DuplicateNameException; +import ghidra.file.formats.android.art.image_method.ImageMethod_Oreo; -public class VdexHeader_11 extends VdexHeader_10 { +/** + * oreo-mr1-release/runtime/image.c + */ +public class ArtHeader_046 extends ArtHeader_044 { - public VdexHeader_11(BinaryReader reader) throws IOException, UnsupportedVdexVersionException { + public ArtHeader_046(BinaryReader reader) throws IOException { super(reader); } @Override - public DataType toDataType() throws DuplicateNameException, IOException { - DataType dataType = super.toDataType(); - try { - dataType.setName(VdexHeader_11.class.getSimpleName()); - } - catch (Exception e) { - //ignore... - } - return dataType; + public int getArtMethodCountForVersion() { + return ImageMethod_Oreo.kImageMethodsCount.ordinal(); } + } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/pie/ArtHeader_Pie.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_056.java similarity index 93% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/pie/ArtHeader_Pie.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_056.java index d4351141d6..7f1e72570f 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/pie/ArtHeader_Pie.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_056.java @@ -13,24 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.pie; +package ghidra.file.formats.android.art.headers; import java.io.IOException; import ghidra.app.util.bin.BinaryReader; import ghidra.file.formats.android.art.*; +import ghidra.file.formats.android.art.image_method.ImageMethod_Pie; import ghidra.file.formats.android.util.DecompressionManager; import ghidra.program.model.data.DataType; import ghidra.program.model.data.Structure; import ghidra.program.model.listing.Program; -import ghidra.util.InvalidNameException; import ghidra.util.exception.DuplicateNameException; import ghidra.util.task.TaskMonitor; /** - * https://android.googlesource.com/platform/art/+/refs/heads/pie-release/runtime/image.h + * pie-release/runtime/image.c */ -public class ArtHeader_Pie extends ArtHeader implements ArtCompression { +public class ArtHeader_056 extends ArtHeader implements ArtCompression { protected int image_begin_; protected int image_size_; @@ -57,7 +57,7 @@ public class ArtHeader_Pie extends ArtHeader implements ArtCompression { private long _compressedOffset; - public ArtHeader_Pie(BinaryReader reader) throws IOException { + public ArtHeader_056(BinaryReader reader) throws IOException { super(reader); parse(reader); } @@ -204,13 +204,6 @@ public class ArtHeader_Pie extends ArtHeader implements ArtCompression { public DataType toDataType() throws DuplicateNameException, IOException { Structure structure = (Structure) super.toDataType(); - try { - structure.setName(ArtHeader_Pie.class.getSimpleName()); - } - catch (InvalidNameException e) { - //ignore - } - structure.add(DWORD, "image_begin_", null); structure.add(DWORD, "image_size_", null); structure.add(DWORD, "oat_checksum_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android10/ArtHeader_10.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_074.java similarity index 90% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android10/ArtHeader_10.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_074.java index df5f55a938..6aa796878f 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android10/ArtHeader_10.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_074.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.android10; +package ghidra.file.formats.android.art.headers; import java.io.IOException; import java.util.ArrayList; @@ -21,18 +21,18 @@ import java.util.List; import ghidra.app.util.bin.BinaryReader; import ghidra.file.formats.android.art.*; +import ghidra.file.formats.android.art.image_method.ImageMethod_Q; import ghidra.file.formats.android.util.DecompressionManager; import ghidra.program.model.data.DataType; import ghidra.program.model.data.Structure; import ghidra.program.model.listing.Program; -import ghidra.util.InvalidNameException; import ghidra.util.exception.DuplicateNameException; import ghidra.util.task.TaskMonitor; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android10-release/runtime/image.h + * android10-release/runtime/image.c */ -public class ArtHeader_10 extends ArtHeader { +public class ArtHeader_074 extends ArtHeader { private int image_reservation_size_; private int component_count_; @@ -48,7 +48,7 @@ public class ArtHeader_10 extends ArtHeader { private int boot_image_size_; private int image_roots_; private int pointer_size_; - private long[] image_methods_ = new long[ImageMethod_10.kImageMethodsCount.ordinal()]; + private long[] image_methods_ = new long[ImageMethod_Q.kImageMethodsCount.ordinal()]; private int data_size_; private int blocks_offset_; private int blocks_count_; @@ -56,7 +56,7 @@ public class ArtHeader_10 extends ArtHeader { private ArtImageSections sections; - public ArtHeader_10(BinaryReader reader) throws IOException { + public ArtHeader_074(BinaryReader reader) throws IOException { super(reader); parse(reader); } @@ -104,7 +104,7 @@ public class ArtHeader_10 extends ArtHeader { @Override public int getArtMethodCountForVersion() { - return ImageMethod_10.kImageMethodsCount.ordinal(); + return ImageMethod_Q.kImageMethodsCount.ordinal(); } @Override @@ -196,13 +196,6 @@ public class ArtHeader_10 extends ArtHeader { public DataType toDataType() throws DuplicateNameException, IOException { Structure structure = (Structure) super.toDataType(); - try { - structure.setName(ArtHeader_10.class.getSimpleName()); - } - catch (InvalidNameException e) { - // ignore, just use original name should this fail - } - structure.add(DWORD, "image_reservation_size_", null); structure.add(DWORD, "component_count_", null); structure.add(DWORD, "image_begin_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android11/ArtHeader_11.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_085.java similarity index 90% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android11/ArtHeader_11.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_085.java index f2b1d3c5ed..31a2c992d8 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android11/ArtHeader_11.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_085.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.android11; +package ghidra.file.formats.android.art.headers; import java.io.IOException; import java.util.ArrayList; @@ -21,19 +21,18 @@ import java.util.List; import ghidra.app.util.bin.BinaryReader; import ghidra.file.formats.android.art.*; -import ghidra.file.formats.android.art.android10.ImageMethod_10; +import ghidra.file.formats.android.art.image_method.ImageMethod_Q; import ghidra.file.formats.android.util.DecompressionManager; import ghidra.program.model.data.DataType; import ghidra.program.model.data.Structure; import ghidra.program.model.listing.Program; -import ghidra.util.InvalidNameException; import ghidra.util.exception.DuplicateNameException; import ghidra.util.task.TaskMonitor; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android10-release/runtime/image.h + * android11-release/runtime/image.c */ -public class ArtHeader_11 extends ArtHeader { +public class ArtHeader_085 extends ArtHeader { private int image_reservation_size_; private int component_count_; @@ -51,7 +50,7 @@ public class ArtHeader_11 extends ArtHeader { private int boot_image_checksum_; private int image_roots_; private int pointer_size_; - private long[] image_methods_ = new long[ImageMethod_10.kImageMethodsCount.ordinal()]; + private long[] image_methods_ = new long[ImageMethod_Q.kImageMethodsCount.ordinal()]; private int data_size_; private int blocks_offset_; private int blocks_count_; @@ -59,7 +58,7 @@ public class ArtHeader_11 extends ArtHeader { private ArtImageSections sections; - public ArtHeader_11(BinaryReader reader) throws IOException { + public ArtHeader_085(BinaryReader reader) throws IOException { super(reader); parse(reader); } @@ -109,7 +108,7 @@ public class ArtHeader_11 extends ArtHeader { @Override public int getArtMethodCountForVersion() { - return ImageMethod_10.kImageMethodsCount.ordinal(); + return ImageMethod_Q.kImageMethodsCount.ordinal(); } @Override @@ -208,13 +207,6 @@ public class ArtHeader_11 extends ArtHeader { public DataType toDataType() throws DuplicateNameException, IOException { Structure structure = (Structure) super.toDataType(); - try { - structure.setName(ArtHeader_11.class.getSimpleName()); - } - catch (InvalidNameException e) { - //ignore - } - structure.add(DWORD, "image_reservation_size_", null); structure.add(DWORD, "component_count_", null); structure.add(DWORD, "image_begin_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_099.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_099.java new file mode 100644 index 0000000000..28c757ff6f --- /dev/null +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_099.java @@ -0,0 +1,29 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ghidra.file.formats.android.art.headers; + +import java.io.IOException; + +import ghidra.app.util.bin.BinaryReader; + +/** + * android12-release/runtime/image.c + */ +public class ArtHeader_099 extends ArtHeader_085 { + public ArtHeader_099(BinaryReader reader) throws IOException { + super(reader); + } +} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_106.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_106.java new file mode 100644 index 0000000000..0b91ccdba7 --- /dev/null +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/headers/ArtHeader_106.java @@ -0,0 +1,29 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ghidra.file.formats.android.art.headers; + +import java.io.IOException; + +import ghidra.app.util.bin.BinaryReader; + +/** + * android13-release/runtime/image.c + */ +public class ArtHeader_106 extends ArtHeader_099 { + public ArtHeader_106(BinaryReader reader) throws IOException { + super(reader); + } +} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/marshmallow/ImageMethod_Marshmallow.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_method/ImageMethod_Marshmallow.java similarity index 79% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/marshmallow/ImageMethod_Marshmallow.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_method/ImageMethod_Marshmallow.java index 698e0c8908..3a328b77f3 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/marshmallow/ImageMethod_Marshmallow.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_method/ImageMethod_Marshmallow.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.marshmallow; +package ghidra.file.formats.android.art.image_method; /** - * https://android.googlesource.com/platform/art/+/refs/heads/pie-release/runtime/image.h + * marshmallow-release/runtime/image.h */ public enum ImageMethod_Marshmallow { kResolutionMethod, diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/nougat/ImageMethod_Nougat.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_method/ImageMethod_Nougat.java similarity index 80% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/nougat/ImageMethod_Nougat.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_method/ImageMethod_Nougat.java index fa635f90ef..8fb68b9591 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/nougat/ImageMethod_Nougat.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_method/ImageMethod_Nougat.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.nougat; +package ghidra.file.formats.android.art.image_method; /** - * https://android.googlesource.com/platform/art/+/refs/heads/pie-release/runtime/image.h + * nougat-release/runtime/image.h */ public enum ImageMethod_Nougat { kResolutionMethod, diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/oreo/ImageMethod_Oreo.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_method/ImageMethod_Oreo.java similarity index 81% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/oreo/ImageMethod_Oreo.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_method/ImageMethod_Oreo.java index 34b84ca9de..a252c04d93 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/oreo/ImageMethod_Oreo.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_method/ImageMethod_Oreo.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.oreo; +package ghidra.file.formats.android.art.image_method; /** - * https://android.googlesource.com/platform/art/+/refs/heads/oreo-release/runtime/image.h + * oreo-release/runtime/image.h */ public enum ImageMethod_Oreo { kResolutionMethod, diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/pie/ImageMethod_Pie.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_method/ImageMethod_Pie.java similarity index 82% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/pie/ImageMethod_Pie.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_method/ImageMethod_Pie.java index dc6103b4c7..ea9394a971 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/pie/ImageMethod_Pie.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_method/ImageMethod_Pie.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.pie; +package ghidra.file.formats.android.art.image_method; /** - * https://android.googlesource.com/platform/art/+/refs/heads/pie-release/runtime/image.h + * pie-release/runtime/image.h */ public enum ImageMethod_Pie { kResolutionMethod, diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android10/ImageMethod_10.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_method/ImageMethod_Q.java similarity index 79% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android10/ImageMethod_10.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_method/ImageMethod_Q.java index 793c3ffb59..7430ea053f 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android10/ImageMethod_10.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_method/ImageMethod_Q.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.android10; +package ghidra.file.formats.android.art.image_method; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android10-release/runtime/image.h + * android10-release/runtime/image.h */ -public enum ImageMethod_10 { +public enum ImageMethod_Q { kResolutionMethod, kImtConflictMethod, kImtUnimplementedMethod, diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/kitkat/ImageRoot_KitKat.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_KitKat.java similarity index 80% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/kitkat/ImageRoot_KitKat.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_KitKat.java index cf871d2ae1..c608bab6eb 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/kitkat/ImageRoot_KitKat.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_KitKat.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.kitkat; +package ghidra.file.formats.android.art.image_root; /** - * @see https://android.googlesource.com/platform/art/+/refs/heads/kitkat-release/runtime/image.h + * kitkat-release/runtime/image.h */ public enum ImageRoot_KitKat { kResolutionMethod, diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/lollipop/ImageRoot_Lollipop.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_Lollipop.java similarity index 80% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/lollipop/ImageRoot_Lollipop.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_Lollipop.java index c979bf59c1..ebbd782c23 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/lollipop/ImageRoot_Lollipop.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_Lollipop.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.lollipop; +package ghidra.file.formats.android.art.image_root; /** - * @see https://android.googlesource.com/platform/art/+/refs/heads/lollipop-release/runtime/image.h + * lollipop-release/runtime/image.h */ public enum ImageRoot_Lollipop { kResolutionMethod, diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/lollipop/ImageRoot_LollipopMR1WRC.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_LollipopMR1WRC.java similarity index 79% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/lollipop/ImageRoot_LollipopMR1WRC.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_LollipopMR1WRC.java index 28d713e5ad..45eff05bed 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/lollipop/ImageRoot_LollipopMR1WRC.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_LollipopMR1WRC.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.lollipop; +package ghidra.file.formats.android.art.image_root; /** - * @see https://android.googlesource.com/platform/art/+/lollipop-mr1-wfc-release/runtime/image.h + * lollipop-mr1-wfc-release/runtime/image.h */ public enum ImageRoot_LollipopMR1WRC { kResolutionMethod, diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/marshmallow/ImageRoot_Marshmallow.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_Marshmallow.java similarity index 79% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/marshmallow/ImageRoot_Marshmallow.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_Marshmallow.java index 4cc6b89304..0bb75b4a7a 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/marshmallow/ImageRoot_Marshmallow.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_Marshmallow.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.marshmallow; +package ghidra.file.formats.android.art.image_root; /** - * @see https://android.googlesource.com/platform/art/+/marshmallow-release/runtime/image.h + * marshmallow-release/runtime/image.h */ public enum ImageRoot_Marshmallow { kResolutionMethod, diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/nougat/ImageRoot_Nougat.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_Nougat.java similarity index 72% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/nougat/ImageRoot_Nougat.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_Nougat.java index 0a362685c0..5c23806153 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/nougat/ImageRoot_Nougat.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_Nougat.java @@ -13,11 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.nougat; +package ghidra.file.formats.android.art.image_root; /** - * @see https://android.googlesource.com/platform/art/+/nougat-release/runtime/image.h + * nougat-release/runtime/image.h */ public enum ImageRoot_Nougat { - kDexCaches, kClassRoots, kImageRootsMax, + kDexCaches, + kClassRoots, + kImageRootsMax, } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/oreo/ImageRoot_Oreo.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_Oreo.java similarity index 78% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/oreo/ImageRoot_Oreo.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_Oreo.java index fee0334063..a6a61d5d60 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/oreo/ImageRoot_Oreo.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_Oreo.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.oreo; +package ghidra.file.formats.android.art.image_root; /** - * https://android.googlesource.com/platform/art/+/refs/heads/oreo-release/runtime/image.h + * oreo-release/runtime/image.h */ public enum ImageRoot_Oreo { kDexCaches, diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/pie/ImageRoot_Pie.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_Pie.java similarity index 78% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/pie/ImageRoot_Pie.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_Pie.java index 9cfca767e5..ba6fd8476e 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/pie/ImageRoot_Pie.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_Pie.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.pie; +package ghidra.file.formats.android.art.image_root; /** - * https://android.googlesource.com/platform/art/+/nougat-release/runtime/image.h + * pie-release/runtime/image.h */ public enum ImageRoot_Pie { kDexCaches, diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android10/ImageRoot_10.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_Q.java similarity index 76% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android10/ImageRoot_10.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_Q.java index 315fa68b4e..561bf462d8 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android10/ImageRoot_10.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_Q.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.android10; +package ghidra.file.formats.android.art.image_root; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android10-release/runtime/image.h + * android10-release/runtime/image.h */ -public enum ImageRoot_10 { +public enum ImageRoot_Q { kDexCaches, kClassRoots, /** Pre-allocated OOME when throwing exception.*/ @@ -36,8 +36,8 @@ public enum ImageRoot_10 { //Aliases /** The class loader used to build the app image.*/ - public final static ImageRoot_10 kAppImageClassLoader = kSpecialRoots; + public final static ImageRoot_Q kAppImageClassLoader = kSpecialRoots; /** Array of boot image objects that must be kept live. */ - public final static ImageRoot_10 kBootImageLiveObjects = kSpecialRoots; + public final static ImageRoot_Q kBootImageLiveObjects = kSpecialRoots; } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android11/ImageRoot_11.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_R.java similarity index 68% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android11/ImageRoot_11.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_R.java index c91c821b59..2a13f471cc 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android11/ImageRoot_11.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_root/ImageRoot_R.java @@ -13,19 +13,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.android11; +package ghidra.file.formats.android.art.image_root; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android11-release/runtime/image.h + * android11-release/runtime/image.h */ -public enum ImageRoot_11 { +public enum ImageRoot_R { kDexCaches, kClassRoots, kSpecialRoots, kImageRootsMax; //Aliases /** The class loader used to build the app image.*/ - public final static ImageRoot_11 kAppImageClassLoader = kSpecialRoots; + public final static ImageRoot_R kAppImageClassLoader = kSpecialRoots; /** Array of boot image objects that must be kept live. */ - public final static ImageRoot_11 kBootImageLiveObjects = kSpecialRoots; + public final static ImageRoot_R kBootImageLiveObjects = kSpecialRoots; } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/marshmallow/ImageSections_Marshmallow.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_Marshmallow.java similarity index 91% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/marshmallow/ImageSections_Marshmallow.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_Marshmallow.java index 3bf5606ff0..8e9eeacfd0 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/marshmallow/ImageSections_Marshmallow.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_Marshmallow.java @@ -13,12 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.marshmallow; +package ghidra.file.formats.android.art.image_sections; import ghidra.app.util.bin.BinaryReader; import ghidra.file.formats.android.art.ArtHeader; import ghidra.file.formats.android.art.ArtImageSections; +/** + * marshmallow-release/runtime/image.h + */ public class ImageSections_Marshmallow extends ArtImageSections { public final static int kSectionObjects = 0; public final static int kSectionArtFields = 1; diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/nougat/ImageSections_Nougat.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_Nougat.java similarity index 92% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/nougat/ImageSections_Nougat.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_Nougat.java index 3452f4ff8a..866d07f3e7 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/nougat/ImageSections_Nougat.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_Nougat.java @@ -13,12 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.nougat; +package ghidra.file.formats.android.art.image_sections; import ghidra.app.util.bin.BinaryReader; import ghidra.file.formats.android.art.ArtHeader; import ghidra.file.formats.android.art.ArtImageSections; +/** + * nougat-release/runtime/image.h + */ public class ImageSections_Nougat extends ArtImageSections { public final static int kSectionObjects = 0; public final static int kSectionArtFields = 1; diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/nougat/ImageSections_NougatMR2Pixel.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_NougatMR2Pixel.java similarity index 92% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/nougat/ImageSections_NougatMR2Pixel.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_NougatMR2Pixel.java index 8886244da8..9e87a380b2 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/nougat/ImageSections_NougatMR2Pixel.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_NougatMR2Pixel.java @@ -13,12 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.nougat; +package ghidra.file.formats.android.art.image_sections; import ghidra.app.util.bin.BinaryReader; import ghidra.file.formats.android.art.ArtHeader; import ghidra.file.formats.android.art.ArtImageSections; +/** + * nougat-mr2-pixel-release/runtime/image.h + */ public class ImageSections_NougatMR2Pixel extends ArtImageSections { public final static int kSectionObjects = 0; public final static int kSectionArtFields = 1; diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/oreo/ImageSections_Oreo.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_Oreo.java similarity index 93% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/oreo/ImageSections_Oreo.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_Oreo.java index c046b0050e..3f5f025a1d 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/oreo/ImageSections_Oreo.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_Oreo.java @@ -13,12 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.oreo; +package ghidra.file.formats.android.art.image_sections; import ghidra.app.util.bin.BinaryReader; import ghidra.file.formats.android.art.ArtHeader; import ghidra.file.formats.android.art.ArtImageSections; +/** + * oreo-release/runtime/image.h + */ public class ImageSections_Oreo extends ArtImageSections { public final static int kSectionObjects = 0; public final static int kSectionArtFields = 1; diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/oreo/ImageSections_OreoMR1.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_OreoMR1.java similarity index 92% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/oreo/ImageSections_OreoMR1.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_OreoMR1.java index 657de24612..52f3dcc6fb 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/oreo/ImageSections_OreoMR1.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_OreoMR1.java @@ -13,12 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.oreo; +package ghidra.file.formats.android.art.image_sections; import ghidra.app.util.bin.BinaryReader; import ghidra.file.formats.android.art.ArtHeader; import ghidra.file.formats.android.art.ArtImageSections; +/** + * oreo-mr1-release/runtime/image.h + */ public class ImageSections_OreoMR1 extends ArtImageSections { public final static int kSectionObjects = 0; public final static int kSectionArtFields = 1; diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/pie/ImageSections_Pie.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_Pie.java similarity index 92% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/pie/ImageSections_Pie.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_Pie.java index 3cf9f8beb0..50911c82c7 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/pie/ImageSections_Pie.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_Pie.java @@ -13,12 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.pie; +package ghidra.file.formats.android.art.image_sections; import ghidra.app.util.bin.BinaryReader; import ghidra.file.formats.android.art.ArtHeader; import ghidra.file.formats.android.art.ArtImageSections; +/** + * pie-release/runtime/image.h + */ public class ImageSections_Pie extends ArtImageSections { public final static int kSectionObjects = 0; public final static int kSectionArtFields = 1; diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android10/ImageSections_10.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_Q_R.java similarity index 84% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android10/ImageSections_10.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_Q_R.java index b61d930d14..eae2fcf75e 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android10/ImageSections_10.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_Q_R.java @@ -13,16 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.android10; +package ghidra.file.formats.android.art.image_sections; import ghidra.app.util.bin.BinaryReader; import ghidra.file.formats.android.art.ArtHeader; import ghidra.file.formats.android.art.ArtImageSections; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android10-release/runtime/image.h + * android10-release/runtime/image.h + * + * android11-release/runtime/image.h */ -public class ImageSections_10 extends ArtImageSections { +public class ImageSections_Q_R extends ArtImageSections { public final static int kSectionObjects = 0; public final static int kSectionArtFields = 1; public final static int kSectionArtMethods = 2; @@ -37,7 +39,7 @@ public class ImageSections_10 extends ArtImageSections { public final static int kSectionImageBitmap = 11; public final static int kSectionCount = 12; // Number of elements in enum. - public ImageSections_10(BinaryReader reader, ArtHeader header) { + public ImageSections_Q_R(BinaryReader reader, ArtHeader header) { super(reader, header); } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android12/ImageSections_12.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_S_T.java similarity index 84% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android12/ImageSections_12.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_S_T.java index 5ceeee22ce..8be949b56b 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/android12/ImageSections_12.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/image_sections/ImageSections_S_T.java @@ -13,18 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.art.android12; +package ghidra.file.formats.android.art.image_sections; import ghidra.app.util.bin.BinaryReader; import ghidra.file.formats.android.art.ArtHeader; import ghidra.file.formats.android.art.ArtImageSections; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android-s-beta-4/runtime/image.h#254 + * android12-release/runtime/image.h * - * https://android.googlesource.com/platform/art/+/refs/heads/android-s-beta-4/runtime/image.h#254 + * android13-release/runtime/image.h */ -public class ImageSections_12 extends ArtImageSections { +public class ImageSections_S_T extends ArtImageSections { public final static int kSectionObjects = 0; public final static int kSectionArtFields = 1; public final static int kSectionArtMethods = 2; @@ -38,7 +38,7 @@ public class ImageSections_12 extends ArtImageSections { public final static int kSectionImageBitmap = 10; public final static int kSectionCount = 11; // Number of elements in enum. - public ImageSections_12(BinaryReader reader, ArtHeader header) { + public ImageSections_S_T(BinaryReader reader, ArtHeader header) { super(reader, header); } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/nougat/ArtHeader_NougatMR2Pixel.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/nougat/ArtHeader_NougatMR2Pixel.java deleted file mode 100644 index a4580ad827..0000000000 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/nougat/ArtHeader_NougatMR2Pixel.java +++ /dev/null @@ -1,52 +0,0 @@ -/* ### - * IP: GHIDRA - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package ghidra.file.formats.android.art.nougat; - -import java.io.IOException; - -import ghidra.app.util.bin.BinaryReader; -import ghidra.program.model.data.DataType; -import ghidra.program.model.data.Structure; -import ghidra.util.InvalidNameException; -import ghidra.util.exception.DuplicateNameException; - -/** - * https://android.googlesource.com/platform/art/+/nougat-mr2-pixel-release/runtime/image.h - */ -public class ArtHeader_NougatMR2Pixel extends ArtHeader_Nougat { - - public ArtHeader_NougatMR2Pixel(BinaryReader reader) throws IOException { - super(reader); - } - - @Override - public int getArtMethodCountForVersion() { - return ImageMethod_Nougat.kImageMethodsCount.ordinal(); - } - - @Override - public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = (Structure) super.toDataType(); - try { - structure.setName(ArtHeader_NougatMR2Pixel.class.getSimpleName()); - } - catch (InvalidNameException e) { - //ignore - } - return structure; - } - -} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/oreo/ArtHeader_Oreo.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/oreo/ArtHeader_Oreo.java deleted file mode 100644 index dca9f0c7ce..0000000000 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/oreo/ArtHeader_Oreo.java +++ /dev/null @@ -1,53 +0,0 @@ -/* ### - * IP: GHIDRA - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package ghidra.file.formats.android.art.oreo; - -import java.io.IOException; - -import ghidra.app.util.bin.BinaryReader; -import ghidra.file.formats.android.art.nougat.ArtHeader_NougatMR2Pixel; -import ghidra.program.model.data.DataType; -import ghidra.program.model.data.Structure; -import ghidra.util.InvalidNameException; -import ghidra.util.exception.DuplicateNameException; - -/** - * https://android.googlesource.com/platform/art/+/oreo-release/runtime/image.h - */ -public class ArtHeader_Oreo extends ArtHeader_NougatMR2Pixel { - - public ArtHeader_Oreo(BinaryReader reader) throws IOException { - super(reader); - } - - @Override - public int getArtMethodCountForVersion() { - return ImageMethod_Oreo.kImageMethodsCount.ordinal(); - } - - @Override - public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = (Structure) super.toDataType(); - try { - structure.setName(ArtHeader_Oreo.class.getSimpleName()); - } - catch (InvalidNameException e) { - //ignore - } - return structure; - } - -} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/oreo/ArtHeader_OreoMR1.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/oreo/ArtHeader_OreoMR1.java deleted file mode 100644 index bdd85ba7aa..0000000000 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/art/oreo/ArtHeader_OreoMR1.java +++ /dev/null @@ -1,52 +0,0 @@ -/* ### - * IP: GHIDRA - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package ghidra.file.formats.android.art.oreo; - -import java.io.IOException; - -import ghidra.app.util.bin.BinaryReader; -import ghidra.program.model.data.DataType; -import ghidra.program.model.data.Structure; -import ghidra.util.InvalidNameException; -import ghidra.util.exception.DuplicateNameException; - -/** - * https://android.googlesource.com/platform/art/+/oreo-mr1-release/runtime/image.h - */ -public class ArtHeader_OreoMR1 extends ArtHeader_Oreo { - - public ArtHeader_OreoMR1(BinaryReader reader) throws IOException { - super(reader); - } - - @Override - public int getArtMethodCountForVersion() { - return ImageMethod_Oreo.kImageMethodsCount.ordinal(); - } - - @Override - public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = (Structure) super.toDataType(); - try { - structure.setName(ArtHeader_OreoMR1.class.getSimpleName()); - } - catch (InvalidNameException e) { - //ignore - } - return structure; - } - -} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatConstants.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatConstants.java index c91bcd1060..2f67840b8e 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatConstants.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatConstants.java @@ -67,94 +67,94 @@ public final class OatConstants { // NOTE: we plan to only support RELEASE versions... // Upper case indicates supported version. - /** https://android.googlesource.com/platform/art/+/refs/heads/kitkat-release/runtime/oat.cc#24 */ - public final static String VERSION_KITKAT_RELEASE = "007"; - /** https://android.googlesource.com/platform/art/+/refs/heads/kitkat-dev/runtime/oat.cc#24 */ - public final static String version_kitkat_dev = "008"; - /** https://android.googlesource.com/platform/art/+/refs/heads/lollipop-release/runtime/oat.cc#25 */ - public final static String VERSION_LOLLIPOP_RELEASE = "039"; - /** https://android.googlesource.com/platform/art/+/refs/heads/lollipop-mr1-release/runtime/oat.cc#25 */ - public final static String VERSION_LOLLIPOP_MR1_FI_RELEASE = "045"; - /** https://android.googlesource.com/platform/art/+/refs/heads/lollipop-wear-release/runtime/oat.cc#27 */ - public final static String VERSION_LOLLIPOP_WEAR_RELEASE = "051"; - /** https://android.googlesource.com/platform/art/+/refs/heads/marshmallow-release/runtime/oat.h#34 */ - public final static String VERSION_MARSHMALLOW_RELEASE = "064"; - /** https://android.googlesource.com/platform/art/+/refs/heads/nougat-release/runtime/oat.h#34 */ - public final static String VERSION_NOUGAT_RELEASE = "079"; - /** https://android.googlesource.com/platform/art/+/refs/heads/n-iot-preview-2/runtime/oat.h#34 */ - public final static String version_n_iot_preview_2 = "083"; - /** https://android.googlesource.com/platform/art/+/refs/heads/nougat-mr1-release/runtime/oat.h#34 */ - public final static String VERSION_NOUGAT_MR1_RELEASE = "088"; - /** https://android.googlesource.com/platform/art/+/refs/heads/o-preview/runtime/oat.h#34 */ - public final static String version_o_preview = "114"; - /** https://android.googlesource.com/platform/art/+/refs/heads/oreo-release/runtime/oat.h#34 */ - public final static String VERSION_OREO_RELEASE = "124"; - /** https://android.googlesource.com/platform/art/+/refs/heads/n-iot-preview-4/runtime/oat.h#34 */ - public final static String version_n_iot_preview_4 = "125"; - /** https://android.googlesource.com/platform/art/+/refs/heads/oreo-dr3-release/runtime/oat.h#34 */ - public final static String VERSION_OREO_DR3_RELEASE = "126"; - /** https://android.googlesource.com/platform/art/+/refs/heads/oreo-m2-release/runtime/oat.h#34 */ - public final static String VERSION_OREO_M2_RELEASE = "131"; - /** https://android.googlesource.com/platform/art/+/refs/heads/o-iot-preview-5/runtime/oat.h#34 */ - public final static String version_o_iot_preview_5 = "132"; - /** https://android.googlesource.com/platform/art/+/refs/heads/o-mr1-iot-preview-6/runtime/oat.h#34 */ - public final static String version_o_mr1_iot_preview_6 = "135"; - /** https://android.googlesource.com/platform/art/+/refs/heads/pie-release/runtime/oat.h#34 */ - public final static String VERSION_PIE_RELEASE = "138"; - /** https://android.googlesource.com/platform/art/+/refs/heads/o-mr1-iot-preview-7/runtime/oat.h#34 */ - public final static String version_o_mr1_iot_preview_7 = "139"; - /** https://android.googlesource.com/platform/art/+/refs/heads/o-mr1-iot-preview-8/runtime/oat.h#34 */ - public final static String version_o_mr1_iot_preview_8 = "140"; - /** https://android.googlesource.com/platform/art/+/refs/tags/android-o-mr1-iot-release-1.0.0/runtime/oat.h#34 */ - public final static String version_o_mr1_iot_release_1_0_0 = "141"; - /** https://android.googlesource.com/platform/art/+/refs/tags/android-o-mr1-iot-release-1.0.1/runtime/oat.h#34 */ - public final static String version_o_mr1_iot_release_1_0_1 = "146"; - /** https://android.googlesource.com/platform/art/+/refs/tags/android-n-iot-release-polk-at1/runtime/oat.h#34 */ - public final static String version_n_iot_release_polk_at1 = "147"; - /** https://android.googlesource.com/platform/art/+/refs/tags/android-q-preview-1/runtime/oat.h#33 */ - public final static String version_q_preview_1 = "166"; - /** https://android.googlesource.com/platform/art/+/refs/heads/android10-release/runtime/oat.h#34 */ - public final static String VERSION_10_RELEASE = "170"; - /** https://android.googlesource.com/platform/art/+/refs/heads/android11-release/runtime/oat.h#34 */ - public final static String VERSION_11_RELEASE = "183"; - /** https://android.googlesource.com/platform/art/+/refs/heads/android12-release/runtime/oat.h#36 */ - public final static String VERSION_12_RELEASE = "195"; - /** https://android.googlesource.com/platform/art/+/refs/heads/android-s-beta-4/runtime/oat.h#36 */ - public final static String VERSION_S_BETA4 = "197"; - /** https://android.googlesource.com/platform/art/+/refs/heads/android-s-v2-preview-1/runtime/oat.h#36 */ - public final static String VERSION_S_V2_PREVIEW = "199"; - /** https://android.googlesource.com/platform/art/+/refs/heads/android-t-preview-1/runtime/oat.h#36 */ - public final static String VERSION_T_PREVIEW_1 = "220"; - /** https://android.googlesource.com/platform/art/+/refs/heads/android-s-v2-beta-3/runtime/oat.h#36 */ - public final static String VERSION_S_V2_BETA2 = "223"; - /** https://android.googlesource.com/platform/art/+/refs/heads/android13-release/runtime/oat.h#36 */ - public final static String VERSION_13_RELEASE = "225"; - /** https://android.googlesource.com/platform/art/+/master/runtime/oat.h#36 */ - public final static String VERSION_227 = "227"; + /** kitkat-release/runtime/oat.cc */ + public final static String OAT_VERSION_007 = "007"; + /** kitkat-dev/runtime/oat.cc */ + public final static String oat_version_008 = "008"; + /** lollipop-release/runtime/oat.cc */ + public final static String OAT_VERSION_039 = "039"; + /** lollipop-mr1-release/runtime/oat.cc */ + public final static String OAT_VERSION_045 = "045"; + /** lollipop-wear-release/runtime/oat.cc */ + public final static String OAT_VERSION_051 = "051"; + /** marshmallow-release/runtime/oat.h */ + public final static String OAT_VERSION_064 = "064"; + /** nougat-release/runtime/oat.h */ + public final static String OAT_VERSION_079 = "079"; + /** n-iot-preview-2/runtime/oat.h */ + public final static String oat_version_083 = "083"; + /** nougat-mr1-release/runtime/oat.h */ + public final static String OAT_VERSION_088 = "088"; + /** o-preview/runtime/oat.h */ + public final static String oat_version_114 = "114"; + /** oreo-release/runtime/oat.h */ + public final static String OAT_VERSION_124 = "124"; + /** n-iot-preview-4/runtime/oat.h */ + public final static String oat_version_125 = "125"; + /** oreo-dr3-release/runtime/oat.h */ + public final static String OAT_VERSION_126 = "126"; + /** oreo-m2-release/runtime/oat.h */ + public final static String OAT_VERSION_131 = "131"; + /** o-iot-preview-5/runtime/oat.h */ + public final static String oat_version_132 = "132"; + /** o-mr1-iot-preview-6/runtime/oat.h */ + public final static String oat_version_135 = "135"; + /** pie-release/runtime/oat.h */ + public final static String OAT_VERSION_138 = "138"; + /** o-mr1-iot-preview-7/runtime/oat.h */ + public final static String oat_version_139 = "139"; + /** o-mr1-iot-preview-8/runtime/oat.h */ + public final static String oat_version_140 = "140"; + /** android-o-mr1-iot-release-1.0.0/runtime/oat.h */ + public final static String oat_version_141 = "141"; + /** android-o-mr1-iot-release-1.0.1/runtime/oat.h */ + public final static String oat_version_146 = "146"; + /** android-n-iot-release-polk-at1/runtime/oat.h */ + public final static String oat_version_147 = "147"; + /** android-q-preview-1/runtime/oat.h */ + public final static String oat_version_166 = "166"; + /** android10-release/runtime/oat.h */ + public final static String OAT_VERSION_170 = "170"; + /** android11-release/runtime/oat.h */ + public final static String OAT_VERSION_183 = "183"; + /** android12-release/runtime/oat.h */ + public final static String OAT_VERSION_195 = "195"; + /** android-s-beta-4/runtime/oat.h */ + public final static String oat_version_197 = "197"; + /** android-s-v2-preview-1/runtime/oat.h */ + public final static String OAT_VERSION_199 = "199"; + /** android-t-preview-1/runtime/oat.h */ + public final static String OAT_VERSION_220 = "220"; + /** android-s-v2-beta-3/runtime/oat.h */ + public final static String OAT_VERSION_223 = "223"; + /** android13-release/runtime/oat.h */ + public final static String OAT_VERSION_225 = "225"; + /** master/runtime/oat.h */ + public final static String OAT_VERSION_227 = "227"; /** * This array contains versions that have been actively tested and verified. * All other versions will be considered unsupported until tested on exemplar firmware. */ public final static String [] SUPPORTED_VERSIONS = new String [] { - VERSION_KITKAT_RELEASE, - VERSION_LOLLIPOP_RELEASE, - VERSION_LOLLIPOP_MR1_FI_RELEASE, - VERSION_LOLLIPOP_WEAR_RELEASE, - VERSION_MARSHMALLOW_RELEASE, - VERSION_NOUGAT_RELEASE, - VERSION_NOUGAT_MR1_RELEASE, - VERSION_OREO_RELEASE, - VERSION_OREO_DR3_RELEASE, - VERSION_OREO_M2_RELEASE, - VERSION_PIE_RELEASE, - VERSION_10_RELEASE, - VERSION_11_RELEASE, - VERSION_12_RELEASE, - VERSION_S_V2_PREVIEW, - VERSION_T_PREVIEW_1, - VERSION_S_V2_BETA2, - VERSION_13_RELEASE, + OAT_VERSION_007, + OAT_VERSION_039, + OAT_VERSION_045, + OAT_VERSION_051, + OAT_VERSION_064, + OAT_VERSION_079, + OAT_VERSION_088, + OAT_VERSION_124, + OAT_VERSION_126, + OAT_VERSION_131, + OAT_VERSION_138, + OAT_VERSION_170, + OAT_VERSION_183, + OAT_VERSION_195, + OAT_VERSION_199, + OAT_VERSION_220, + OAT_VERSION_223, + OAT_VERSION_225, }; //@formatter:on diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader.java index d949df5bcb..8f4cc00d63 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader.java @@ -23,6 +23,8 @@ import ghidra.app.util.bin.StructConverter; import ghidra.file.formats.android.oat.bundle.OatBundle; import ghidra.file.formats.android.oat.oatdexfile.OatDexFile; import ghidra.file.formats.android.oat.oatdexfile.OatDexFileFactory; +import ghidra.program.model.data.*; +import ghidra.util.exception.DuplicateNameException; /** * Base OatHeader implementations @@ -142,4 +144,13 @@ public abstract class OatHeader implements StructConverter { */ abstract public int getChecksum(); + @Override + public DataType toDataType() throws DuplicateNameException, IOException { + Structure structure = + new StructureDataType(OatHeader.class.getSimpleName() + "_" + version, 0); + structure.add(STRING, 4, "magic_", null); + structure.add(STRING, 4, "version_", null); + structure.setCategoryPath(new CategoryPath("/oat")); + return structure; + } } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeaderAnalyzer.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeaderAnalyzer.java index 784e49e9f3..b042415134 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeaderAnalyzer.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeaderAnalyzer.java @@ -180,7 +180,7 @@ public class OatHeaderAnalyzer extends FileFormatAnalyzer { monitor.setMessage("Annotating OAT Patches..."); Memory memory = program.getMemory(); - if (oatHeader.getVersion().equals(OatConstants.VERSION_LOLLIPOP_MR1_FI_RELEASE)) { + if (oatHeader.getVersion().equals(OatConstants.OAT_VERSION_045)) { MemoryBlock oatBlock = memory.getBlock(OatConstants.DOT_OAT_PATCHES_SECTION_NAME); MemoryBlock destinationBlock = findOatPatchesDestinationBlock(program, oatBlock); if (oatBlock == null || destinationBlock == null) { @@ -207,16 +207,16 @@ public class OatHeaderAnalyzer extends FileFormatAnalyzer { } } } - else if (oatHeader.getVersion().equals(OatConstants.VERSION_MARSHMALLOW_RELEASE)) { + else if (oatHeader.getVersion().equals(OatConstants.OAT_VERSION_064)) { //TODO } - else if (oatHeader.getVersion().equals(OatConstants.VERSION_NOUGAT_MR1_RELEASE)) { + else if (oatHeader.getVersion().equals(OatConstants.OAT_VERSION_088)) { //TODO } - else if (oatHeader.getVersion().equals(OatConstants.VERSION_OREO_RELEASE)) { + else if (oatHeader.getVersion().equals(OatConstants.OAT_VERSION_124)) { //TODO } - else if (oatHeader.getVersion().equals(OatConstants.VERSION_OREO_M2_RELEASE)) { + else if (oatHeader.getVersion().equals(OatConstants.OAT_VERSION_131)) { //TODO } } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeaderFactory.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeaderFactory.java index af9c410dae..63ad5b90ce 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeaderFactory.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeaderFactory.java @@ -21,6 +21,7 @@ import ghidra.app.util.bin.BinaryReader; import ghidra.app.util.importer.MessageLog; import ghidra.file.formats.android.oat.bundle.OatBundle; import ghidra.file.formats.android.oat.bundle.OatBundleFactory; +import ghidra.file.formats.android.oat.headers.*; import ghidra.program.model.listing.Program; import ghidra.util.task.TaskMonitor; @@ -40,35 +41,42 @@ public final class OatHeaderFactory { if (magic.equals(OatConstants.MAGIC)) { if (OatConstants.isSupportedVersion(version)) { switch (version) { - case OatConstants.VERSION_KITKAT_RELEASE: - return new OatHeader_KitKat(reader); - case OatConstants.VERSION_LOLLIPOP_RELEASE: - case OatConstants.VERSION_LOLLIPOP_MR1_FI_RELEASE: - case OatConstants.VERSION_LOLLIPOP_WEAR_RELEASE: - return new OatHeader_Lollipop(reader); - case OatConstants.VERSION_MARSHMALLOW_RELEASE: - return new OatHeader_Marshmallow(reader); - case OatConstants.VERSION_NOUGAT_RELEASE: - case OatConstants.VERSION_NOUGAT_MR1_RELEASE: - return new OatHeader_Nougat(reader); - case OatConstants.VERSION_OREO_RELEASE: - case OatConstants.VERSION_OREO_DR3_RELEASE: - return new OatHeader_Oreo(reader);//v124 and v126 are same format - case OatConstants.VERSION_OREO_M2_RELEASE: - return new OatHeader_Oreo_M2(reader); - case OatConstants.VERSION_PIE_RELEASE: - return new OatHeader_Pie(reader); - case OatConstants.VERSION_10_RELEASE: - return new OatHeader_10(reader); - case OatConstants.VERSION_11_RELEASE: - return new OatHeader_11(reader); - case OatConstants.VERSION_12_RELEASE: - case OatConstants.VERSION_S_V2_PREVIEW: - case OatConstants.VERSION_T_PREVIEW_1: - case OatConstants.VERSION_S_V2_BETA2: - return new OatHeader_12(reader); - case OatConstants.VERSION_13_RELEASE: - return new OatHeader_13(reader); + case OatConstants.OAT_VERSION_007: + return new OatHeader_007(reader); + case OatConstants.OAT_VERSION_039: + return new OatHeader_039(reader); + case OatConstants.OAT_VERSION_045: + return new OatHeader_045(reader); + case OatConstants.OAT_VERSION_051: + return new OatHeader_051(reader); + case OatConstants.OAT_VERSION_064: + return new OatHeader_064(reader); + case OatConstants.OAT_VERSION_079: + return new OatHeader_079(reader); + case OatConstants.OAT_VERSION_088: + return new OatHeader_088(reader); + case OatConstants.OAT_VERSION_124: + return new OatHeader_124(reader); + case OatConstants.OAT_VERSION_126: + return new OatHeader_126(reader); + case OatConstants.OAT_VERSION_131: + return new OatHeader_131(reader); + case OatConstants.OAT_VERSION_138: + return new OatHeader_138(reader); + case OatConstants.OAT_VERSION_170: + return new OatHeader_170(reader); + case OatConstants.OAT_VERSION_183: + return new OatHeader_183(reader); + case OatConstants.OAT_VERSION_195: + return new OatHeader_195(reader); + case OatConstants.OAT_VERSION_199: + return new OatHeader_199(reader); + case OatConstants.OAT_VERSION_220: + return new OatHeader_220(reader); + case OatConstants.OAT_VERSION_223: + return new OatHeader_223(reader); + case OatConstants.OAT_VERSION_225: + return new OatHeader_225(reader); } } } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/bundle/FullOatBundle.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/bundle/FullOatBundle.java index b15601f7e4..083618ae86 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/bundle/FullOatBundle.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/bundle/FullOatBundle.java @@ -298,7 +298,7 @@ public class FullOatBundle implements OatBundle { BinaryReader reader = new BinaryReader(provider, isLittleEndian); switch (type) { case ART: { - ArtHeader artHeader = ArtFactory.newArtHeader(reader); + ArtHeader artHeader = ArtHeaderFactory.newArtHeader(reader); this.artHeader = artHeader; return true; } @@ -310,7 +310,7 @@ public class FullOatBundle implements OatBundle { return true; } case VDEX: { - VdexHeader vdexHeader = VdexFactory.getVdexHeader(reader); + VdexHeader vdexHeader = VdexHeaderFactory.getVdexHeader(reader); vdexHeader.parse(reader, monitor); this.vdexHeader = vdexHeader; return true; diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_KitKat.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_007.java similarity index 90% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_KitKat.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_007.java index 115b15a11a..8266a14b51 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_KitKat.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_007.java @@ -13,19 +13,24 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.oat; +package ghidra.file.formats.android.oat.headers; import java.io.IOException; import java.util.Collections; import java.util.List; import ghidra.app.util.bin.BinaryReader; +import ghidra.file.formats.android.oat.OatHeader; +import ghidra.file.formats.android.oat.OatInstructionSet; import ghidra.file.formats.android.oat.bundle.OatBundle; import ghidra.file.formats.android.oat.oatdexfile.OatDexFile; import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; -public class OatHeader_KitKat extends OatHeader { +/** + * kitkat-release/runtime/oat.cc + */ +public class OatHeader_007 extends OatHeader { protected int adler32_checksum_; protected int instruction_set_; @@ -41,7 +46,7 @@ public class OatHeader_KitKat extends OatHeader { protected int image_file_location_size_; protected byte[] image_file_location_data_; // note variable width data at end - OatHeader_KitKat(BinaryReader reader) throws IOException { + public OatHeader_007(BinaryReader reader) throws IOException { super(reader); adler32_checksum_ = reader.readNextInt(); instruction_set_ = reader.readNextInt(); @@ -134,9 +139,8 @@ public class OatHeader_KitKat extends OatHeader { @Override public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = new StructureDataType(OatHeader_KitKat.class.getSimpleName(), 0); - structure.add(STRING, 4, "magic_", null); - structure.add(STRING, 4, "version_", null); + Structure structure = (Structure) super.toDataType(); + structure.add(DWORD, "adler32_checksum_", null); structure.add(DWORD, OatInstructionSet.DISPLAY_NAME, null); structure.add(DWORD, "dex_file_count_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_Lollipop.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_039.java similarity index 91% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_Lollipop.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_039.java index ff93975c9a..c122163508 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_Lollipop.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_039.java @@ -13,20 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.oat; +package ghidra.file.formats.android.oat.headers; import java.io.IOException; -import java.util.*; +import java.util.List; import ghidra.app.util.bin.BinaryReader; +import ghidra.file.formats.android.oat.OatHeader; +import ghidra.file.formats.android.oat.OatInstructionSet; import ghidra.file.formats.android.oat.oatdexfile.OatDexFile; import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/marshmallow-release/runtime/oat.h + * lollipop-release/runtime/oat.cc */ -public class OatHeader_Lollipop extends OatHeader { +public class OatHeader_039 extends OatHeader { protected int adler32_checksum_; protected int instruction_set_; @@ -48,7 +50,7 @@ public class OatHeader_Lollipop extends OatHeader { protected int image_file_location_oat_data_begin_; protected int key_value_store_size_; - OatHeader_Lollipop(BinaryReader reader) throws IOException { + public OatHeader_039(BinaryReader reader) throws IOException { super(reader); adler32_checksum_ = reader.readNextInt(); instruction_set_ = reader.readNextInt(); @@ -109,9 +111,8 @@ public class OatHeader_Lollipop extends OatHeader { @Override public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = new StructureDataType(OatHeader_Lollipop.class.getSimpleName(), 0); - structure.add(STRING, 4, "magic_", null); - structure.add(STRING, 4, "version_", null); + Structure structure = (Structure) super.toDataType(); + structure.add(DWORD, "adler32_checksum_", null); structure.add(DWORD, OatInstructionSet.DISPLAY_NAME, null); structure.add(DWORD, "instruction_set_features_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_045.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_045.java new file mode 100644 index 0000000000..064233b91e --- /dev/null +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_045.java @@ -0,0 +1,29 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ghidra.file.formats.android.oat.headers; + +import java.io.IOException; + +import ghidra.app.util.bin.BinaryReader; + +/** + * lollipop-mr1-release/runtime/oat.cc + */ +public class OatHeader_045 extends OatHeader_039 { + public OatHeader_045(BinaryReader reader) throws IOException { + super(reader); + } +} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_051.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_051.java new file mode 100644 index 0000000000..1e21797549 --- /dev/null +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_051.java @@ -0,0 +1,29 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ghidra.file.formats.android.oat.headers; + +import java.io.IOException; + +import ghidra.app.util.bin.BinaryReader; + +/** + * lollipop-wear-release/runtime/oat.cc + */ +public class OatHeader_051 extends OatHeader_039 { + public OatHeader_051(BinaryReader reader) throws IOException { + super(reader); + } +} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_Marshmallow.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_064.java similarity index 90% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_Marshmallow.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_064.java index 9222e7aa56..ab52a32d87 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_Marshmallow.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_064.java @@ -13,20 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.oat; +package ghidra.file.formats.android.oat.headers; import java.io.IOException; -import java.util.*; +import java.util.Collections; +import java.util.List; import ghidra.app.util.bin.BinaryReader; +import ghidra.file.formats.android.oat.OatHeader; +import ghidra.file.formats.android.oat.OatInstructionSet; import ghidra.file.formats.android.oat.oatdexfile.OatDexFile; import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * + * marshmallow-release/runtime/oat.h */ -class OatHeader_Marshmallow extends OatHeader { +public class OatHeader_064 extends OatHeader { protected int adler32_checksum_; protected int instruction_set_; @@ -45,7 +48,7 @@ class OatHeader_Marshmallow extends OatHeader { protected int image_file_location_oat_data_begin_; protected int key_value_store_size_; - OatHeader_Marshmallow(BinaryReader reader) throws IOException { + public OatHeader_064(BinaryReader reader) throws IOException { super(reader); adler32_checksum_ = reader.readNextInt(); @@ -69,7 +72,7 @@ class OatHeader_Marshmallow extends OatHeader { @Override public int getOatDexFilesOffset(BinaryReader reader) { //the DEX offset is the current reader offset! - return (int)reader.getPointerIndex(); + return (int) reader.getPointerIndex(); } @Override @@ -132,9 +135,8 @@ class OatHeader_Marshmallow extends OatHeader { @Override public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = new StructureDataType(OatHeader_Marshmallow.class.getSimpleName(), 0); - structure.add(STRING, 4, "magic_", null); - structure.add(STRING, 4, "version_", null); + Structure structure = (Structure) super.toDataType(); + structure.add(DWORD, "adler32_checksum_", null); structure.add(DWORD, OatInstructionSet.DISPLAY_NAME, null); structure.add(DWORD, "instruction_set_features_bitmap_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_079.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_079.java new file mode 100644 index 0000000000..18a13a1513 --- /dev/null +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_079.java @@ -0,0 +1,29 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ghidra.file.formats.android.oat.headers; + +import java.io.IOException; + +import ghidra.app.util.bin.BinaryReader; + +/** + * nougat-release/runtime/oat.h + */ +public class OatHeader_079 extends OatHeader_064 { + public OatHeader_079(BinaryReader reader) throws IOException { + super(reader); + } +} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_088.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_088.java new file mode 100644 index 0000000000..2a40d03c81 --- /dev/null +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_088.java @@ -0,0 +1,29 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ghidra.file.formats.android.oat.headers; + +import java.io.IOException; + +import ghidra.app.util.bin.BinaryReader; + +/** + * nougat-mr1-release/runtime/oat.h + */ +public class OatHeader_088 extends OatHeader_064 { + public OatHeader_088(BinaryReader reader) throws IOException { + super(reader); + } +} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_124.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_124.java new file mode 100644 index 0000000000..f1b06825bb --- /dev/null +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_124.java @@ -0,0 +1,29 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ghidra.file.formats.android.oat.headers; + +import java.io.IOException; + +import ghidra.app.util.bin.BinaryReader; + +/** + * oreo-release/runtime/oat.h + */ +public class OatHeader_124 extends OatHeader_064 { + public OatHeader_124(BinaryReader reader) throws IOException { + super(reader); + } +} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_126.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_126.java new file mode 100644 index 0000000000..a5b9b67d9b --- /dev/null +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_126.java @@ -0,0 +1,29 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ghidra.file.formats.android.oat.headers; + +import java.io.IOException; + +import ghidra.app.util.bin.BinaryReader; + +/** + * oreo-dr3-release/runtime/oat.h + */ +public class OatHeader_126 extends OatHeader_064 { + public OatHeader_126(BinaryReader reader) throws IOException { + super(reader); + } +} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_Oreo_M2.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_131.java similarity index 91% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_Oreo_M2.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_131.java index a04c99ad15..3e44563c7d 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_Oreo_M2.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_131.java @@ -13,20 +13,23 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.oat; +package ghidra.file.formats.android.oat.headers; import java.io.IOException; -import java.util.*; +import java.util.Collections; +import java.util.List; import ghidra.app.util.bin.BinaryReader; +import ghidra.file.formats.android.oat.OatHeader; +import ghidra.file.formats.android.oat.OatInstructionSet; import ghidra.file.formats.android.oat.oatdexfile.OatDexFile; import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * + * oreo-m2-release/runtime/oat.h */ -class OatHeader_Oreo_M2 extends OatHeader { +public class OatHeader_131 extends OatHeader { protected int adler32_checksum_; protected int instruction_set_; @@ -46,7 +49,7 @@ class OatHeader_Oreo_M2 extends OatHeader { protected int image_file_location_oat_data_begin_; protected int key_value_store_size_; - OatHeader_Oreo_M2(BinaryReader reader) throws IOException { + public OatHeader_131(BinaryReader reader) throws IOException { super(reader); adler32_checksum_ = reader.readNextInt(); @@ -133,9 +136,8 @@ class OatHeader_Oreo_M2 extends OatHeader { @Override public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = new StructureDataType(OatHeader_Oreo_M2.class.getSimpleName(), 0); - structure.add(STRING, 4, "magic_", null); - structure.add(STRING, 4, "version_", null); + Structure structure = (Structure) super.toDataType(); + structure.add(DWORD, "adler32_checksum_", null); structure.add(DWORD, OatInstructionSet.DISPLAY_NAME, null); structure.add(DWORD, "instruction_set_features_bitmap_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_Pie.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_138.java similarity index 91% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_Pie.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_138.java index 4b5cdf1419..8764dc801e 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_Pie.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_138.java @@ -13,20 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.oat; +package ghidra.file.formats.android.oat.headers; import java.io.IOException; -import java.util.*; +import java.util.List; import ghidra.app.util.bin.BinaryReader; +import ghidra.file.formats.android.oat.OatHeader; +import ghidra.file.formats.android.oat.OatInstructionSet; import ghidra.file.formats.android.oat.oatdexfile.OatDexFile; import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/pie-release/runtime/oat.h + * pie-release/runtime/oat.h */ -class OatHeader_Pie extends OatHeader { +public class OatHeader_138 extends OatHeader { protected int adler32_checksum_; protected int instruction_set_; @@ -46,7 +48,7 @@ class OatHeader_Pie extends OatHeader { protected int image_file_location_oat_data_begin_; protected int key_value_store_size_; - OatHeader_Pie(BinaryReader reader) throws IOException { + public OatHeader_138(BinaryReader reader) throws IOException { super(reader); adler32_checksum_ = reader.readNextInt(); instruction_set_ = reader.readNextInt(); @@ -104,9 +106,8 @@ class OatHeader_Pie extends OatHeader { @Override public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = new StructureDataType(OatHeader_Pie.class.getSimpleName(), 0); - structure.add(STRING, 4, "magic_", null); - structure.add(STRING, 4, "version_", null); + Structure structure = (Structure) super.toDataType(); + structure.add(DWORD, "adler32_checksum_", null); structure.add(DWORD, OatInstructionSet.DISPLAY_NAME, null); structure.add(DWORD, "instruction_set_features_bitmap_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_10.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_170.java similarity index 88% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_10.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_170.java index c59512b885..30d0d05ac7 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_10.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_170.java @@ -13,17 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.oat; +package ghidra.file.formats.android.oat.headers; import java.io.IOException; -import java.util.*; +import java.util.List; import ghidra.app.util.bin.BinaryReader; +import ghidra.file.formats.android.oat.OatHeader; +import ghidra.file.formats.android.oat.OatInstructionSet; import ghidra.file.formats.android.oat.oatdexfile.OatDexFile; import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; -public class OatHeader_10 extends OatHeader { +/** + * android10-release/runtime/oat.h + */ +public class OatHeader_170 extends OatHeader { protected int oat_checksum_; protected int instruction_set_; protected int instruction_set_features_bitmap_; @@ -37,7 +42,7 @@ public class OatHeader_10 extends OatHeader { protected int quick_to_interpreter_bridge_offset_; protected int key_value_store_size_; - OatHeader_10(BinaryReader reader) throws IOException { + public OatHeader_170(BinaryReader reader) throws IOException { super(reader); oat_checksum_ = reader.readNextInt(); @@ -91,9 +96,8 @@ public class OatHeader_10 extends OatHeader { @Override public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = new StructureDataType(OatHeader_10.class.getSimpleName(), 0); - structure.add(STRING, 4, "magic_", null); - structure.add(STRING, 4, "version_", null); + Structure structure = (Structure) super.toDataType(); + structure.add(DWORD, "oat_checksum_", null); structure.add(DWORD, OatInstructionSet.DISPLAY_NAME, null); structure.add(DWORD, "instruction_set_features_bitmap_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_11.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_183.java similarity index 88% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_11.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_183.java index e00e1b30aa..dfb86d75be 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_11.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_183.java @@ -13,17 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.oat; +package ghidra.file.formats.android.oat.headers; import java.io.IOException; -import java.util.*; +import java.util.List; import ghidra.app.util.bin.BinaryReader; +import ghidra.file.formats.android.oat.OatHeader; +import ghidra.file.formats.android.oat.OatInstructionSet; import ghidra.file.formats.android.oat.oatdexfile.OatDexFile; import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; -public class OatHeader_11 extends OatHeader { +/** + * android11-release/runtime/oat.h + */ +public class OatHeader_183 extends OatHeader { protected int oat_checksum_; protected int instruction_set_; protected int instruction_set_features_bitmap_; @@ -38,7 +43,7 @@ public class OatHeader_11 extends OatHeader { protected int quick_to_interpreter_bridge_offset_; protected int key_value_store_size_; - OatHeader_11(BinaryReader reader) throws IOException { + public OatHeader_183(BinaryReader reader) throws IOException { super(reader); oat_checksum_ = reader.readNextInt(); @@ -93,9 +98,8 @@ public class OatHeader_11 extends OatHeader { @Override public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = new StructureDataType(OatHeader_11.class.getSimpleName(), 0); - structure.add(STRING, 4, "magic_", null); - structure.add(STRING, 4, "version_", null); + Structure structure = (Structure) super.toDataType(); + structure.add(DWORD, "oat_checksum_", null); structure.add(DWORD, OatInstructionSet.DISPLAY_NAME, null); structure.add(DWORD, "instruction_set_features_bitmap_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_12.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_195.java similarity index 86% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_12.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_195.java index 611e1f191e..73f1cbd01f 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_12.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_195.java @@ -13,24 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.oat; +package ghidra.file.formats.android.oat.headers; import java.io.IOException; -import java.util.*; +import java.util.List; import ghidra.app.util.bin.BinaryReader; +import ghidra.file.formats.android.oat.OatHeader; +import ghidra.file.formats.android.oat.OatInstructionSet; import ghidra.file.formats.android.oat.oatdexfile.OatDexFile; import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android-s-beta-5/runtime/oat.h#125 - * - * https://android.googlesource.com/platform/art/+/refs/heads/android12-release/runtime/oat.h#125 - * - * https://android.googlesource.com/platform/art/+/refs/heads/android-s-v2-preview-1/runtime/oat.h#125 + * android12-release/runtime/oat.h */ -public class OatHeader_12 extends OatHeader { +public class OatHeader_195 extends OatHeader { protected int oat_checksum_; protected int instruction_set_; protected int instruction_set_features_bitmap_; @@ -46,7 +44,7 @@ public class OatHeader_12 extends OatHeader { protected int nterp_trampoline_offset_; protected int key_value_store_size_; - OatHeader_12(BinaryReader reader) throws IOException { + public OatHeader_195(BinaryReader reader) throws IOException { super(reader); oat_checksum_ = reader.readNextInt(); @@ -102,9 +100,8 @@ public class OatHeader_12 extends OatHeader { @Override public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = new StructureDataType(OatHeader_12.class.getSimpleName(), 0); - structure.add(STRING, 4, "magic_", null); - structure.add(STRING, 4, "version_", null); + Structure structure = (Structure) super.toDataType(); + structure.add(DWORD, "oat_checksum_", null); structure.add(DWORD, OatInstructionSet.DISPLAY_NAME, null); structure.add(DWORD, "instruction_set_features_bitmap_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_199.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_199.java new file mode 100644 index 0000000000..96ef68ab1e --- /dev/null +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_199.java @@ -0,0 +1,29 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ghidra.file.formats.android.oat.headers; + +import java.io.IOException; + +import ghidra.app.util.bin.BinaryReader; + +/** + * android-s-v2-preview-1/runtime/oat.h + */ +public class OatHeader_199 extends OatHeader_195 { + public OatHeader_199(BinaryReader reader) throws IOException { + super(reader); + } +} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_220.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_220.java new file mode 100644 index 0000000000..988db5ad57 --- /dev/null +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_220.java @@ -0,0 +1,29 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ghidra.file.formats.android.oat.headers; + +import java.io.IOException; + +import ghidra.app.util.bin.BinaryReader; + +/** + * android-t-preview-1/runtime/oat.h + */ +public class OatHeader_220 extends OatHeader_195 { + public OatHeader_220(BinaryReader reader) throws IOException { + super(reader); + } +} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_223.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_223.java new file mode 100644 index 0000000000..b8172aae3b --- /dev/null +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_223.java @@ -0,0 +1,29 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ghidra.file.formats.android.oat.headers; + +import java.io.IOException; + +import ghidra.app.util.bin.BinaryReader; + +/** + * android-s-v2-beta-3/runtime/oat.h + */ +public class OatHeader_223 extends OatHeader_195 { + public OatHeader_223(BinaryReader reader) throws IOException { + super(reader); + } +} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_13.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_225.java similarity index 89% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_13.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_225.java index 1661ce2511..46b58015d4 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/OatHeader_13.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/headers/OatHeader_225.java @@ -13,20 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.oat; +package ghidra.file.formats.android.oat.headers; import java.io.IOException; -import java.util.*; +import java.util.List; import ghidra.app.util.bin.BinaryReader; +import ghidra.file.formats.android.oat.OatHeader; +import ghidra.file.formats.android.oat.OatInstructionSet; import ghidra.file.formats.android.oat.oatdexfile.OatDexFile; import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android13-release/runtime/oat.h#127 + * android13-release/runtime/oat.h */ -public class OatHeader_13 extends OatHeader { +public class OatHeader_225 extends OatHeader { protected int oat_checksum_; protected int instruction_set_; protected int instruction_set_features_bitmap_; @@ -43,7 +45,7 @@ public class OatHeader_13 extends OatHeader { protected int nterp_trampoline_offset_; protected int key_value_store_size_; - OatHeader_13(BinaryReader reader) throws IOException { + public OatHeader_225(BinaryReader reader) throws IOException { super(reader); oat_checksum_ = reader.readNextInt(); @@ -100,9 +102,8 @@ public class OatHeader_13 extends OatHeader { @Override public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = new StructureDataType(OatHeader_13.class.getSimpleName(), 0); - structure.add(STRING, 4, "magic_", null); - structure.add(STRING, 4, "version_", null); + Structure structure = (Structure) super.toDataType(); + structure.add(DWORD, "oat_checksum_", null); structure.add(DWORD, OatInstructionSet.DISPLAY_NAME, null); structure.add(DWORD, "instruction_set_features_bitmap_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass.java index 47e461bf04..81c91636fe 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass.java @@ -49,39 +49,39 @@ public abstract class OatClass implements StructConverter { status_ = reader.readNextShort(); switch (oatVersion) { - case OatConstants.VERSION_KITKAT_RELEASE: { + case OatConstants.OAT_VERSION_007: { statusEnum = OatClassStatusEnum_K.kStatusInitialized.get(status_); break; } - case OatConstants.VERSION_LOLLIPOP_RELEASE: - case OatConstants.VERSION_LOLLIPOP_MR1_FI_RELEASE: - case OatConstants.VERSION_LOLLIPOP_WEAR_RELEASE: - case OatConstants.VERSION_MARSHMALLOW_RELEASE: - case OatConstants.VERSION_NOUGAT_RELEASE: - case OatConstants.VERSION_NOUGAT_MR1_RELEASE: { + case OatConstants.OAT_VERSION_039: + case OatConstants.OAT_VERSION_045: + case OatConstants.OAT_VERSION_051: + case OatConstants.OAT_VERSION_064: + case OatConstants.OAT_VERSION_079: + case OatConstants.OAT_VERSION_088: { statusEnum = OatClassStatusEnum_L_M_N.kStatusMax.get(status_); break; } - case OatConstants.VERSION_OREO_RELEASE: { + case OatConstants.OAT_VERSION_124: { statusEnum = OatClassStatusEnum_O.kStatusMax.get(status_); break; } - case OatConstants.VERSION_OREO_M2_RELEASE: { + case OatConstants.OAT_VERSION_131: { statusEnum = OatClassStatusEnum_O_M2.kStatusMax.get(status_); break; } - case OatConstants.VERSION_PIE_RELEASE: - case OatConstants.VERSION_10_RELEASE: { - statusEnum = OatClassStatusEnum_P_10.kLast.get(status_); + case OatConstants.OAT_VERSION_138: + case OatConstants.OAT_VERSION_170: { + statusEnum = OatClassStatusEnum_P_Q.kLast.get(status_); break; } - case OatConstants.VERSION_11_RELEASE: - case OatConstants.VERSION_12_RELEASE: - case OatConstants.VERSION_S_V2_PREVIEW: - case OatConstants.VERSION_T_PREVIEW_1: - case OatConstants.VERSION_S_V2_BETA2: - case OatConstants.VERSION_13_RELEASE: { - statusEnum = OatClassStatusEnum_11_12.kLast.get(status_); + case OatConstants.OAT_VERSION_183: + case OatConstants.OAT_VERSION_195: + case OatConstants.OAT_VERSION_199: + case OatConstants.OAT_VERSION_220: + case OatConstants.OAT_VERSION_223: + case OatConstants.OAT_VERSION_225: { + statusEnum = OatClassStatusEnum_R_S_T.kLast.get(status_); break; } default: { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassFactory.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassFactory.java index 8bd41dccef..e82e9d6804 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassFactory.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassFactory.java @@ -28,33 +28,33 @@ public class OatClassFactory { String oatVersion) throws IOException, UnsupportedOatVersionException { switch (oatVersion) { - case OatConstants.VERSION_KITKAT_RELEASE: + case OatConstants.OAT_VERSION_007: return new OatClass_KitKat(reader, classDataItem, oatVersion); - case OatConstants.VERSION_LOLLIPOP_RELEASE: - case OatConstants.VERSION_LOLLIPOP_MR1_FI_RELEASE: - case OatConstants.VERSION_LOLLIPOP_WEAR_RELEASE: + case OatConstants.OAT_VERSION_039: + case OatConstants.OAT_VERSION_045: + case OatConstants.OAT_VERSION_051: return new OatClass_Lollipop(reader, classDataItem, oatVersion); - case OatConstants.VERSION_MARSHMALLOW_RELEASE: + case OatConstants.OAT_VERSION_064: return new OatClass_Marshmallow(reader, classDataItem, oatVersion); - case OatConstants.VERSION_NOUGAT_RELEASE: - case OatConstants.VERSION_NOUGAT_MR1_RELEASE: + case OatConstants.OAT_VERSION_079: + case OatConstants.OAT_VERSION_088: return new OatClass_Nougat(reader, classDataItem, oatVersion); - case OatConstants.VERSION_OREO_RELEASE: + case OatConstants.OAT_VERSION_124: return new OatClass_Oreo(reader, classDataItem, oatVersion); - case OatConstants.VERSION_OREO_M2_RELEASE: + case OatConstants.OAT_VERSION_131: return new OatClass_OreoM2(reader, classDataItem, oatVersion); - case OatConstants.VERSION_PIE_RELEASE: + case OatConstants.OAT_VERSION_138: return new OatClass_Pie(reader, classDataItem, oatVersion); - case OatConstants.VERSION_10_RELEASE: - return new OatClass_Android10(reader, classDataItem, oatVersion); - case OatConstants.VERSION_11_RELEASE: - return new OatClass_Android11(reader, classDataItem, oatVersion); - case OatConstants.VERSION_12_RELEASE: - case OatConstants.VERSION_S_V2_PREVIEW: - case OatConstants.VERSION_T_PREVIEW_1: - case OatConstants.VERSION_S_V2_BETA2: - case OatConstants.VERSION_13_RELEASE: - return new OatClass_Android12(reader, classDataItem, oatVersion); + case OatConstants.OAT_VERSION_170: + return new OatClass_Q(reader, classDataItem, oatVersion); + case OatConstants.OAT_VERSION_183: + return new OatClass_R(reader, classDataItem, oatVersion); + case OatConstants.OAT_VERSION_195: + case OatConstants.OAT_VERSION_199: + case OatConstants.OAT_VERSION_220: + case OatConstants.OAT_VERSION_223: + case OatConstants.OAT_VERSION_225: + return new OatClass_S_T(reader, classDataItem, oatVersion); default: throw new UnsupportedOatVersionException( "OatClass not supported for OAT Version: " + oatVersion); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_K.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_K.java index 110fa1c2c3..6fd74c9eaa 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_K.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_K.java @@ -21,7 +21,7 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/kitkat-release/runtime/mirror/class.h#112 + * kitkat-release/runtime/mirror/class.h * */ public enum OatClassStatusEnum_K implements OatClassStatusEnum { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_L_M_N.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_L_M_N.java index 9206a11d19..b276704b38 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_L_M_N.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_L_M_N.java @@ -21,15 +21,15 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/lollipop-release/runtime/mirror/class.h#133 - * - * https://android.googlesource.com/platform/art/+/refs/heads/lollipop-mr1-fi-release/runtime/mirror/class.h#138 - * - * https://android.googlesource.com/platform/art/+/refs/heads/lollipop-wear-release/runtime/mirror/class.h#119 - * - * https://android.googlesource.com/platform/art/+/marshmallow-release/runtime/mirror/class.h#112 - * - * https://android.googlesource.com/platform/art/+/nougat-release/runtime/mirror/class.h#116 + * lollipop-release/runtime/mirror/class.h + *
+ * lollipop-mr1-fi-release/runtime/mirror/class.h + *
+ * lollipop-wear-release/runtime/mirror/class.h + *
+ * marshmallow-release/runtime/mirror/class.h + *
+ * nougat-release/runtime/mirror/class.h */ public enum OatClassStatusEnum_L_M_N implements OatClassStatusEnum { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_O.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_O.java index 82695cf2ff..cbdeb00caa 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_O.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_O.java @@ -21,7 +21,7 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/oreo-release/runtime/mirror/class.h#128 + * oreo-release/runtime/mirror/class.h */ public enum OatClassStatusEnum_O implements OatClassStatusEnum { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_O_M2.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_O_M2.java index 714e1ffa86..a8416f972d 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_O_M2.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_O_M2.java @@ -21,7 +21,7 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/oreo-m2-release/runtime/mirror/class.h#128 + * oreo-m2-release/runtime/mirror/class.h */ public enum OatClassStatusEnum_O_M2 implements OatClassStatusEnum { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_P_10.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_P_Q.java similarity index 73% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_P_10.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_P_Q.java index 0f72b2a42d..10db8e1a0f 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_P_10.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_P_Q.java @@ -21,12 +21,11 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/pie-release/runtime/class_status.h#74 - * - * https://android.googlesource.com/platform/art/+/refs/heads/android10-release/runtime/class_status.h#74 - * + * pie-release/runtime/class_status.h + *
+ * android10-release/runtime/class_status.h */ -public enum OatClassStatusEnum_P_10 implements OatClassStatusEnum { +public enum OatClassStatusEnum_P_Q implements OatClassStatusEnum { kNotReady(0), kRetired(1), @@ -47,11 +46,11 @@ public enum OatClassStatusEnum_P_10 implements OatClassStatusEnum { private byte value; - private OatClassStatusEnum_P_10(byte value) { + private OatClassStatusEnum_P_Q(byte value) { this.value = value; } - private OatClassStatusEnum_P_10(int value) { + private OatClassStatusEnum_P_Q(int value) { this.value = (byte) value; } @@ -61,7 +60,7 @@ public enum OatClassStatusEnum_P_10 implements OatClassStatusEnum { @Override public OatClassStatusEnum get(short value) { - for (OatClassStatusEnum_P_10 valueX : values()) { + for (OatClassStatusEnum_P_Q valueX : values()) { if (valueX.getValue() == value) { return valueX; } @@ -71,8 +70,8 @@ public enum OatClassStatusEnum_P_10 implements OatClassStatusEnum { @Override public DataType toDataType() throws DuplicateNameException, IOException { - EnumDataType enumDataType = new EnumDataType(OatClassStatusEnum_P_10.class.getSimpleName(), 2); - for (OatClassStatusEnum_P_10 valueX : values()) { + EnumDataType enumDataType = new EnumDataType(OatClassStatusEnum_P_Q.class.getSimpleName(), 2); + for (OatClassStatusEnum_P_Q valueX : values()) { enumDataType.add(valueX.name(), valueX.getValue()); } enumDataType.setCategoryPath(new CategoryPath("/oat")); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_11_12.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_R_S_T.java similarity index 68% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_11_12.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_R_S_T.java index 7092367b3a..173b3e131c 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_11_12.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassStatusEnum_R_S_T.java @@ -21,11 +21,13 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android11-release/runtime/class_status.h#82 - * - * https://android.googlesource.com/platform/art/+/refs/heads/android12-release/runtime/class_status.h#82 + * android11-release/runtime/class_status.h + *
+ * android12-release/runtime/class_status.h + *
+ * android13-release/runtime/class_status.h */ -public enum OatClassStatusEnum_11_12 implements OatClassStatusEnum { +public enum OatClassStatusEnum_R_S_T implements OatClassStatusEnum { kNotReady(0), kRetired(1), @@ -47,11 +49,11 @@ public enum OatClassStatusEnum_11_12 implements OatClassStatusEnum { private byte value; - private OatClassStatusEnum_11_12(byte value) { + private OatClassStatusEnum_R_S_T(byte value) { this.value = value; } - private OatClassStatusEnum_11_12(int value) { + private OatClassStatusEnum_R_S_T(int value) { this.value = (byte) value; } @@ -61,7 +63,7 @@ public enum OatClassStatusEnum_11_12 implements OatClassStatusEnum { @Override public OatClassStatusEnum get(short value) { - for (OatClassStatusEnum_11_12 valueX : values()) { + for (OatClassStatusEnum_R_S_T valueX : values()) { if (valueX.getValue() == value) { return valueX; } @@ -71,8 +73,8 @@ public enum OatClassStatusEnum_11_12 implements OatClassStatusEnum { @Override public DataType toDataType() throws DuplicateNameException, IOException { - EnumDataType enumDataType = new EnumDataType(OatClassStatusEnum_11_12.class.getSimpleName(), 2); - for (OatClassStatusEnum_11_12 valueX : values()) { + EnumDataType enumDataType = new EnumDataType(OatClassStatusEnum_R_S_T.class.getSimpleName(), 2); + for (OatClassStatusEnum_R_S_T valueX : values()) { enumDataType.add(valueX.name(), valueX.getValue()); } enumDataType.setCategoryPath(new CategoryPath("/oat")); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassType.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassType.java index 7496a86dc1..522f2da914 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassType.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClassType.java @@ -25,9 +25,9 @@ import ghidra.program.model.data.*; * using a bitmap pays for itself since few classes will have 160 * methods. * - * https://android.googlesource.com/platform/art/+/lollipop-release/runtime/oat.h#152 - * - * https://android.googlesource.com/platform/art/+/refs/heads/android-s-beta-5/runtime/oat_file.h#66 + * lollipop-release/runtime/oat.h + *
+ * android-s-beta-5/runtime/oat_file.h */ public enum OatClassType { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_KitKat.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_KitKat.java index 118172bc6b..01fc0f1aad 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_KitKat.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_KitKat.java @@ -23,7 +23,7 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/kitkat-release/runtime/oat_file.h#156 + * kitkat-release/runtime/oat_file.h */ public class OatClass_KitKat extends OatClass { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Lollipop.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Lollipop.java index e1afe95ca7..9f5702c4c5 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Lollipop.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Lollipop.java @@ -24,11 +24,11 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/lollipop-release/runtime/oat_file.h#205 - * - * https://android.googlesource.com/platform/art/+/refs/heads/lollipop-mr1-fi-release/runtime/oat_file.h#202 - * - * https://android.googlesource.com/platform/art/+/refs/heads/lollipop-wear-release/runtime/oat_file.h#211 + * lollipop-release/runtime/oat_file.h + *
+ * lollipop-mr1-fi-release/runtime/oat_file.h + *
+ * lollipop-wear-release/runtime/oat_file.h */ public class OatClass_Lollipop extends OatClass { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Marshmallow.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Marshmallow.java index 22ef0b709f..bf6ba9a6e9 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Marshmallow.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Marshmallow.java @@ -23,7 +23,7 @@ import ghidra.program.model.data.DataType; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/marshmallow-release/runtime/oat_file.h#200 + * marshmallow-release/runtime/oat_file.h */ public class OatClass_Marshmallow extends OatClass_Lollipop { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Nougat.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Nougat.java index a385b9fecb..dae89ef89f 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Nougat.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Nougat.java @@ -23,7 +23,7 @@ import ghidra.program.model.data.DataType; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/nougat-release/runtime/oat_file.h#197 + * nougat-release/runtime/oat_file.h */ public class OatClass_Nougat extends OatClass_Marshmallow { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Oreo.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Oreo.java index 9550e63bfd..5c65741305 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Oreo.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Oreo.java @@ -23,7 +23,7 @@ import ghidra.program.model.data.DataType; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/oreo-release/runtime/oat_file.h#213 + * oreo-release/runtime/oat_file.h */ public class OatClass_Oreo extends OatClass_Nougat { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_OreoM2.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_OreoM2.java index 3bbea9b5a5..e820f99c6b 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_OreoM2.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_OreoM2.java @@ -23,7 +23,7 @@ import ghidra.program.model.data.DataType; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/oreo-m2-release/runtime/oat_file.h#219 + * oreo-m2-release/runtime/oat_file.h */ public class OatClass_OreoM2 extends OatClass_Oreo { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Pie.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Pie.java index a8ef49d652..379aeba6e5 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Pie.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Pie.java @@ -23,7 +23,7 @@ import ghidra.program.model.data.DataType; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/pie-release/runtime/oat_file.h#248 + * pie-release/runtime/oat_file.h */ public class OatClass_Pie extends OatClass_OreoM2 { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Android11.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Q.java similarity index 76% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Android11.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Q.java index befc53ba76..d43dcda7ba 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Android11.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Q.java @@ -23,11 +23,11 @@ import ghidra.program.model.data.DataType; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android11-release/runtime/oat_file.h#278 + * android10-release/runtime/oat_file.h */ -public class OatClass_Android11 extends OatClass_Android10 { +public class OatClass_Q extends OatClass_Pie { - OatClass_Android11(BinaryReader reader, ClassDataItem classDataItem, String oatVersion) + OatClass_Q(BinaryReader reader, ClassDataItem classDataItem, String oatVersion) throws IOException { super(reader, classDataItem, oatVersion); } @@ -36,7 +36,7 @@ public class OatClass_Android11 extends OatClass_Android10 { public DataType toDataType() throws DuplicateNameException, IOException { DataType dataType = super.toDataType(); try { - renameDataType(dataType, OatClass_Android11.class.getSimpleName()); + renameDataType(dataType, OatClass_Q.class.getSimpleName()); } catch (Exception e) { //ignore... diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Android10.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_R.java similarity index 77% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Android10.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_R.java index 6abc851102..9801c6be6b 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Android10.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_R.java @@ -23,11 +23,11 @@ import ghidra.program.model.data.DataType; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android10-release/runtime/oat_file.h#248 + * android11-release/runtime/oat_file.h */ -public class OatClass_Android10 extends OatClass_Pie { +public class OatClass_R extends OatClass_Q { - OatClass_Android10(BinaryReader reader, ClassDataItem classDataItem, String oatVersion) + OatClass_R(BinaryReader reader, ClassDataItem classDataItem, String oatVersion) throws IOException { super(reader, classDataItem, oatVersion); } @@ -36,7 +36,7 @@ public class OatClass_Android10 extends OatClass_Pie { public DataType toDataType() throws DuplicateNameException, IOException { DataType dataType = super.toDataType(); try { - renameDataType(dataType, OatClass_Android10.class.getSimpleName()); + renameDataType(dataType, OatClass_R.class.getSimpleName()); } catch (Exception e) { //ignore... diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Android12.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_S_T.java similarity index 88% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Android12.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_S_T.java index ce11ad562a..cfd989e76c 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_Android12.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatclass/OatClass_S_T.java @@ -25,9 +25,11 @@ import ghidra.util.NumericUtilities; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android-s-beta-5/runtime/oat_file.h#283 + * android12-release/runtime/oat_file.h + *
+ * android13-release/runtime/oat_file.h */ -public class OatClass_Android12 extends OatClass { +public class OatClass_S_T extends OatClass { //https://android.googlesource.com/platform/art/+/master/libartbase/base/bit_vector.h#38 public static final int kWordBytes = 4; @@ -36,7 +38,7 @@ public class OatClass_Android12 extends OatClass { private byte[] bitmap_ = new byte[0]; - OatClass_Android12(BinaryReader reader, ClassDataItem classDataItem, String oatVersion) + OatClass_S_T(BinaryReader reader, ClassDataItem classDataItem, String oatVersion) throws IOException { super(reader, oatVersion); @@ -106,7 +108,7 @@ public class OatClass_Android12 extends OatClass { @Override public DataType toDataType() throws DuplicateNameException, IOException { - String className = OatClass_Android12.class.getSimpleName(); + String className = OatClass_S_T.class.getSimpleName(); if (methods_pointer_.size() > 0) { className += "_" + methods_pointer_.size(); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFileFactory.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFileFactory.java index c15aaa1b59..5f457ea9ea 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFileFactory.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFileFactory.java @@ -27,34 +27,34 @@ public final class OatDexFileFactory { OatBundle bundle) throws IOException { switch (oatVersion) { - case OatConstants.VERSION_KITKAT_RELEASE: + case OatConstants.OAT_VERSION_007: return new OatDexFile_KitKat(reader); - case OatConstants.VERSION_LOLLIPOP_RELEASE: - case OatConstants.VERSION_LOLLIPOP_MR1_FI_RELEASE: - case OatConstants.VERSION_LOLLIPOP_WEAR_RELEASE: + case OatConstants.OAT_VERSION_039: + case OatConstants.OAT_VERSION_045: + case OatConstants.OAT_VERSION_051: return new OatDexFile_Lollipop(reader); - case OatConstants.VERSION_MARSHMALLOW_RELEASE: + case OatConstants.OAT_VERSION_064: return new OatDexFile_Marshmallow(reader); - case OatConstants.VERSION_NOUGAT_RELEASE: - case OatConstants.VERSION_NOUGAT_MR1_RELEASE: + case OatConstants.OAT_VERSION_079: + case OatConstants.OAT_VERSION_088: return new OatDexFile_Nougat(reader); - case OatConstants.VERSION_OREO_RELEASE: - case OatConstants.VERSION_OREO_DR3_RELEASE: + case OatConstants.OAT_VERSION_124: + case OatConstants.OAT_VERSION_126: return new OatDexFile_Oreo(reader, bundle); - case OatConstants.VERSION_OREO_M2_RELEASE: + case OatConstants.OAT_VERSION_131: return new OatDexFile_OreoM2(reader, bundle); - case OatConstants.VERSION_PIE_RELEASE: + case OatConstants.OAT_VERSION_138: return new OatDexFile_Pie(reader, bundle); - case OatConstants.VERSION_10_RELEASE: - return new OatDexFile_Android10(reader, bundle); - case OatConstants.VERSION_11_RELEASE: - return new OatDexFile_Android11(reader, bundle); - case OatConstants.VERSION_12_RELEASE: - case OatConstants.VERSION_S_V2_PREVIEW: - case OatConstants.VERSION_T_PREVIEW_1: - case OatConstants.VERSION_S_V2_BETA2: - case OatConstants.VERSION_13_RELEASE: - return new OatDexFile_Android12(reader, bundle); + case OatConstants.OAT_VERSION_170: + return new OatDexFile_Q(reader, bundle); + case OatConstants.OAT_VERSION_183: + return new OatDexFile_R(reader, bundle); + case OatConstants.OAT_VERSION_195: + case OatConstants.OAT_VERSION_199: + case OatConstants.OAT_VERSION_220: + case OatConstants.OAT_VERSION_223: + case OatConstants.OAT_VERSION_225: + return new OatDexFile_S_T(reader, bundle); } throw new IOException("Unsupported OAT version: " + oatVersion); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_KitKat.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_KitKat.java index 48972ec832..ca0d9ce149 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_KitKat.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_KitKat.java @@ -40,8 +40,7 @@ import ghidra.util.exception.DuplicateNameException; import ghidra.util.task.TaskMonitor; /** - * - * https://android.googlesource.com/platform/art/+/refs/heads/kitkat-release/runtime/oat_file.h#191 + * kitkat-release/runtime/oat_file.h */ class OatDexFile_KitKat extends OatDexFile { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Lollipop.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Lollipop.java index b375cd3bb1..dcf9d09fbc 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Lollipop.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Lollipop.java @@ -23,8 +23,8 @@ import ghidra.util.exception.DuplicateNameException; /** * Note: actual data structure seen in firmware does not contain the "canonical_dex_file_location_" field. - * - * https://android.googlesource.com/platform/art/+/refs/heads/lollipop-release/runtime/oat_file.h#261 + *
+ * lollipop-release/runtime/oat_file.h */ class OatDexFile_Lollipop extends OatDexFile_KitKat { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Marshmallow.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Marshmallow.java index 9054928d2d..4e8c7a515e 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Marshmallow.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Marshmallow.java @@ -23,8 +23,8 @@ import ghidra.util.exception.DuplicateNameException; /** * Note: actual data structure seen in firmware does not contain the "canonical_dex_file_location_" field. - * - * https://android.googlesource.com/platform/art/+/refs/heads/marshmallow-release/runtime/oat_file.h#405 + *
+ * marshmallow-release/runtime/oat_file.h */ class OatDexFile_Marshmallow extends OatDexFile_Lollipop { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Nougat.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Nougat.java index a4599d06fa..ab1ea8eded 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Nougat.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Nougat.java @@ -33,10 +33,10 @@ import ghidra.util.task.TaskMonitor; /** * Used for OAT Header version 079 to 088. - * + *
* Versions: Nougat, Nougat MR1 - * - * https://android.googlesource.com/platform/art/+/nougat-release/runtime/oat_file.h#383 + *
+ * nougat-release/runtime/oat_file.h */ class OatDexFile_Nougat extends OatDexFile { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Oreo.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Oreo.java index 8b188f3bd4..af66f82163 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Oreo.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Oreo.java @@ -23,8 +23,7 @@ import ghidra.program.model.data.DataType; import ghidra.util.exception.DuplicateNameException; /** - * - * https://android.googlesource.com/platform/art/+/refs/heads/oreo-release/runtime/oat_file.h#444 + * oreo-release/runtime/oat_file.h */ class OatDexFile_Oreo extends OatDexFile_Nougat { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_OreoM2.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_OreoM2.java index 2bc639da03..e2b5ed0b4c 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_OreoM2.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_OreoM2.java @@ -33,8 +33,7 @@ import ghidra.util.exception.DuplicateNameException; import ghidra.util.task.TaskMonitor; /** - * - * https://android.googlesource.com/platform/art/+/oreo-m2-release/runtime/oat_file.h#467 + * oreo-m2-release/runtime/oat_file.h */ class OatDexFile_OreoM2 extends OatDexFile { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Pie.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Pie.java index fa65085bde..1cef7c12f8 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Pie.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Pie.java @@ -35,8 +35,7 @@ import ghidra.util.exception.DuplicateNameException; import ghidra.util.task.TaskMonitor; /** - * - * https://android.googlesource.com/platform/art/+/pie-release/runtime/oat_file.h#518 + * pie-release/runtime/oat_file.h */ class OatDexFile_Pie extends OatDexFile { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Android10.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Q.java similarity index 77% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Android10.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Q.java index 205c03f53b..4480f7dba5 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Android10.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Q.java @@ -23,12 +23,11 @@ import ghidra.program.model.data.DataType; import ghidra.util.exception.DuplicateNameException; /** - * - * https://android.googlesource.com/platform/art/+/android10-release/runtime/oat_file.h#569 + * android10-release/runtime/oat_file.h */ -public class OatDexFile_Android10 extends OatDexFile_Pie { +public class OatDexFile_Q extends OatDexFile_Pie { - public OatDexFile_Android10(BinaryReader reader, OatBundle bundle) throws IOException { + public OatDexFile_Q(BinaryReader reader, OatBundle bundle) throws IOException { super(reader, bundle); } @@ -36,7 +35,7 @@ public class OatDexFile_Android10 extends OatDexFile_Pie { public DataType toDataType() throws DuplicateNameException, IOException { DataType dataType = super.toDataType(); try { - dataType.setName(OatDexFile_Android10.class.getSimpleName()+ "_" + + dataType.setName(OatDexFile_Q.class.getSimpleName()+ "_" + getDexFileLocation().length()); } catch (Exception e) { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Android11.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_R.java similarity index 77% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Android11.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_R.java index 174f3938ff..78a0f61991 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Android11.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_R.java @@ -23,12 +23,11 @@ import ghidra.program.model.data.DataType; import ghidra.util.exception.DuplicateNameException; /** - * - * https://android.googlesource.com/platform/art/+/android11-release/runtime/oat_file.h#571 + * android11-release/runtime/oat_file.h */ -public class OatDexFile_Android11 extends OatDexFile_Pie { +public class OatDexFile_R extends OatDexFile_Pie { - public OatDexFile_Android11(BinaryReader reader, OatBundle bundle) throws IOException { + public OatDexFile_R(BinaryReader reader, OatBundle bundle) throws IOException { super(reader, bundle); } @@ -36,7 +35,7 @@ public class OatDexFile_Android11 extends OatDexFile_Pie { public DataType toDataType() throws DuplicateNameException, IOException { DataType dataType = super.toDataType(); try { - dataType.setName(OatDexFile_Android11.class.getSimpleName() + "_" + + dataType.setName(OatDexFile_R.class.getSimpleName() + "_" + getDexFileLocation().length()); } catch (Exception e) { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Android12.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_S_T.java similarity index 93% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Android12.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_S_T.java index a59cbc7024..891631f945 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_Android12.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatdexfile/OatDexFile_S_T.java @@ -34,9 +34,11 @@ import ghidra.util.exception.DuplicateNameException; import ghidra.util.task.TaskMonitor; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android-s-beta-5/runtime/oat_file.h#596 + * android12-release/runtime/oat_file.h + *
+ * android13-release/runtime/oat_file.h */ -public class OatDexFile_Android12 extends OatDexFile { +public class OatDexFile_S_T extends OatDexFile { private int dex_file_location_; private String canonical_dex_file_location_; @@ -57,7 +59,7 @@ public class OatDexFile_Android12 extends OatDexFile { private long _offset; private DexHeader dexHeader; - public OatDexFile_Android12(BinaryReader reader, OatBundle bundle) + public OatDexFile_S_T(BinaryReader reader, OatBundle bundle) throws IOException { _offset = reader.getPointerIndex(); @@ -167,7 +169,7 @@ public class OatDexFile_Android12 extends OatDexFile { @Override public DataType toDataType() throws DuplicateNameException, IOException { Structure structure = new StructureDataType( - OatDexFile_Android12.class.getSimpleName() + "_" + dex_file_location_, 0); + OatDexFile_S_T.class.getSimpleName() + "_" + dex_file_location_, 0); structure.add(DWORD, "dex_file_location_", null); structure.add(STRING, dex_file_location_, "canonical_dex_file_location_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatmethod/OatMethodOffsets.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatmethod/OatMethodOffsets.java index 171eeda5f1..47ffb68506 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatmethod/OatMethodOffsets.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatmethod/OatMethodOffsets.java @@ -23,19 +23,32 @@ import ghidra.program.model.data.DataType; import ghidra.util.exception.DuplicateNameException; /** - * - * https://android.googlesource.com/platform/art/+/refs/heads/lollipop-mr1-release/runtime/oat.h#163 - * https://android.googlesource.com/platform/art/+/refs/heads/lollipop-wear-release/runtime/oat.h#165 - * https://android.googlesource.com/platform/art/+/refs/heads/marshmallow-release/runtime/oat.h#162 - * https://android.googlesource.com/platform/art/+/refs/heads/nougat-release/runtime/oat.h#172 - * https://android.googlesource.com/platform/art/+/refs/heads/nougat-mr1-release/runtime/oat.h#172 - * https://android.googlesource.com/platform/art/+/refs/heads/oreo-release/runtime/oat.h#172 - * https://android.googlesource.com/platform/art/+/refs/heads/oreo-dr3-release/runtime/oat.h#172 - * https://android.googlesource.com/platform/art/+/refs/heads/oreo-m2-release/runtime/oat.h#176 - * https://android.googlesource.com/platform/art/+/refs/heads/pie-release/runtime/oat.h#177 - * https://android.googlesource.com/platform/art/+/refs/heads/android10-release/runtime/oat.h#150 - * https://android.googlesource.com/platform/art/+/refs/heads/android11-release/runtime/oat_file.h#75 - * https://android.googlesource.com/platform/art/+/refs/heads/android-s-beta-5/runtime/oat_file.h#75 + * lollipop-mr1-release/runtime/oat.h + *
+ * ollipop-wear-release/runtime/oat.h + *
+ * marshmallow-release/runtime/oat.h + *
+ * nougat-release/runtime/oat.h + *
+ * nougat-mr1-release/runtime/oat.h + *
+ * oreo-release/runtime/oat.h + *
+ * oreo-dr3-release/runtime/oat.h + *
+ * oreo-m2-release/runtime/oat.h + *
+ * pie-release/runtime/oat.h + *
+ * android10-release/runtime/oat.h + *
+ * android11-release/runtime/oat_file.h + *
+ * android12-release/runtime/oat_file.h + *
+ * android13-release/runtime/oat_file.h + *
*/ public class OatMethodOffsets implements StructConverter { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatmethod/OatMethodOffsetsFactory.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatmethod/OatMethodOffsetsFactory.java index fe7aea071e..0fbc5906b3 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatmethod/OatMethodOffsetsFactory.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatmethod/OatMethodOffsetsFactory.java @@ -26,9 +26,9 @@ public final class OatMethodOffsetsFactory { throws IOException { switch (oatVersion) { - case OatConstants.VERSION_KITKAT_RELEASE: + case OatConstants.OAT_VERSION_007: return new OatMethodOffsets_KitKat(reader); - case OatConstants.VERSION_LOLLIPOP_RELEASE: + case OatConstants.OAT_VERSION_039: return new OatMethodOffsets_Lollipop(reader); default: return new OatMethodOffsets(reader); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatmethod/OatMethodOffsets_KitKat.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatmethod/OatMethodOffsets_KitKat.java index 934f961d38..b195405c4b 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatmethod/OatMethodOffsets_KitKat.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatmethod/OatMethodOffsets_KitKat.java @@ -22,9 +22,7 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * - * https://android.googlesource.com/platform/art/+/refs/heads/kitkat-release/runtime/oat.h#107 - * + * kitkat-release/runtime/oat.h */ public class OatMethodOffsets_KitKat extends OatMethodOffsets { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatmethod/OatMethodOffsets_Lollipop.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatmethod/OatMethodOffsets_Lollipop.java index 9c5f98eb78..0d807e5ee3 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatmethod/OatMethodOffsets_Lollipop.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/oatmethod/OatMethodOffsets_Lollipop.java @@ -22,9 +22,7 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * - * https://android.googlesource.com/platform/art/+/lollipop-release/runtime/oat.h#161 - * + * lollipop-release/runtime/oat.h */ public class OatMethodOffsets_Lollipop extends OatMethodOffsets { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeaderFactory.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeaderFactory.java index ea64e9a09f..38f464392a 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeaderFactory.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeaderFactory.java @@ -24,28 +24,28 @@ public final class OatQuickMethodHeaderFactory { public final static int getOatQuickMethodHeaderSize(String oatVersion) throws IOException { switch (oatVersion) { - case OatConstants.VERSION_LOLLIPOP_RELEASE: + case OatConstants.OAT_VERSION_039: return 12 + QuickMethodFrameInfo.SIZE; - case OatConstants.VERSION_LOLLIPOP_MR1_FI_RELEASE: - case OatConstants.VERSION_LOLLIPOP_WEAR_RELEASE: - case OatConstants.VERSION_MARSHMALLOW_RELEASE: + case OatConstants.OAT_VERSION_045: + case OatConstants.OAT_VERSION_051: + case OatConstants.OAT_VERSION_064: return 16 + QuickMethodFrameInfo.SIZE; - case OatConstants.VERSION_NOUGAT_RELEASE: - case OatConstants.VERSION_NOUGAT_MR1_RELEASE: + case OatConstants.OAT_VERSION_079: + case OatConstants.OAT_VERSION_088: return 8 + QuickMethodFrameInfo.SIZE; - case OatConstants.VERSION_OREO_RELEASE: - case OatConstants.VERSION_OREO_M2_RELEASE: - case OatConstants.VERSION_OREO_DR3_RELEASE: - case OatConstants.VERSION_PIE_RELEASE: + case OatConstants.OAT_VERSION_124: + case OatConstants.OAT_VERSION_131: + case OatConstants.OAT_VERSION_126: + case OatConstants.OAT_VERSION_138: return 12 + QuickMethodFrameInfo.SIZE; - case OatConstants.VERSION_10_RELEASE: - case OatConstants.VERSION_11_RELEASE: + case OatConstants.OAT_VERSION_170: + case OatConstants.OAT_VERSION_183: return 8; - case OatConstants.VERSION_12_RELEASE: - case OatConstants.VERSION_S_V2_PREVIEW: - case OatConstants.VERSION_T_PREVIEW_1: - case OatConstants.VERSION_S_V2_BETA2: - case OatConstants.VERSION_13_RELEASE: + case OatConstants.OAT_VERSION_195: + case OatConstants.OAT_VERSION_199: + case OatConstants.OAT_VERSION_220: + case OatConstants.OAT_VERSION_223: + case OatConstants.OAT_VERSION_225: return 4; } throw new IOException("OatQuickMethodHeader unsupported OAT version: " + oatVersion); @@ -54,29 +54,29 @@ public final class OatQuickMethodHeaderFactory { public final static OatQuickMethodHeader getOatQuickMethodHeader(BinaryReader reader, String oatVersion) throws IOException { switch (oatVersion ) { - case OatConstants.VERSION_LOLLIPOP_RELEASE: + case OatConstants.OAT_VERSION_039: return new OatQuickMethodHeader_Lollipop(reader); - case OatConstants.VERSION_LOLLIPOP_MR1_FI_RELEASE: - case OatConstants.VERSION_LOLLIPOP_WEAR_RELEASE: - case OatConstants.VERSION_MARSHMALLOW_RELEASE: + case OatConstants.OAT_VERSION_045: + case OatConstants.OAT_VERSION_051: + case OatConstants.OAT_VERSION_064: return new OatQuickMethodHeader_LollipopMR1(reader); - case OatConstants.VERSION_NOUGAT_RELEASE: - case OatConstants.VERSION_NOUGAT_MR1_RELEASE: + case OatConstants.OAT_VERSION_079: + case OatConstants.OAT_VERSION_088: return new OatQuickMethodHeader_Nougat(reader); - case OatConstants.VERSION_OREO_RELEASE: - case OatConstants.VERSION_OREO_M2_RELEASE: - case OatConstants.VERSION_OREO_DR3_RELEASE: - case OatConstants.VERSION_PIE_RELEASE: + case OatConstants.OAT_VERSION_124: + case OatConstants.OAT_VERSION_131: + case OatConstants.OAT_VERSION_126: + case OatConstants.OAT_VERSION_138: return new OatQuickMethodHeader_Oreo(reader); - case OatConstants.VERSION_10_RELEASE: - case OatConstants.VERSION_11_RELEASE: - return new OatQuickMethodHeader_Android10(reader); - case OatConstants.VERSION_12_RELEASE: - case OatConstants.VERSION_S_V2_PREVIEW: - case OatConstants.VERSION_T_PREVIEW_1: - case OatConstants.VERSION_S_V2_BETA2: - case OatConstants.VERSION_13_RELEASE: - return new OatQuickMethodHeader_Android12(reader); + case OatConstants.OAT_VERSION_170: + case OatConstants.OAT_VERSION_183: + return new OatQuickMethodHeader_Q_R(reader); + case OatConstants.OAT_VERSION_195: + case OatConstants.OAT_VERSION_199: + case OatConstants.OAT_VERSION_220: + case OatConstants.OAT_VERSION_223: + case OatConstants.OAT_VERSION_225: + return new OatQuickMethodHeader_S_T(reader); } throw new IOException("OatQuickMethodHeader unsupported OAT version: " + oatVersion); } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Lollipop.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Lollipop.java index 132787d2e5..c803618280 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Lollipop.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Lollipop.java @@ -22,7 +22,7 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/lollipop-release/runtime/oat.h#185 + * lollipop-release/runtime/oat.h */ public class OatQuickMethodHeader_Lollipop extends OatQuickMethodHeader { private int mapping_table_offset_; diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_LollipopMR1.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_LollipopMR1.java index d2c45285b7..93e276a5cf 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_LollipopMR1.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_LollipopMR1.java @@ -22,9 +22,11 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/lollipop-mr1-fi-release/runtime/oat.h#182 - * https://android.googlesource.com/platform/art/+/refs/heads/lollipop-wear-release/runtime/oat.h#184 - * https://android.googlesource.com/platform/art/+/marshmallow-release/runtime/oat.h#185 + * lollipop-mr1-fi-release/runtime/oat.h + *
+ * lollipop-wear-release/runtime/oat.h + *
+ * marshmallow-release/runtime/oat.h */ public class OatQuickMethodHeader_LollipopMR1 extends OatQuickMethodHeader { private int mapping_table_offset_; diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Nougat.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Nougat.java index 7b84160286..9a692f9841 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Nougat.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Nougat.java @@ -22,8 +22,9 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/nougat-release/runtime/oat_quick_method_header.h#128 - * https://android.googlesource.com/platform/art/+/nougat-mr1-release/runtime/oat_quick_method_header.h#128 + * nougat-release/runtime/oat_quick_method_header.h + *
+ * nougat-mr1-release/runtime/oat_quick_method_header.h */ public class OatQuickMethodHeader_Nougat extends OatQuickMethodHeader { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Oreo.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Oreo.java index 5446f86bd0..2a827e60ce 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Oreo.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Oreo.java @@ -22,10 +22,13 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/oreo-release/runtime/oat_quick_method_header.h#190 - * https://android.googlesource.com/platform/art/+/refs/heads/oreo-dr3-release/runtime/oat_quick_method_header.h#191 - * https://android.googlesource.com/platform/art/+/refs/heads/oreo-m2-release/runtime/oat_quick_method_header.h#191 - * https://android.googlesource.com/platform/art/+/refs/heads/pie-release/runtime/oat_quick_method_header.h#191 + * oreo-release/runtime/oat_quick_method_header.h + *
+ * oreo-dr3-release/runtime/oat_quick_method_header.h + *
+ * oreo-m2-release/runtime/oat_quick_method_header.h + *
+ * pie-release/runtime/oat_quick_method_header.h */ public class OatQuickMethodHeader_Oreo extends OatQuickMethodHeader { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Android10.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Q_R.java similarity index 76% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Android10.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Q_R.java index ed51aae418..3b41837bab 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Android10.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Q_R.java @@ -22,15 +22,16 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android10-release/runtime/oat_quick_method_header.h#158 - * https://android.googlesource.com/platform/art/+/refs/heads/android11-release/runtime/oat_quick_method_header.h#175 + * android10-release/runtime/oat_quick_method_header.h + *
+ * android11-release/runtime/oat_quick_method_header.h */ -public class OatQuickMethodHeader_Android10 extends OatQuickMethodHeader { +public class OatQuickMethodHeader_Q_R extends OatQuickMethodHeader { private int vmap_table_offset_; private int code_size_; private byte[] code_; - OatQuickMethodHeader_Android10(BinaryReader reader) throws IOException { + OatQuickMethodHeader_Q_R(BinaryReader reader) throws IOException { vmap_table_offset_ = reader.readNextInt(); code_size_ = reader.readNextInt(); code_ = reader.readNextByteArray(code_size_); @@ -62,7 +63,7 @@ public class OatQuickMethodHeader_Android10 extends OatQuickMethodHeader { @Override public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = new StructureDataType(OatQuickMethodHeader_Android10.class.getSimpleName(), 0); + Structure structure = new StructureDataType(OatQuickMethodHeader_Q_R.class.getSimpleName(), 0); structure.add(DWORD, "vmap_table_offset_", null); structure.add(DWORD, "code_size_", null); structure.setCategoryPath(new CategoryPath("/oat")); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Android12.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_S_T.java similarity index 71% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Android12.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_S_T.java index 385e02740f..2910468c9d 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_Android12.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/OatQuickMethodHeader_S_T.java @@ -22,10 +22,11 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android12-release/runtime/oat_quick_method_header.h#160 - * + * android12-release/runtime/oat_quick_method_header.h>/a> + *
+ *
android13-release/runtime/oat_quick_method_header.h */ -public class OatQuickMethodHeader_Android12 extends OatQuickMethodHeader { +public class OatQuickMethodHeader_S_T extends OatQuickMethodHeader { public static final int kShouldDeoptimizeMask = 0x80000000; public static final int kIsCodeInfoMask = 0x40000000; @@ -34,7 +35,7 @@ public class OatQuickMethodHeader_Android12 extends OatQuickMethodHeader { private int data_; - OatQuickMethodHeader_Android12(BinaryReader reader) throws IOException { + OatQuickMethodHeader_S_T(BinaryReader reader) throws IOException { data_ = reader.readNextInt(); } @@ -45,7 +46,7 @@ public class OatQuickMethodHeader_Android12 extends OatQuickMethodHeader { @Override public DataType toDataType() throws DuplicateNameException, IOException { Structure structure = - new StructureDataType(OatQuickMethodHeader_Android12.class.getSimpleName(), 0); + new StructureDataType(OatQuickMethodHeader_S_T.class.getSimpleName(), 0); structure.add(DWORD, "data_", null); structure.setCategoryPath(new CategoryPath("/oat")); return structure; diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/QuickMethodFrameInfo.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/QuickMethodFrameInfo.java index 6eba837bc8..b9e5aae85e 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/QuickMethodFrameInfo.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/quickmethod/QuickMethodFrameInfo.java @@ -23,18 +23,29 @@ import ghidra.program.model.data.DataType; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/lollipop-release/runtime/quick/quick_method_frame_info.h#53 - * https://android.googlesource.com/platform/art/+/refs/heads/lollipop-mr1-fi-release/runtime/quick/quick_method_frame_info.h#54 - * https://android.googlesource.com/platform/art/+/refs/heads/lollipop-wear-release/runtime/quick/quick_method_frame_info.h#54 - * https://android.googlesource.com/platform/art/+/marshmallow-release/runtime/quick/quick_method_frame_info.h#54 - * https://android.googlesource.com/platform/art/+/refs/heads/nougat-release/runtime/quick/quick_method_frame_info.h#57 - * https://android.googlesource.com/platform/art/+/nougat-mr1-release/runtime/quick/quick_method_frame_info.h#57 - * https://android.googlesource.com/platform/art/+/refs/heads/oreo-release/runtime/quick/quick_method_frame_info.h#57 - * https://android.googlesource.com/platform/art/+/refs/heads/oreo-dr3-release/runtime/quick/quick_method_frame_info.h#57 - * https://android.googlesource.com/platform/art/+/refs/heads/oreo-m2-release/runtime/quick/quick_method_frame_info.h#57 - * https://android.googlesource.com/platform/art/+/refs/heads/pie-release/runtime/quick/quick_method_frame_info.h#57 - * https://android.googlesource.com/platform/art/+/refs/heads/android10-release/runtime/quick/quick_method_frame_info.h#57 - * https://android.googlesource.com/platform/art/+/refs/heads/android11-release/runtime/quick/quick_method_frame_info.h#57 + * lollipop-release/runtime/quick/quick_method_frame_info.h + *
+ * lollipop-mr1-fi-release/runtime/quick/quick_method_frame_info.h + *
+ * lollipop-wear-release/runtime/quick/quick_method_frame_info.h + *
+ * marshmallow-release/runtime/quick/quick_method_frame_info.h + *
+ * nougat-release/runtime/quick/quick_method_frame_info.h + *
+ * nougat-mr1-release/runtime/quick/quick_method_frame_info.h + *
+ * oreo-release/runtime/quick/quick_method_frame_info.h + *
+ * oreo-dr3-release/runtime/quick/quick_method_frame_info.h + *
+ * oreo-m2-release/runtime/quick/quick_method_frame_info.h + *
+ * pie-release/runtime/quick/quick_method_frame_info.h + *
+ * android10-release/runtime/quick/quick_method_frame_info.h + *
+ * android11-release/runtime/quick/quick_method_frame_info.h */ public class QuickMethodFrameInfo implements StructConverter { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable.java index e1a9cc6851..8401507001 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable.java @@ -18,8 +18,9 @@ package ghidra.file.formats.android.oat.tlt; import ghidra.app.util.bin.StructConverter; /** - * https://android.googlesource.com/platform/art/+/oreo-release/runtime/type_lookup_table.h#161 - * https://android.googlesource.com/platform/art/+/oreo-m2-release/runtime/type_lookup_table.h#161 + * oreo-release/runtime/type_lookup_table.h + *
+ * oreo-m2-release/runtime/type_lookup_table.h */ public abstract class TypeLookupTable implements StructConverter { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTableEntry.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTableEntry.java index 59094a4267..5b94ba0070 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTableEntry.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTableEntry.java @@ -23,11 +23,13 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/nougat-release/runtime/type_lookup_table.h#99 - * https://android.googlesource.com/platform/art/+/oreo-release/runtime/type_lookup_table.h#100 - * https://android.googlesource.com/platform/art/+/oreo-m2-release/runtime/type_lookup_table.h#100 - * https://android.googlesource.com/platform/art/+/pie-release/runtime/type_lookup_table.h#102 - * + * nougat-release/runtime/type_lookup_table.h + *
+ * oreo-release/runtime/type_lookup_table.h + *
+ * oreo-m2-release/runtime/type_lookup_table.h + *
+ * pie-release/runtime/type_lookup_table.h */ public class TypeLookupTableEntry implements StructConverter { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTableEntry_Android10.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTableEntry_Q_R_S_T.java similarity index 61% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTableEntry_Android10.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTableEntry_Q_R_S_T.java index d820214d22..25b897c0d3 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTableEntry_Android10.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTableEntry_Q_R_S_T.java @@ -22,13 +22,17 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android10-release/libdexfile/dex/type_lookup_table.h#110 - * https://android.googlesource.com/platform/art/+/refs/heads/android11-release/libdexfile/dex/type_lookup_table.h#110 - * https://android.googlesource.com/platform/art/+/refs/heads/android12-release/libdexfile/dex/type_lookup_table.h#110 + * android10-release/libdexfile/dex/type_lookup_table.h + *
+ * android11-release/libdexfile/dex/type_lookup_table.h + *
+ * android12-release/libdexfile/dex/type_lookup_table.h + *
+ * android13-release/libdexfile/dex/type_lookup_table.h */ -public class TypeLookupTableEntry_Android10 extends TypeLookupTableEntry { +public class TypeLookupTableEntry_Q_R_S_T extends TypeLookupTableEntry { - public TypeLookupTableEntry_Android10(BinaryReader reader) throws IOException { + public TypeLookupTableEntry_Q_R_S_T(BinaryReader reader) throws IOException { super(); str_offset_ = reader.readNextInt(); data_ = reader.readNextInt(); @@ -50,7 +54,7 @@ public class TypeLookupTableEntry_Android10 extends TypeLookupTableEntry { @Override public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = new StructureDataType(TypeLookupTableEntry_Android10.class.getSimpleName(), 0); + Structure structure = new StructureDataType(TypeLookupTableEntry_Q_R_S_T.class.getSimpleName(), 0); structure.add(DWORD, "str_offset_", null); structure.add(DWORD, "data_", null); structure.setCategoryPath(new CategoryPath("/oat")); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTableFactory.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTableFactory.java index b12264d336..9b4226a7a8 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTableFactory.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTableFactory.java @@ -27,25 +27,25 @@ public final class TypeLookupTableFactory { throws IOException { switch (oatVersion) { - case OatConstants.VERSION_NOUGAT_RELEASE: - case OatConstants.VERSION_NOUGAT_MR1_RELEASE: + case OatConstants.OAT_VERSION_079: + case OatConstants.OAT_VERSION_088: return new TypeLookupTable_Nougat(reader); - case OatConstants.VERSION_OREO_RELEASE: - case OatConstants.VERSION_OREO_M2_RELEASE: - case OatConstants.VERSION_OREO_DR3_RELEASE: + case OatConstants.OAT_VERSION_124: + case OatConstants.OAT_VERSION_131: + case OatConstants.OAT_VERSION_126: return new TypeLookupTable_Oreo(reader); - case OatConstants.VERSION_PIE_RELEASE: + case OatConstants.OAT_VERSION_138: return new TypeLookupTable_Pie(reader); - case OatConstants.VERSION_10_RELEASE: - return new TypeLookupTable_Android10(reader); - case OatConstants.VERSION_11_RELEASE: - return new TypeLookupTable_Android11(reader); - case OatConstants.VERSION_12_RELEASE: - case OatConstants.VERSION_S_V2_PREVIEW: - case OatConstants.VERSION_T_PREVIEW_1: - case OatConstants.VERSION_S_V2_BETA2: - case OatConstants.VERSION_13_RELEASE: - return new TypeLookupTable_Android12(reader); + case OatConstants.OAT_VERSION_170: + return new TypeLookupTable_Q(reader); + case OatConstants.OAT_VERSION_183: + return new TypeLookupTable_R(reader); + case OatConstants.OAT_VERSION_195: + case OatConstants.OAT_VERSION_199: + case OatConstants.OAT_VERSION_220: + case OatConstants.OAT_VERSION_223: + case OatConstants.OAT_VERSION_225: + return new TypeLookupTable_S_T(reader); default: throw new IOException(new UnsupportedOatVersionException( "Unsupported TypeLookupTable for OAT version " + oatVersion)); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Nougat.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Nougat.java index 606a420b95..601566d65d 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Nougat.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Nougat.java @@ -24,7 +24,7 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/nougat-release/runtime/type_lookup_table.h + * nougat-release/runtime/type_lookup_table.h */ public class TypeLookupTable_Nougat extends TypeLookupTable { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Oreo.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Oreo.java index a707cbac7f..f2553a0f65 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Oreo.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Oreo.java @@ -24,8 +24,9 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/oreo-release/runtime/type_lookup_table.h#161 - * https://android.googlesource.com/platform/art/+/oreo-m2-release/runtime/type_lookup_table.h#161 + * oreo-release/runtime/type_lookup_table.h + *
+ * oreo-m2-release/runtime/type_lookup_table.h */ public class TypeLookupTable_Oreo extends TypeLookupTable { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Pie.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Pie.java index 27765fadb8..f94ea32bbe 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Pie.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Pie.java @@ -24,8 +24,9 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/oreo-release/runtime/type_lookup_table.h#161 - * https://android.googlesource.com/platform/art/+/oreo-m2-release/runtime/type_lookup_table.h#161 + * oreo-release/runtime/type_lookup_table.h + *
+ * oreo-m2-release/runtime/type_lookup_table.h */ public class TypeLookupTable_Pie extends TypeLookupTable { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Android10.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Q.java similarity index 81% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Android10.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Q.java index c224a6abc0..109735dc63 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Android10.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Q.java @@ -24,9 +24,9 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android10-release/libdexfile/dex/type_lookup_table.h#35 + * android10-release/libdexfile/dex/type_lookup_table.h */ -public class TypeLookupTable_Android10 extends TypeLookupTable { +public class TypeLookupTable_Q extends TypeLookupTable { private int dex_file_begin_; private int mask_bits_; @@ -35,14 +35,14 @@ public class TypeLookupTable_Android10 extends TypeLookupTable { protected List entryList = new ArrayList<>(); - public TypeLookupTable_Android10(BinaryReader reader) throws IOException { + public TypeLookupTable_Q(BinaryReader reader) throws IOException { dex_file_begin_ = reader.readNextInt(); mask_bits_ = reader.readNextInt(); entries_ = reader.readNextInt(); owns_entries_ = reader.readNextInt(); while (true) { - TypeLookupTableEntry entry = new TypeLookupTableEntry_Android10(reader); + TypeLookupTableEntry entry = new TypeLookupTableEntry_Q_R_S_T(reader); entryList.add(entry); if (entry.isEmpty()) { break; @@ -76,7 +76,7 @@ public class TypeLookupTable_Android10 extends TypeLookupTable { @Override public DataType toDataType() throws DuplicateNameException, IOException { Structure structure = new StructureDataType( - TypeLookupTable_Android10.class.getSimpleName() + "_" + entryList.size(), 0); + TypeLookupTable_Q.class.getSimpleName() + "_" + entryList.size(), 0); structure.add(DWORD, "dex_file_begin_", null); structure.add(DWORD, "mask_bits_", null); structure.add(DWORD, "entries_", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Android11.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_R.java similarity index 73% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Android11.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_R.java index e6fd61ab19..6ac326c39a 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Android11.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_R.java @@ -22,12 +22,11 @@ import ghidra.program.model.data.DataType; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android11-release/libdexfile/dex/type_lookup_table.h#35 - * + * android11-release/libdexfile/dex/type_lookup_table.h */ -public class TypeLookupTable_Android11 extends TypeLookupTable_Android10 { +public class TypeLookupTable_R extends TypeLookupTable_Q { - public TypeLookupTable_Android11(BinaryReader reader) throws IOException { + public TypeLookupTable_R(BinaryReader reader) throws IOException { super(reader); } @@ -36,7 +35,7 @@ public class TypeLookupTable_Android11 extends TypeLookupTable_Android10 { DataType dataType = super.toDataType(); try { dataType.setName( - TypeLookupTable_Android11.class.getSimpleName() + "_" + entryList.size()); + TypeLookupTable_R.class.getSimpleName() + "_" + entryList.size()); } catch (Exception e) { //ignore diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Android12.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_S_T.java similarity index 64% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Android12.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_S_T.java index efe0012d60..b58164da14 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_Android12.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/oat/tlt/TypeLookupTable_S_T.java @@ -22,11 +22,13 @@ import ghidra.program.model.data.DataType; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android12-release/libdexfile/dex/type_lookup_table.h#35 + * android12-release/libdexfile/dex/type_lookup_table.h + *
+ * android13-release/libdexfile/dex/type_lookup_table.h */ -public class TypeLookupTable_Android12 extends TypeLookupTable_Android10 { +public class TypeLookupTable_S_T extends TypeLookupTable_Q { - public TypeLookupTable_Android12(BinaryReader reader) throws IOException { + public TypeLookupTable_S_T(BinaryReader reader) throws IOException { super(reader); } @@ -35,7 +37,7 @@ public class TypeLookupTable_Android12 extends TypeLookupTable_Android10 { DataType dataType = super.toDataType(); try { dataType.setName( - TypeLookupTable_Android12.class.getSimpleName() + "_" + entryList.size()); + TypeLookupTable_S_T.class.getSimpleName() + "_" + entryList.size()); } catch (Exception e) { //ignore diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/UnsupportedVdexVersionException.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/UnsupportedVdexVersionException.java index a8cefe4efd..5861a8cd99 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/UnsupportedVdexVersionException.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/UnsupportedVdexVersionException.java @@ -17,11 +17,11 @@ package ghidra.file.formats.android.vdex; public final class UnsupportedVdexVersionException extends Exception { - UnsupportedVdexVersionException(String magic, String version) { + public UnsupportedVdexVersionException(String magic, String version) { super("Unsupported VDEX version: " + version); } - UnsupportedVdexVersionException(String message) { + public UnsupportedVdexVersionException(String message) { super(message); } } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexConstants.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexConstants.java index c17369326b..3dbdf87960 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexConstants.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexConstants.java @@ -27,7 +27,7 @@ import ghidra.program.model.mem.MemoryBlock; * VDEX files contain extracted DEX files. The VdexFile class maps the file to * memory and provides tools for accessing its individual sections. * - * https://android.googlesource.com/platform/art/+/master/runtime/vdex_file.h + * master/runtime/vdex_file.h */ public final class VdexConstants { @@ -38,24 +38,38 @@ public final class VdexConstants { */ public final static String MAGIC = "vdex"; - /** https://android.googlesource.com/platform/art/+/refs/heads/o-preview/runtime/vdex_file.h#64 */ - public final static String version_o_preview = "003"; - /** https://android.googlesource.com/platform/art/+/refs/heads/oreo-release/runtime/vdex_file.h#69 */ - public final static String VERSION_OREO_RELEASE = "006"; - /** https://android.googlesource.com/platform/art/+/refs/heads/oreo-m2-release/runtime/vdex_file.h#76 */ - public final static String VERSION_OREO_M2_RELEASE = "010"; - /** https://android.googlesource.com/platform/art/+/refs/heads/o-iot-preview-5/runtime/vdex_file.h#76 */ - public final static String version_o_iot_preview_5 = "010"; - /** https://android.googlesource.com/platform/art/+/refs/heads/o-mr1-iot-preview-6/runtime/vdex_file.h#76 */ - public final static String version_o_mr1_iot_preview_6 = "011"; - /** https://android.googlesource.com/platform/art/+/refs/heads/pie-release/runtime/vdex_file.h#96 */ - public final static String VERSION_PIE_RELEASE = "019"; - /** https://android.googlesource.com/platform/art/+/refs/heads/android10-release/runtime/vdex_file.h#118 */ - public final static String VERSION_10_RELEASE = "021"; - /** https://android.googlesource.com/platform/art/+/refs/heads/android11-release/runtime/vdex_file.h#118 */ - public final static String VERSION_11_RELEASE = "021"; - /** https://android.googlesource.com/platform/art/+/refs/heads/android12-release/runtime/vdex_file.h#127 */ - public final static String VERSION_12_RELEASE = "027"; + /** + * o-preview/runtime/vdex_file.h + */ + public final static String vdex_version_003 = "003"; + /** + * oreo-release/runtime/vdex_file.h + */ + public final static String VDEX_VERSION_006 = "006"; + /** + * oreo-m2-release/runtime/vdex_file.h + *
+ * o-iot-preview-5/runtime/vdex_file.h + */ + public final static String VDEX_VERSION_010 = "010"; + /** + * o-mr1-iot-preview-6/runtime/vdex_file.h + */ + public final static String vdex_version_011 = "011"; + /** + * pie-release/runtime/vdex_file.h + */ + public final static String VDEX_VERSION_019 = "019"; + /** + * android10-release/runtime/vdex_file.h + *
+ * android11-release/runtime/vdex_file + */ + public final static String VDEX_VERSION_021 = "021"; + /** + * android12-release/runtime/vdex_file.h + */ + public final static String VDEX_VERSION_027 = "027"; /** * The format version of the dex section header and the dex section, @@ -82,12 +96,11 @@ public final class VdexConstants { */ //@formatter:off public final static String[] SUPPORTED_VERSIONS = new String[] { - VERSION_OREO_RELEASE, - VERSION_OREO_M2_RELEASE, - VERSION_PIE_RELEASE, - VERSION_10_RELEASE, - VERSION_11_RELEASE, - VERSION_12_RELEASE, + VDEX_VERSION_006, + VDEX_VERSION_010, + VDEX_VERSION_019, + VDEX_VERSION_021, + VDEX_VERSION_027, }; //@formatter:on diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexFileSystem.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexFileSystem.java index 1d731a869c..612d62da55 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexFileSystem.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexFileSystem.java @@ -55,7 +55,7 @@ public class VdexFileSystem extends GFileSystemBase { monitor.setMessage("Parsing VDEX header..."); BinaryReader reader = new BinaryReader(provider, true /* TODO always LE??? */ ); try { - header = VdexFactory.getVdexHeader(reader); + header = VdexHeaderFactory.getVdexHeader(reader); header.parse(reader, monitor); for (int i = 0; i < header.getDexHeaderList().size(); ++i) { diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeader.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeader.java index 0523aa00b2..bbdb825b8e 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeader.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeader.java @@ -22,13 +22,15 @@ import java.util.List; import ghidra.app.util.bin.BinaryReader; import ghidra.app.util.bin.StructConverter; import ghidra.file.formats.android.dex.format.DexHeader; +import ghidra.file.formats.android.vdex.sections.DexSectionHeader_002; +import ghidra.program.model.data.*; import ghidra.util.exception.CancelledException; +import ghidra.util.exception.DuplicateNameException; import ghidra.util.task.TaskMonitor; public abstract class VdexHeader implements StructConverter { protected String magic_; - protected String verifier_deps_version_; protected VdexStringTable stringTable; protected List dexHeaderStartsList = new ArrayList<>(); @@ -38,32 +40,30 @@ public abstract class VdexHeader implements StructConverter { magic_ = new String(reader.readNextByteArray(VdexConstants.MAGIC.length())); } - final public String getMagic() { + public final String getMagic() { return magic_; } - final public String getVerifierDepsVersion() { - return verifier_deps_version_; - } + public abstract String getVersion(); - abstract public void parse(BinaryReader reader, TaskMonitor monitor) + public abstract void parse(BinaryReader reader, TaskMonitor monitor) throws IOException, CancelledException; - final public long getDexStartOffset(int index) { + public final long getDexStartOffset(int index) { return dexHeaderStartsList.get(index); } - abstract public int getVerifierDepsSize(); + public abstract int getVerifierDepsSize(); - abstract public int getQuickeningInfoSize(); + public abstract int getQuickeningInfoSize(); - abstract public int[] getDexChecksums(); + public abstract int[] getDexChecksums(); /** * Returns the list of DEX headers contained in this VDEX. * Could return empty list depending on version of VDEX. */ - final public List getDexHeaderList() { + public final List getDexHeaderList() { return dexHeaderList; } @@ -71,11 +71,20 @@ public abstract class VdexHeader implements StructConverter { * Returns the VDEX String Table. * Note: Could be NULL. */ - final public VdexStringTable getStringTable() { + public final VdexStringTable getStringTable() { return stringTable; } - abstract public boolean isDexHeaderEmbeddedInDataType(); + public abstract boolean isDexHeaderEmbeddedInDataType(); - abstract public DexSectionHeader_002 getDexSectionHeader_002(); + public abstract DexSectionHeader_002 getDexSectionHeader_002(); + + @Override + public DataType toDataType() throws DuplicateNameException, IOException { + Structure structure = new StructureDataType( + magic_ + "_" + getVersion(), 0); + structure.add(STRING, 4, "magic_", null); + structure.setCategoryPath(new CategoryPath("/vdex")); + return structure; + } } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeaderAnalyzer.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeaderAnalyzer.java index 2f70e0d3a3..1ca1352e6f 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeaderAnalyzer.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeaderAnalyzer.java @@ -22,6 +22,7 @@ import ghidra.app.util.importer.MessageLog; import ghidra.file.analyzers.FileFormatAnalyzer; import ghidra.file.formats.android.dex.format.DexHeader; import ghidra.file.formats.android.oat.OatUtilities; +import ghidra.file.formats.android.vdex.sections.DexSectionHeader_002; import ghidra.program.model.address.Address; import ghidra.program.model.address.AddressSetView; import ghidra.program.model.data.ArrayDataType; @@ -77,7 +78,7 @@ public class VdexHeaderAnalyzer extends FileFormatAnalyzer { ByteProvider provider = new MemoryByteProvider(program.getMemory(), address); BinaryReader reader = new BinaryReader(provider, !program.getLanguage().isBigEndian()); try { - VdexHeader vdexHeader = VdexFactory.getVdexHeader(reader); + VdexHeader vdexHeader = VdexHeaderFactory.getVdexHeader(reader); vdexHeader.parse(reader, monitor); DataType vdexHeaderDataType = vdexHeader.toDataType(); @@ -139,7 +140,7 @@ public class VdexHeaderAnalyzer extends FileFormatAnalyzer { private Address createVerifierDepsSize(Program program, Address address, VdexHeader vdexHeader) throws Exception { - if (vdexHeader.getVerifierDepsVersion() != VdexConstants.VERSION_10_RELEASE) { + if (vdexHeader.getVersion() != VdexConstants.VDEX_VERSION_021) { return address; } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexFactory.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeaderFactory.java similarity index 68% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexFactory.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeaderFactory.java index 3d7a2cc80a..869cbb73a7 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexFactory.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeaderFactory.java @@ -18,9 +18,9 @@ package ghidra.file.formats.android.vdex; import java.io.IOException; import ghidra.app.util.bin.BinaryReader; -import ghidra.file.formats.android.vdex.android12.VdexHeader_12; +import ghidra.file.formats.android.vdex.headers.*; -public final class VdexFactory { +public final class VdexHeaderFactory { /** * Returns an VDEX Header for the specified version. @@ -35,21 +35,20 @@ public final class VdexFactory { String version = reader.readAsciiString(4, 4); if (magic.equals(VdexConstants.MAGIC)) { if (VdexConstants.isSupportedVersion(version)) { - if (version.equals(VdexConstants.VERSION_OREO_RELEASE) || - version.equals(VdexConstants.VERSION_OREO_M2_RELEASE)) { - return new VdexHeader_Oreo(reader); + if (version.equals(VdexConstants.VDEX_VERSION_006)) { + return new VdexHeader_006(reader); } - if (version.equals(VdexConstants.VERSION_PIE_RELEASE)) { - return new VdexHeader_Pie(reader); + else if (version.equals(VdexConstants.VDEX_VERSION_010)) { + return new VdexHeader_010(reader); } - if (version.equals(VdexConstants.VERSION_10_RELEASE)) { - return new VdexHeader_10(reader); + else if (version.equals(VdexConstants.VDEX_VERSION_019)) { + return new VdexHeader_019(reader); } - if (version.equals(VdexConstants.VERSION_11_RELEASE)) { - return new VdexHeader_11(reader); + else if (version.equals(VdexConstants.VDEX_VERSION_021)) { + return new VdexHeader_021(reader); } - if (version.equals(VdexConstants.VERSION_12_RELEASE)) { - return new VdexHeader_12(reader); + else if (version.equals(VdexConstants.VDEX_VERSION_027)) { + return new VdexHeader_027(reader); } } } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexStringTable.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexStringTable.java index 1453c7ac0f..8b6a850893 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexStringTable.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexStringTable.java @@ -19,7 +19,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import ghidra.app.util.bin.*; +import ghidra.app.util.bin.BinaryReader; +import ghidra.app.util.bin.StructConverter; import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; @@ -28,7 +29,7 @@ public class VdexStringTable implements StructConverter { private int stringCount;//note only 1 byte in size private List strings = new ArrayList<>(); - VdexStringTable(BinaryReader reader) throws IOException { + public VdexStringTable(BinaryReader reader) throws IOException { stringCount = Byte.toUnsignedInt(reader.readNextByte()); for (int i = 0; i < stringCount; ++i) { strings.add(reader.readNextAsciiString()); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeader_Oreo.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/headers/VdexHeader_006.java similarity index 86% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeader_Oreo.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/headers/VdexHeader_006.java index 14d24799e9..26dacc3daf 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeader_Oreo.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/headers/VdexHeader_006.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.vdex; +package ghidra.file.formats.android.vdex.headers; import java.io.IOException; @@ -21,16 +21,19 @@ import ghidra.app.util.bin.*; import ghidra.file.formats.android.dex.DexHeaderFactory; import ghidra.file.formats.android.dex.format.DexHeader; import ghidra.file.formats.android.dex.format.DexHeaderQuickMethods; +import ghidra.file.formats.android.vdex.VdexHeader; +import ghidra.file.formats.android.vdex.sections.DexSectionHeader_002; import ghidra.program.model.data.*; import ghidra.util.exception.CancelledException; import ghidra.util.exception.DuplicateNameException; import ghidra.util.task.TaskMonitor; /** - * https://android.googlesource.com/platform/art/+/refs/heads/oreo-release/runtime/vdex_file.h - * https://android.googlesource.com/platform/art/+/refs/heads/oreo-m2-release/runtime/vdex_file.h + * oreo-release/runtime/vdex_file.h + *
+ * oreo-m2-release/runtime/vdex_file.h */ -public class VdexHeader_Oreo extends VdexHeader { +public class VdexHeader_006 extends VdexHeader { private String version_; private int number_of_dex_files_; @@ -39,7 +42,7 @@ public class VdexHeader_Oreo extends VdexHeader { private int quickening_info_size_; private int[] dex_checksums_; - public VdexHeader_Oreo(BinaryReader reader) throws IOException { + public VdexHeader_006(BinaryReader reader) throws IOException { super(reader); version_ = reader.readNextAsciiString(4); number_of_dex_files_ = reader.readNextInt(); @@ -111,9 +114,8 @@ public class VdexHeader_Oreo extends VdexHeader { @Override public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = new StructureDataType( - VdexHeader_Oreo.class.getSimpleName() + "_" + number_of_dex_files_, 0); - structure.add(STRING, 4, "magic_", null); + Structure structure = (Structure) super.toDataType(); + structure.add(STRING, 4, "version_", null); structure.add(DWORD, "number_of_dex_files_", null); structure.add(DWORD, "dex_size_", null); @@ -139,7 +141,6 @@ public class VdexHeader_Oreo extends VdexHeader { if (stringTable != null) { structure.add(stringTable.toDataType(), "strings", null); } - structure.setCategoryPath(new CategoryPath("/vdex")); return structure; } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/headers/VdexHeader_010.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/headers/VdexHeader_010.java new file mode 100644 index 0000000000..91cb4b1480 --- /dev/null +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/headers/VdexHeader_010.java @@ -0,0 +1,31 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package ghidra.file.formats.android.vdex.headers; + +import java.io.IOException; + +import ghidra.app.util.bin.BinaryReader; + +/** + * oreo-m2-release/runtime/vdex_file.h + *
+ * o-iot-preview-5/runtime/vdex_file.h + */ +public class VdexHeader_010 extends VdexHeader_006 { + public VdexHeader_010(BinaryReader reader) throws IOException { + super(reader); + } +} diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeader_Pie.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/headers/VdexHeader_019.java similarity index 87% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeader_Pie.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/headers/VdexHeader_019.java index 84b29a35c6..dc8cb3f677 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeader_Pie.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/headers/VdexHeader_019.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.vdex; +package ghidra.file.formats.android.vdex.headers; import java.io.IOException; import java.util.ArrayList; @@ -23,16 +23,19 @@ import ghidra.app.util.bin.BinaryReader; import ghidra.app.util.bin.ByteProviderWrapper; import ghidra.file.formats.android.dex.DexHeaderFactory; import ghidra.file.formats.android.dex.format.DexHeader; +import ghidra.file.formats.android.vdex.*; +import ghidra.file.formats.android.vdex.sections.DexSectionHeader_002; import ghidra.program.model.data.*; import ghidra.util.exception.CancelledException; import ghidra.util.exception.DuplicateNameException; import ghidra.util.task.TaskMonitor; /** - * https://android.googlesource.com/platform/art/+/refs/heads/pie-release/runtime/vdex_file.h + * pie-release/runtime/vdex_file.h */ -public class VdexHeader_Pie extends VdexHeader { +public class VdexHeader_019 extends VdexHeader { + private String verifier_deps_version_; private String dex_section_version_; private int number_of_dex_files_; private int verifier_deps_size_; @@ -40,7 +43,7 @@ public class VdexHeader_Pie extends VdexHeader { private DexSectionHeader_002 sectionHeader; private List quickenTableOffsetList = new ArrayList<>(); - public VdexHeader_Pie(BinaryReader reader) throws IOException, UnsupportedVdexVersionException { + public VdexHeader_019(BinaryReader reader) throws IOException, UnsupportedVdexVersionException { super(reader); verifier_deps_version_ = reader.readNextAsciiString(4); @@ -83,6 +86,11 @@ public class VdexHeader_Pie extends VdexHeader { } } + @Override + public String getVersion() { + return verifier_deps_version_; + } + public void parse(BinaryReader reader, TaskMonitor monitor) throws IOException, CancelledException { //do nothing @@ -124,9 +132,8 @@ public class VdexHeader_Pie extends VdexHeader { @Override public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = new StructureDataType( - VdexHeader_Pie.class.getSimpleName() + "_" + number_of_dex_files_, 0); - structure.add(STRING, 4, "magic_", null); + Structure structure = (Structure) super.toDataType(); + structure.add(STRING, 4, "verifier_deps_version_", null); structure.add(STRING, 4, "dex_section_version_", null); structure.add(DWORD, "number_of_dex_files_", null); @@ -140,7 +147,6 @@ public class VdexHeader_Pie extends VdexHeader { if (stringTable != null) { structure.add(stringTable.toDataType(), "strings", null); } - structure.setCategoryPath(new CategoryPath("/vdex")); return structure; } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeader_10.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/headers/VdexHeader_021.java similarity index 87% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeader_10.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/headers/VdexHeader_021.java index 51070a2589..b3b58c3922 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/VdexHeader_10.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/headers/VdexHeader_021.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.vdex; +package ghidra.file.formats.android.vdex.headers; import java.io.IOException; import java.util.ArrayList; @@ -23,16 +23,19 @@ import ghidra.app.util.bin.BinaryReader; import ghidra.app.util.bin.ByteProviderWrapper; import ghidra.file.formats.android.dex.DexHeaderFactory; import ghidra.file.formats.android.dex.format.DexHeader; +import ghidra.file.formats.android.vdex.*; +import ghidra.file.formats.android.vdex.sections.DexSectionHeader_002; import ghidra.program.model.data.*; import ghidra.util.exception.CancelledException; import ghidra.util.exception.DuplicateNameException; import ghidra.util.task.TaskMonitor; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android10-release/runtime/vdex_file.h + * android10-release/runtime/vdex_file.h */ -public class VdexHeader_10 extends VdexHeader { +public class VdexHeader_021 extends VdexHeader { + private String verifier_deps_version_; private String dex_section_version_; private int number_of_dex_files_; private int verifier_deps_size_; @@ -42,7 +45,7 @@ public class VdexHeader_10 extends VdexHeader { private DexSectionHeader_002 sectionHeader; private List quickenTableOffsetList = new ArrayList<>(); - public VdexHeader_10(BinaryReader reader) throws IOException, UnsupportedVdexVersionException { + public VdexHeader_021(BinaryReader reader) throws IOException, UnsupportedVdexVersionException { super(reader); verifier_deps_version_ = reader.readNextAsciiString(4); dex_section_version_ = reader.readNextAsciiString(4); @@ -88,6 +91,11 @@ public class VdexHeader_10 extends VdexHeader { } } + @Override + public String getVersion() { + return verifier_deps_version_; + } + public void parse(BinaryReader reader, TaskMonitor monitor) throws IOException, CancelledException { //do nothing @@ -137,9 +145,8 @@ public class VdexHeader_10 extends VdexHeader { @Override public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = new StructureDataType( - VdexHeader_10.class.getSimpleName() + "_" + number_of_dex_files_, 0); - structure.add(STRING, 4, "magic_", null); + Structure structure = (Structure) super.toDataType(); + structure.add(STRING, 4, "verifier_deps_version_", null); structure.add(STRING, 4, "dex_section_version_", null); structure.add(DWORD, "number_of_dex_files_", null); @@ -155,7 +162,6 @@ public class VdexHeader_10 extends VdexHeader { if (stringTable != null && stringTable.getStringCount() > 0) { structure.add(stringTable.toDataType(), "strings", null); } - structure.setCategoryPath(new CategoryPath("/vdex")); return structure; } diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/android12/VdexHeader_12.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/headers/VdexHeader_027.java similarity index 75% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/android12/VdexHeader_12.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/headers/VdexHeader_027.java index 1b462c12be..1f24a8c867 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/android12/VdexHeader_12.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/headers/VdexHeader_027.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.vdex.android12; +package ghidra.file.formats.android.vdex.headers; import java.io.IOException; import java.util.ArrayList; @@ -26,39 +26,45 @@ import ghidra.app.util.bin.ByteProviderWrapper; import ghidra.file.formats.android.dex.DexHeaderFactory; import ghidra.file.formats.android.dex.format.DexHeader; import ghidra.file.formats.android.vdex.*; +import ghidra.file.formats.android.vdex.sections.*; import ghidra.program.model.data.*; import ghidra.util.exception.CancelledException; import ghidra.util.exception.DuplicateNameException; import ghidra.util.task.TaskMonitor; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android-s-beta-5/runtime/vdex_file.h#129 - * - * https://android.googlesource.com/platform/art/+/refs/heads/android12-release/runtime/vdex_file.h#129 - * - * https://android.googlesource.com/platform/art/+/refs/heads/android13-release/runtime/vdex_file.h#129 + * android-s-beta-5/runtime/vdex_file.h#129 + *
+ * android12-release/runtime/vdex_file.h#129 + *
+ * android13-release/runtime/vdex_file.h#129 */ -public class VdexHeader_12 extends VdexHeader { +public class VdexHeader_027 extends VdexHeader { private String vdex_version_; private int number_of_sections_; - private List sections = new ArrayList<>(); + private List sections = new ArrayList<>(); private List checksums = new ArrayList<>(); - public VdexHeader_12(BinaryReader reader) + public VdexHeader_027(BinaryReader reader) throws IOException, UnsupportedVdexVersionException { super(reader); vdex_version_ = reader.readNextAsciiString(4); number_of_sections_ = reader.readNextInt(); } + @Override + public String getVersion() { + return vdex_version_; + } + @Override public void parse(BinaryReader reader, TaskMonitor monitor) throws IOException, CancelledException { for (int i = 0; i < number_of_sections_; ++i) { monitor.checkCanceled(); - sections.add(new VdexSectionHeader_12(reader)); + sections.add(new VdexSectionHeader_S_T(reader)); } parseChecksums(reader, monitor); @@ -69,8 +75,8 @@ public class VdexHeader_12 extends VdexHeader { private void parseChecksums(BinaryReader reader, TaskMonitor monitor) throws CancelledException, IOException { - VdexSectionHeader_12 checksumSection = - sections.get(VdexSection_12.kChecksumSection.ordinal()); + VdexSectionHeader_S_T checksumSection = + sections.get(VdexSection_S_T.kChecksumSection.ordinal()); if (checksumSection.getSectionSize() > 0) { reader.setPointerIndex(checksumSection.getSectionOffset()); for (int i = 0; i < checksumSection.getSectionSize() / 4; ++i) { @@ -82,8 +88,8 @@ public class VdexHeader_12 extends VdexHeader { private void parseDexFiles(BinaryReader reader, TaskMonitor monitor) throws CancelledException, IOException { - VdexSectionHeader_12 dexFileSection = - sections.get(VdexSection_12.kDexFileSection.ordinal()); + VdexSectionHeader_S_T dexFileSection = + sections.get(VdexSection_S_T.kDexFileSection.ordinal()); if (dexFileSection.getSectionSize() > 0) { reader.setPointerIndex(dexFileSection.getSectionOffset()); @@ -103,8 +109,8 @@ public class VdexHeader_12 extends VdexHeader { private void parseVerifierDeps(BinaryReader reader, TaskMonitor monitor) throws CancelledException, IOException { - VdexSectionHeader_12 verifierDepsSection = - sections.get(VdexSection_12.kVerifierDepsSection.ordinal()); + VdexSectionHeader_S_T verifierDepsSection = + sections.get(VdexSection_S_T.kVerifierDepsSection.ordinal()); if (verifierDepsSection.getSectionSize() > 0) { reader.setPointerIndex(verifierDepsSection.getSectionOffset()); //TODO @@ -113,8 +119,8 @@ public class VdexHeader_12 extends VdexHeader { private void parseTypeLookupTable(BinaryReader reader, TaskMonitor monitor) throws CancelledException, IOException { - VdexSectionHeader_12 typeLookupTableSection = - sections.get(VdexSection_12.kTypeLookupTableSection.ordinal()); + VdexSectionHeader_S_T typeLookupTableSection = + sections.get(VdexSection_S_T.kTypeLookupTableSection.ordinal()); if (typeLookupTableSection.getSectionSize() > 0) { reader.setPointerIndex(typeLookupTableSection.getSectionOffset()); //TODO @@ -152,8 +158,8 @@ public class VdexHeader_12 extends VdexHeader { @Override public DataType toDataType() throws DuplicateNameException, IOException { - Structure structure = new StructureDataType(VdexHeader_12.class.getSimpleName(), 0); - structure.add(STRING, 4, "magic_", null); + Structure structure = (Structure) super.toDataType(); + structure.add(STRING, 4, "vdex_version_", null); structure.add(DWORD, "number_of_sections_", null); @@ -173,8 +179,8 @@ public class VdexHeader_12 extends VdexHeader { } private void toDataTypeDexFile(Structure structure) { - VdexSectionHeader_12 dexFileSection = - sections.get(VdexSection_12.kDexFileSection.ordinal()); + VdexSectionHeader_S_T dexFileSection = + sections.get(VdexSection_S_T.kDexFileSection.ordinal()); if (dexFileSection.getSectionSize() > 0) { DataType array = new ArrayDataType(BYTE, dexFileSection.getSectionSize(), BYTE.getLength()); @@ -183,8 +189,8 @@ public class VdexHeader_12 extends VdexHeader { } private void toDataTypeVerifierDeps(Structure structure) { - VdexSectionHeader_12 verifierDepsSection = - sections.get(VdexSection_12.kVerifierDepsSection.ordinal()); + VdexSectionHeader_S_T verifierDepsSection = + sections.get(VdexSection_S_T.kVerifierDepsSection.ordinal()); if (verifierDepsSection.getSectionSize() > 0) { DataType array = new ArrayDataType(BYTE, verifierDepsSection.getSectionSize(), BYTE.getLength()); @@ -193,8 +199,8 @@ public class VdexHeader_12 extends VdexHeader { } private void toDataTypeTypeLookupTable(Structure structure) { - VdexSectionHeader_12 typeLookupTableSection = - sections.get(VdexSection_12.kTypeLookupTableSection.ordinal()); + VdexSectionHeader_S_T typeLookupTableSection = + sections.get(VdexSection_S_T.kTypeLookupTableSection.ordinal()); if (typeLookupTableSection.getSectionSize() > 0) { DataType array = new ArrayDataType(BYTE, typeLookupTableSection.getSectionSize(), BYTE.getLength()); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/DexSectionHeader_002.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/sections/DexSectionHeader_002.java similarity index 85% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/DexSectionHeader_002.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/sections/DexSectionHeader_002.java index f88734cc49..601960eec8 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/DexSectionHeader_002.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/sections/DexSectionHeader_002.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.vdex; +package ghidra.file.formats.android.vdex.sections; import java.io.IOException; @@ -23,7 +23,7 @@ import ghidra.program.model.data.DataType; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/pie-release/runtime/vdex_file.h#114 + * pie-release/runtime/vdex_file.h#114 */ public class DexSectionHeader_002 implements StructConverter { @@ -31,7 +31,7 @@ public class DexSectionHeader_002 implements StructConverter { private int dex_shared_data_size_; private int quickening_info_size_; - DexSectionHeader_002(BinaryReader reader) throws IOException { + public DexSectionHeader_002(BinaryReader reader) throws IOException { dex_size_ = reader.readNextInt(); dex_shared_data_size_ = reader.readNextInt(); quickening_info_size_ = reader.readNextInt(); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/android12/VdexSectionHeader_12.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/sections/VdexSectionHeader_S_T.java similarity index 65% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/android12/VdexSectionHeader_12.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/sections/VdexSectionHeader_S_T.java index 7203dde307..11c7d27a92 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/android12/VdexSectionHeader_12.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/sections/VdexSectionHeader_S_T.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.vdex.android12; +package ghidra.file.formats.android.vdex.sections; import java.io.IOException; @@ -23,25 +23,23 @@ import ghidra.program.model.data.*; import ghidra.util.exception.DuplicateNameException; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android-s-beta-5/runtime/vdex_file.h#92 - * - * https://android.googlesource.com/platform/art/+/refs/heads/android12-release/runtime/vdex_file.h#92 - * - * https://android.googlesource.com/platform/art/+/refs/heads/android13-release/runtime/vdex_file.h#92 + * android12-release/runtime/vdex_file.h#92 + *
+ * android13-release/runtime/vdex_file.h#92 */ -public class VdexSectionHeader_12 implements StructConverter { +public class VdexSectionHeader_S_T implements StructConverter { - private VdexSection_12 section_kind; + private VdexSection_S_T section_kind; private int section_offset; private int section_size; - public VdexSectionHeader_12(BinaryReader reader) throws IOException { - section_kind = VdexSection_12.values()[reader.readNextInt()]; + public VdexSectionHeader_S_T(BinaryReader reader) throws IOException { + section_kind = VdexSection_S_T.values()[reader.readNextInt()]; section_offset = reader.readNextInt(); section_size = reader.readNextInt(); } - public VdexSection_12 getSectionKind() { + public VdexSection_S_T getSectionKind() { return section_kind; } @@ -55,7 +53,7 @@ public class VdexSectionHeader_12 implements StructConverter { @Override public DataType toDataType() throws DuplicateNameException, IOException { - String className = VdexSectionHeader_12.class.getSimpleName(); + String className = VdexSectionHeader_S_T.class.getSimpleName(); Structure structure = new StructureDataType(className, 0); structure.add(DWORD, "section_kind", null); structure.add(DWORD, "section_offset", null); diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/android12/VdexSection_12.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/sections/VdexSection_S_T.java similarity index 63% rename from Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/android12/VdexSection_12.java rename to Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/sections/VdexSection_S_T.java index 1d8f7f0d08..f3217a8b82 100644 --- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/android12/VdexSection_12.java +++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/android/vdex/sections/VdexSection_S_T.java @@ -13,13 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package ghidra.file.formats.android.vdex.android12; +package ghidra.file.formats.android.vdex.sections; /** - * https://android.googlesource.com/platform/art/+/refs/heads/android-s-beta-5/runtime/vdex_file.h#80 - * + * android12-release/runtime/vdex_file.h#80 + *
+ * android13-release/runtime/vdex_file.h#80 */ -public enum VdexSection_12 { +public enum VdexSection_S_T { kChecksumSection, kDexFileSection, kVerifierDepsSection,