Revert "Revert "Load app images""
This reverts commit 1bc977cf2f8199311a97f2ba9431a184540e3e9c.
Bug: 22858531
Change-Id: Ide00bf3a73a02cba3bb364177204ad1b13f70295
diff --git a/runtime/image.h b/runtime/image.h
index 7418f66..b3f177b 100644
--- a/runtime/image.h
+++ b/runtime/image.h
@@ -93,10 +93,15 @@
oat_data_begin_(0U),
oat_data_end_(0U),
oat_file_end_(0U),
+ boot_image_begin_(0U),
+ boot_image_size_(0U),
+ boot_oat_begin_(0U),
+ boot_oat_size_(0U),
patch_delta_(0),
image_roots_(0U),
pointer_size_(0U),
compile_pic_(0),
+ is_pic_(0),
storage_mode_(kDefaultStorageMode),
data_size_(0) {}
@@ -109,8 +114,13 @@
uint32_t oat_data_begin,
uint32_t oat_data_end,
uint32_t oat_file_end,
+ uint32_t boot_image_begin,
+ uint32_t boot_image_size,
+ uint32_t boot_oat_begin,
+ uint32_t boot_oat_size,
uint32_t pointer_size,
bool compile_pic,
+ bool is_pic,
StorageMode storage_mode,
size_t data_size);
@@ -208,11 +218,33 @@
SHARED_REQUIRES(Locks::mutator_lock_);
void RelocateImage(off_t delta);
+ void RelocateImageMethods(off_t delta);
+ void RelocateImageObjects(off_t delta);
bool CompilePic() const {
return compile_pic_ != 0;
}
+ bool IsPic() const {
+ return is_pic_ != 0;
+ }
+
+ uint32_t GetBootImageBegin() const {
+ return boot_image_begin_;
+ }
+
+ uint32_t GetBootImageSize() const {
+ return boot_image_size_;
+ }
+
+ uint32_t GetBootOatBegin() const {
+ return boot_oat_begin_;
+ }
+
+ uint32_t GetBootOatSize() const {
+ return boot_oat_size_;
+ }
+
StorageMode GetStorageMode() const {
return storage_mode_;
}
@@ -221,6 +253,12 @@
return data_size_;
}
+ bool IsAppImage() const {
+ // App images currently require a boot image, if the size is non zero then it is an app image
+ // header.
+ return boot_image_size_ != 0u;
+ }
+
private:
static const uint8_t kImageMagic[4];
static const uint8_t kImageVersion[4];
@@ -250,6 +288,16 @@
// .so files. Used for positioning a following alloc spaces.
uint32_t oat_file_end_;
+ // Boot image begin and end (app image headers only).
+ uint32_t boot_image_begin_;
+ uint32_t boot_image_size_;
+
+ // Boot oat begin and end (app image headers only).
+ uint32_t boot_oat_begin_;
+ uint32_t boot_oat_size_;
+
+ // TODO: We should probably insert a boot image checksum for app images.
+
// The total delta that this image has been patched.
int32_t patch_delta_;
@@ -262,10 +310,15 @@
// Boolean (0 or 1) to denote if the image was compiled with --compile-pic option
const uint32_t compile_pic_;
+ // Boolean (0 or 1) to denote if the image can be mapped at a random address, this only refers to
+ // the .art file. Currently, app oat files do not depend on their app image. There are no pointers
+ // from the app oat code to the app image.
+ const uint32_t is_pic_;
+
// Image section sizes/offsets correspond to the uncompressed form.
ImageSection sections_[kSectionCount];
- // Image methods.
+ // Image methods, may be inside of the boot image for app images.
uint64_t image_methods_[kImageMethodsCount];
// Storage method for the image, the image may be compressed.