From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 E8CE221962301 for ; Mon, 19 Nov 2018 14:12:34 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 781C131256AE; Mon, 19 Nov 2018 22:12:34 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-188.rdu2.redhat.com [10.10.120.188]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF1465D73F; Mon, 19 Nov 2018 22:12:32 +0000 (UTC) To: Andrew Fish , Jordan Justen Cc: Mike Kinney , Liu Yu , "edk2-devel@lists.01.org" , Leif Lindholm References: <154253322290.3729.10762860453718631884@jljusten-skl> <81FDCF97-4145-4A7D-93B9-70A4D8B505FF@apple.com> <154259000092.7306.2206833534307673295@jljusten-skl> <154265500096.11985.13073430907870235751@jljusten-skl> From: Laszlo Ersek Message-ID: <69b2d50f-3aec-186e-61ae-b8f7ab8f143e@redhat.com> Date: Mon, 19 Nov 2018 23:12:31 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Mon, 19 Nov 2018 22:12:34 +0000 (UTC) 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, 19 Nov 2018 22:12:35 -0000 Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Jordan wrote: >>> So, is it safe to adjust rbp? Unknown. It may not be if rbp is not >>> used as a frame pointer. Is it safe to *not* adjust rbp and >>> potentially allow the old temp ram stack to be used? Unknown. Andrew wrote: > Looks like OvmfPkg uses SetJump()/LongJump() to change the stack. > > // > // Use SetJump()/LongJump() to switch to a new stack. > // > if (SetJump (&JumpBuffer) == 0) { > #if defined (MDE_CPU_IA32) > JumpBuffer.Esp = JumpBuffer.Esp + DebugAgentContext.StackMigrateOffset; > JumpBuffer.Ebp = JumpBuffer.Ebp + DebugAgentContext.StackMigrateOffset; > #endif > #if defined (MDE_CPU_X64) > JumpBuffer.Rsp = JumpBuffer.Rsp + DebugAgentContext.StackMigrateOffset; > JumpBuffer.Rbp = JumpBuffer.Rbp + DebugAgentContext.StackMigrateOffset; > #endif > LongJump (&JumpBuffer, (UINTN)-1); > } > > SaveAndSetDebugTimerInterrupt (OldStatus); > > return EFI_SUCCESS; > } > > But given the above code is C code RBP is going to be restored on return. This would seem to imply that the adjusting of the callers RBP is not required? [...] The Ebp/Rbp assignments were added in a separate bugfix, namely https://github.com/tianocore/edk2/commit/89796c69d9fd Laszlo