Renamed and reorganized ART classes.

This commit is contained in:
lazybinding-dev 2022-09-20 16:55:21 -04:00
parent 45165ea167
commit f94a2d6058
48 changed files with 405 additions and 506 deletions

View File

@ -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();

View File

@ -30,54 +30,54 @@ public final class ArtConstants {
public final static int VERSION_LENGTH = 4;
/** <a href="https://android.googlesource.com/platform/art/+/refs/heads/kitkat-release/runtime/image.cc#26">kitkat-release/runtime/image.c */
public final static String VERSION_KITKAT_RELEASE = "005";
/** <a href="https://android.googlesource.com/platform/art/+/refs/heads/lollipop-release/runtime/image.cc#26">lollipop-release/runtime/image.c */
public final static String VERSION_LOLLIPOP_RELEASE = "009";
/** <a href="https://android.googlesource.com/platform/art/+/refs/heads/lollipop-mr1-wfc-release/runtime/image.cc#26">lollipop-mr1-wfc-release/runtime/image.c */
public final static String VERSION_LOLLIPOP_MR1_WFC_RELEASE = "012";
/** <a href="https://android.googlesource.com/platform/art/+/marshmallow-release/runtime/image.cc#26">marshmallow-release/runtime/image.c */
public final static String VERSION_MARSHMALLOW_RELEASE = "017";
/** <a href="https://android.googlesource.com/platform/art/+/nougat-release/runtime/image.cc#26">nougat-release/runtime/image.c */
public final static String VERSION_NOUGAT_RELEASE = "029";
/** <a href="https://android.googlesource.com/platform/art/+/nougat-mr2-pixel-release/runtime/image.cc#26">nougat-mr2-pixel-release/runtime/image.c */
public final static String VERSION_NOUGAT_MR2_PIXEL_RELEASE = "030";
/** <a href="https://android.googlesource.com/platform/art/+/oreo-release/runtime/image.cc#28">oreo-release/runtime/image.c */
public final static String VERSION_OREO_RELEASE = "043";
/** <a href="https://android.googlesource.com/platform/art/+/oreo-dr1-release/runtime/image.cc#28">oreo-dr1-release/runtime/image.c */
public final static String VERSION_OREO_DR1_RELEASE = "044";
/** <a href="https://android.googlesource.com/platform/art/+/oreo-mr1-release/runtime/image.cc#28">oreo-mr1-release/runtime/image.c */
public final static String VERSION_OREO_MR1_RELEASE = "046";
/** <a href="https://android.googlesource.com/platform/art/+/pie-release/runtime/image.cc#28">pie-release/runtime/image.c */
public final static String VERSION_PIE_RELEASE = "056";
/** <a href="https://android.googlesource.com/platform/art/+/android10-release/runtime/image.cc#31">android10-release/runtime/image.c */
public final static String VERSION_10_RELEASE = "074";//Q
/** <a href="https://android.googlesource.com/platform/art/+/android11-release/runtime/image.cc#31">android11-release/runtime/image.c */
public final static String VERSION_11_RELEASE = "085";//R
/** <a href="https://android.googlesource.com/platform/art/+/android12-release/runtime/image.cc#31">android12-release/runtime/image.c */
public final static String VERSION_12_RELEASE = "099";//S
/** <a href="https://android.googlesource.com/platform/art/+/android13-release/runtime/image.cc#31">android13-release/runtime/image.c */
public final static String VERSION_13_RELEASE = "106";//S v2, 13
/** <a href="https://android.googlesource.com/platform/art/+/refs/heads/kitkat-release/runtime/image.cc#26">kitkat-release/runtime/image.c</a> */
public final static String ART_VERSION_005 = "005";
/** <a href="https://android.googlesource.com/platform/art/+/refs/heads/lollipop-release/runtime/image.cc#26">lollipop-release/runtime/image.c</a> */
public final static String ART_VERSION_009 = "009";
/** <a href="https://android.googlesource.com/platform/art/+/refs/heads/lollipop-mr1-wfc-release/runtime/image.cc#26">lollipop-mr1-wfc-release/runtime/image.c</a> */
public final static String ART_VERSION_012 = "012";
/** <a href="https://android.googlesource.com/platform/art/+/marshmallow-release/runtime/image.cc#26">marshmallow-release/runtime/image.c</a> */
public final static String ART_VERSION_017 = "017";
/** <a href="https://android.googlesource.com/platform/art/+/nougat-release/runtime/image.cc#26">nougat-release/runtime/image.c</a> */
public final static String ART_VERSION_029 = "029";
/** <a href="https://android.googlesource.com/platform/art/+/nougat-mr2-pixel-release/runtime/image.cc#26">nougat-mr2-pixel-release/runtime/image.c</a> */
public final static String ART_VERSION_030 = "030";
/** <a href="https://android.googlesource.com/platform/art/+/oreo-release/runtime/image.cc#28">oreo-release/runtime/image.c</a> */
public final static String ART_VERSION_043 = "043";
/** <a href="https://android.googlesource.com/platform/art/+/oreo-dr1-release/runtime/image.cc#28">oreo-dr1-release/runtime/image.c</a> */
public final static String ART_VERSION_044 = "044";
/** <a href="https://android.googlesource.com/platform/art/+/oreo-mr1-release/runtime/image.cc#28">oreo-mr1-release/runtime/image.c</a> */
public final static String ART_VERSION_046 = "046";
/** <a href="https://android.googlesource.com/platform/art/+/pie-release/runtime/image.cc#28">pie-release/runtime/image.c</a> */
public final static String ART_VERSION_056 = "056";
/** <a href="https://android.googlesource.com/platform/art/+/android10-release/runtime/image.cc#31">android10-release/runtime/image.c</a> */
public final static String ART_VERSION_074 = "074";//Q
/** <a href="https://android.googlesource.com/platform/art/+/android11-release/runtime/image.cc#31">android11-release/runtime/image.c</a> */
public final static String ART_VERSION_085 = "085";//R
/** <a href="https://android.googlesource.com/platform/art/+/android12-release/runtime/image.cc#31">android12-release/runtime/image.c</a> */
public final static String ART_VERSION_099 = "099";//S
/** <a href="https://android.googlesource.com/platform/art/+/android13-release/runtime/image.cc#31">android13-release/runtime/image.c</a> */
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
};

