From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.24; helo=mga09.intel.com; envelope-from=ray.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2F691202E53A2 for ; Sun, 17 Feb 2019 18:22:25 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Feb 2019 18:22:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,382,1544515200"; d="scan'208";a="144292132" Received: from ray-dev.ccr.corp.intel.com (HELO [10.239.9.31]) ([10.239.9.31]) by fmsmga002.fm.intel.com with ESMTP; 17 Feb 2019 18:22:23 -0800 To: Jordan Justen , Andrew Fish , Laszlo Ersek , Liu Yu Cc: "edk2-devel@lists.01.org" References: <1274938c-dfdb-d6da-8caa-9fc6674eb1b1@Intel.com> <155030827034.1052.16419444135424097946@jljusten-skl> From: "Ni, Ray" Message-ID: <848819df-1225-3660-00af-80bf95122ae6@Intel.com> Date: Mon, 18 Feb 2019 10:25:01 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <155030827034.1052.16419444135424097946@jljusten-skl> Subject: Re: EmulatorPkg Unix Host Segmentation fault. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Feb 2019 02:22:25 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Jordan, > Study the PeiCore migration logic a bit more, I found since PeiCore > knows the exact size of new stack in permanent memory, it migrates > old stack to the top of new stack. > But the migration logic in above C code (since it doesn't know the > size of new stack, CopySize is the size of temporary memory) may copy > the old stack to the middle in new stack. Maybe your new RamMigration2 PPI needs to carry both the old and new stack/heap location and size. It helps: 1. migrate the old stack to top of new stack (instead of middle of new stack). 2. potentially reduce the size of memory that needs to be copied. TemporaryRamMigration ( IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PHYSICAL_ADDRESS TemporaryStackBase, IN EFI_PHYSICAL_ADDRESS PermanentStackSize, IN EFI_PHYSICAL_ADDRESS TemporaryHeapBase, IN EFI_PHYSICAL_ADDRESS PermanentHeapSize, IN TEMPORARY_RAM_MIGRATION_CALLBACK Callback, IN VOID *Context ) Before the finalize of PI spec change regarding the RamMigration2 change, I prefer to fix the EmulatorPkg boot crash ASAP using the OVMF-like solution. If you agree, I will send out the patch to let you review. -- Thanks, Ray