From 42bddcec51e71d206f6d3b30a881ee6c1d50a63c Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Mon, 9 Nov 2015 15:16:56 -0800 Subject: 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 --- patchoat/patchoat.cc | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'patchoat/patchoat.cc') 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 image(MemMap::MapFile(image_len, PROT_READ | PROT_WRITE, MAP_PRIVATE, - input_image->Fd(), 0, + std::unique_ptr 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 image(MemMap::MapFile(image_len, PROT_READ | PROT_WRITE, MAP_PRIVATE, - input_image->Fd(), 0, + std::unique_ptr 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) { -- cgit v1.2.3-59-g8ed1b