View File

@ -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);
}
}

View File

@ -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"));

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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());

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/kitkat-release/runtime/image.cc#26">kitkat-release/runtime/image.c</a>
*/
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);

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/lollipop-release/runtime/image.cc#26">lollipop-release/runtime/image.c</a>
*/
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);

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/lollipop-mr1-wfc-release/runtime/image.cc#26">lollipop-mr1-wfc-release/runtime/image.c</a>
*/
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);

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/marshmallow-release/runtime/image.cc#26">marshmallow-release/runtime/image.c</a>
*/
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);

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/nougat-release/runtime/image.cc#26">nougat-release/runtime/image.c</a>
*/
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);

View File

@ -13,22 +13,19 @@
* 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.program.model.data.DataType;
import ghidra.program.model.data.Structure;
import ghidra.util.InvalidNameException;
import ghidra.util.exception.DuplicateNameException;
import ghidra.file.formats.android.art.image_method.ImageMethod_Nougat;
/**
* https://android.googlesource.com/platform/art/+/nougat-mr2-pixel-release/runtime/image.h
* <a href="https://android.googlesource.com/platform/art/+/nougat-mr2-pixel-release/runtime/image.cc#26">nougat-mr2-pixel-release/runtime/image.c</a>
*/
public class ArtHeader_NougatMR2Pixel extends ArtHeader_Nougat {
public class ArtHeader_030 extends ArtHeader_029 {
public ArtHeader_NougatMR2Pixel(BinaryReader reader) throws IOException {
public ArtHeader_030(BinaryReader reader) throws IOException {
super(reader);
}
@ -37,16 +34,4 @@ public class ArtHeader_NougatMR2Pixel extends ArtHeader_Nougat {
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;
}
}

View File

@ -13,22 +13,19 @@
* 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.headers;
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;
import ghidra.file.formats.android.art.image_method.ImageMethod_Oreo;
/**
* https://android.googlesource.com/platform/art/+/oreo-mr1-release/runtime/image.h
* <a href="https://android.googlesource.com/platform/art/+/oreo-release/runtime/image.cc#28">oreo-release/runtime/image.c</a>
*/
public class ArtHeader_OreoMR1 extends ArtHeader_Oreo {
public class ArtHeader_043 extends ArtHeader_030 {
public ArtHeader_OreoMR1(BinaryReader reader) throws IOException {
public ArtHeader_043(BinaryReader reader) throws IOException {
super(reader);
}
@ -37,16 +34,4 @@ public class ArtHeader_OreoMR1 extends ArtHeader_Oreo {
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;
}
}

View File

@ -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;
/**
* <a href="https://android.googlesource.com/platform/art/+/oreo-dr1-release/runtime/image.cc#28">oreo-dr1-release/runtime/image.c</a>
*/
public class ArtHeader_044 extends ArtHeader_043 {
public ArtHeader_044(BinaryReader reader) throws IOException {
super(reader);
}
}

View File

@ -0,0 +1,37 @@
/* ###
* 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;
import ghidra.file.formats.android.art.image_method.ImageMethod_Oreo;
/**
* <a href="https://android.googlesource.com/platform/art/+/oreo-mr1-release/runtime/image.cc#28">oreo-mr1-release/runtime/image.c</a>
*/
public class ArtHeader_046 extends ArtHeader_044 {
public ArtHeader_046(BinaryReader reader) throws IOException {
super(reader);
}
@Override
public int getArtMethodCountForVersion() {
return ImageMethod_Oreo.kImageMethodsCount.ordinal();
}
}

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/pie-release/runtime/image.cc#28">pie-release/runtime/image.c</a>
*/
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);

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/android10-release/runtime/image.cc#31">android10-release/runtime/image.c</a>
*/
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);

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/android11-release/runtime/image.cc#31">android11-release/runtime/image.c</a>
*/
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);

View File

@ -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;
/**
* <a href="https://android.googlesource.com/platform/art/+/android12-release/runtime/image.cc#31">android12-release/runtime/image.c</a>
*/
public class ArtHeader_099 extends ArtHeader_085 {
public ArtHeader_099(BinaryReader reader) throws IOException {
super(reader);
}
}

View File

@ -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;
/**
* <a href="https://android.googlesource.com/platform/art/+/android13-release/runtime/image.cc#31">android13-release/runtime/image.c</a>
*/
public class ArtHeader_106 extends ArtHeader_099 {
public ArtHeader_106(BinaryReader reader) throws IOException {
super(reader);
}
}

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/marshmallow-release/runtime/image.h#125">marshmallow-release/runtime/image.h</a>
*/
public enum ImageMethod_Marshmallow {
kResolutionMethod,

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/nougat-release/runtime/image.h#177">nougat-release/runtime/image.h</a>
*/
public enum ImageMethod_Nougat {
kResolutionMethod,

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/oreo-release/runtime/image.h#178">oreo-release/runtime/image.h</a>
*/
public enum ImageMethod_Oreo {
kResolutionMethod,

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/pie-release/runtime/image.h#194">pie-release/runtime/image.h</a>
*/
public enum ImageMethod_Pie {
kResolutionMethod,

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/android10-release/runtime/image.h#209">android10-release/runtime/image.h</a>
*/
public enum ImageMethod_10 {
public enum ImageMethod_Q {
kResolutionMethod,
kImtConflictMethod,
kImtUnimplementedMethod,

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/kitkat-release/runtime/image.h#91">kitkat-release/runtime/image.h</a>
*/
public enum ImageRoot_KitKat {
kResolutionMethod,

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/lollipop-release/runtime/image.h#105">lollipop-release/runtime/image.h</a>
*/
public enum ImageRoot_Lollipop {
kResolutionMethod,

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/lollipop-mr1-wfc-release/runtime/image.h#106">lollipop-mr1-wfc-release/runtime/image.h</a>
*/
public enum ImageRoot_LollipopMR1WRC {
kResolutionMethod,

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/marshmallow-release/runtime/image.h#125">marshmallow-release/runtime/image.h</a>
*/
public enum ImageRoot_Marshmallow {
kResolutionMethod,

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/nougat-release/runtime/image.h#187">nougat-release/runtime/image.h</a>
*/
public enum ImageRoot_Nougat {
kDexCaches, kClassRoots, kImageRootsMax,
kDexCaches,
kClassRoots,
kImageRootsMax,
}

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/oreo-release/runtime/image.h#189">oreo-release/runtime/image.h</a>
*/
public enum ImageRoot_Oreo {
kDexCaches,

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/pie-release/runtime/image.h#207">pie-release/runtime/image.h</a>
*/
public enum ImageRoot_Pie {
kDexCaches,

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/android10-release/runtime/image.h#222">android10-release/runtime/image.h</a>
*/
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;
}

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/android11-release/runtime/image.h#224">android11-release/runtime/image.h</a>
*/
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;
}

View File

@ -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;
/**
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/marshmallow-release/runtime/image.h#141">marshmallow-release/runtime/image.h</a>
*/
public class ImageSections_Marshmallow extends ArtImageSections {
public final static int kSectionObjects = 0;
public final static int kSectionArtFields = 1;

View File

@ -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;
/**
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/nougat-release/runtime/image.h#193">nougat-release/runtime/image.h</a>
*/
public class ImageSections_Nougat extends ArtImageSections {
public final static int kSectionObjects = 0;
public final static int kSectionArtFields = 1;

View File

@ -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;
/**
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/nougat-mr2-pixel-release/runtime/image.h#193">nougat-mr2-pixel-release/runtime/image.h</a>
*/
public class ImageSections_NougatMR2Pixel extends ArtImageSections {
public final static int kSectionObjects = 0;
public final static int kSectionArtFields = 1;

View File

@ -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;
/**
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/oreo-release/runtime/image.h#196">oreo-release/runtime/image.h</a>
*/
public class ImageSections_Oreo extends ArtImageSections {
public final static int kSectionObjects = 0;
public final static int kSectionArtFields = 1;

View File

@ -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;
/**
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/oreo-mr1-release/runtime/image.h#203">oreo-mr1-release/runtime/image.h</a>
*/
public class ImageSections_OreoMR1 extends ArtImageSections {
public final static int kSectionObjects = 0;
public final static int kSectionArtFields = 1;

View File

@ -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;
/**
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/pie-release/runtime/image.h#214">pie-release/runtime/image.h</a>
*/
public class ImageSections_Pie extends ArtImageSections {
public final static int kSectionObjects = 0;
public final static int kSectionArtFields = 1;

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/android10-release/runtime/image.h#254">android10-release/runtime/image.h</a>
*
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/android11-release/runtime/image.h#254">android11-release/runtime/image.h</a>
*/
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);
}

View File

@ -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
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/android12-release/runtime/image.h#254">android12-release/runtime/image.h</a>
*
* https://android.googlesource.com/platform/art/+/refs/heads/android-s-beta-4/runtime/image.h#254
* <a href="https://android.googlesource.com/platform/art/+/refs/heads/android13-release/runtime/image.h#254">android13-release/runtime/image.h</a>
*/
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);
}

View File

@ -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;
}
}

View File

@ -294,7 +294,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;
}