diff options
| author | 2015-11-09 15:16:56 -0800 | |
|---|---|---|
| committer | 2015-11-09 17:18:58 -0800 | |
| commit | 42bddcec51e71d206f6d3b30a881ee6c1d50a63c (patch) | |
| tree | 2035b4dd7dcbefbe83c04d41987e520eeb8798f0 /patchoat/patchoat.cc | |
| parent | 78232f2482e71fef255796633da68bb769baa93a (diff) | |
Add low_4gb support to MapFile and MapFileAtAddress
Motivation is to use this for loading app images in low 4GB at a
non fixed address.
Added test.
Bug: 22858531
Change-Id: I0f79a4a7bfbfbdfc112e41b25c8682b1fb932ab7
Diffstat (limited to 'patchoat/patchoat.cc')
| -rw-r--r-- | patchoat/patchoat.cc | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/patchoat/patchoat.cc b/patchoat/patchoat.cc index 88622ccc9b..64b4722904 100644 --- a/patchoat/patchoat.cc +++ b/patchoat/patchoat.cc @@ -177,8 +177,12 @@ bool PatchOat::Patch(const std::string& image_location, off_t delta, t.NewTiming("Image and oat Patching setup"); // Create the map where we will write the image patches to. std::string error_msg; - std::unique_ptr<MemMap> image(MemMap::MapFile(image_len, PROT_READ | PROT_WRITE, MAP_PRIVATE, - input_image->Fd(), 0, + std::unique_ptr<MemMap> image(MemMap::MapFile(image_len, + PROT_READ | PROT_WRITE, + MAP_PRIVATE, + input_image->Fd(), + 0, + /*low_4gb*/false, input_image->GetPath().c_str(), &error_msg)); if (image.get() == nullptr) { @@ -187,8 +191,7 @@ bool PatchOat::Patch(const std::string& image_location, off_t delta, } gc::space::ImageSpace* ispc = Runtime::Current()->GetHeap()->GetImageSpace(); - PatchOat p(isa, image.release(), ispc->GetLiveBitmap(), ispc->GetMemMap(), - delta, timings); + PatchOat p(isa, image.release(), ispc->GetLiveBitmap(), ispc->GetMemMap(), delta, timings); t.NewTiming("Patching files"); if (!p.PatchImage()) { LOG(ERROR) << "Failed to patch image file " << input_image->GetPath(); @@ -273,8 +276,12 @@ bool PatchOat::Patch(File* input_oat, const std::string& image_location, off_t d t.NewTiming("Image and oat Patching setup"); // Create the map where we will write the image patches to. std::string error_msg; - std::unique_ptr<MemMap> image(MemMap::MapFile(image_len, PROT_READ | PROT_WRITE, MAP_PRIVATE, - input_image->Fd(), 0, + std::unique_ptr<MemMap> image(MemMap::MapFile(image_len, + PROT_READ | PROT_WRITE, + MAP_PRIVATE, + input_image->Fd(), + 0, + /*low_4gb*/false, input_image->GetPath().c_str(), &error_msg)); if (image.get() == nullptr) { |