From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.111.4.26; helo=out2-smtp.messagingengine.com; envelope-from=marco.guerri.dev@fastmail.com; receiver=edk2-devel@lists.01.org Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (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 98AA222344352 for ; Sun, 21 Jan 2018 12:51:26 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 6BF0620A59; Sun, 21 Jan 2018 15:56:51 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Sun, 21 Jan 2018 15:56:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=AtVvf7ZvedGdb4KQN4iCdMYtuQDk0 x/PFM8x7LpwBGg=; b=L2Q0T2DKnIMeeUnOndHKt5Tys6zdZDA+MZrvhgVh72NX2 h/RRhqryud88zRkrYFn6ybcKuiVhG0T+ROIIPmJPBSzy5JR3sL65rYhoFF98GYZF mRioTPp9KVAzayDTLj6cIsTrc9qP7fvFmbwdST1jko6ZCYPRmlZLnSs0kmgEnR96 YmBgNL32rLT5aEg8Og+JKhTp9yW6El3IjutmqtLqSHNhRNJHiZCrxiu99jDir0GL juCRtXCWvfBce3Ytzym1vPVdyMdJcGDDRZyTdMQZzaq5TKBefQLbqcNOvrzjSunI U2mXYDMUvdTgZ0BE24QQpkc6IPXJzlZbfX2ms5aeA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=AtVvf7 ZvedGdb4KQN4iCdMYtuQDk0x/PFM8x7LpwBGg=; b=nHDXSQm6jrc15AuuoWoU/x dnxLjWMJNrJpNGS1ESaD2Ct7H3mXPJLJ2ga8mM3QhZe5tpLWstJRMbwFd8IaLM4L 32Zk63PVEvssOLJVRyGrE/qf810nvtdl75CjbnKpnNjdXo0LnjzuV0/92dhizEee zfYus4fYfEqZkUn5OAi+R1/4Fql0XBq96xPH5IN61E8WCWwVQLr/2MO0AiPyMLSs 3sdgcBYNXvo4Y4pWjhO/a2bHBNIoHaKnDcZrgo8V5y9fXdGqjNOTIhuodaWC0Oot YK4por+YMBn0g/Py/g2r7Jqp7Xc8/c+axR0rEVVO9P7x5gpDMQuSib0/IpK4CCew == X-ME-Sender: Received: from alan (unknown [37.228.248.90]) by mail.messagingengine.com (Postfix) with ESMTPA id A2BFD7E2E6; Sun, 21 Jan 2018 15:56:50 -0500 (EST) Date: Sun, 21 Jan 2018 15:56:32 +0000 From: Marco Guerri To: "Daryl McDaniel (EDK2 Lists)" Cc: 'Marco Guerri' , edk2-devel@lists.01.org Message-ID: <20180121155632.GA667@alan> References: <026e01d3907f$82953820$87bfa860$@mc2research.org> <1516296479.3148418.1240030384.210CDE2C@webmail.messagingengine.com> <03db01d39191$25dcd030$71967090$@mc2research.org> MIME-Version: 1.0 In-Reply-To: <03db01d39191$25dcd030$71967090$@mc2research.org> User-Agent: Mutt/1.7.2 (2016-11-26) Subject: Re: [tianocore/edk2] Stdlib: Add calling convention to completion callbacks (#123) X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Jan 2018 20:51:27 -0000 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Hi Daryl, Thank you for your feedback. However, I must admit I don't completely follow your argument. Could you please elaborate on that? I assume we agree that those callbacks must explicitly use ms_abi calling convention when compiled with gcc, and the way to do this is by adding __attribute__((ms_abi)) to the signature, which the build system does via EFIAPI macro (and several other functions of the StdLib do so). The build system supports up to GCC5, and gcc 5.4 is what it was tested with (admittedly, I didn't have clang nor a Windows system available, so my test plan was not very comprehensive). Thank you, Marco On Fri 19/01 17:51, Daryl McDaniel (EDK2 Lists) wrote: > Marco, > > > > The tools definitions for the newer versions of GCC must not be setting the option to force the EFIAPI calling conventions. > > We relied upon the compiler option for StdLib in order to enhance portability for POSIX sources. > > > > I’ll research what the tools definitions are for the newer GCC versions then readdress your patches. > > > > Thank you, > > Daryl McDaniel > > > > > > From: Marco Guerri [mailto:marco.guerri.dev@fastmail.com] > Sent: Thursday, January 18, 2018 9:28 AM > To: Daryl McDaniel (EDK2 Lists) ; edk2-devel@lists.01.org > Subject: Re: [tianocore/edk2] Stdlib: Add calling convention to completion callbacks (#123) > > > > Hi Daryl, > > > > First, sorry for not having RTFM and submitting the patch via github. I was planning to read your workflow during the weekend and re-submit via the mailing list. > > > > Second, I am using gcc. I tried gcc 4.8 and 5.2 and with both, my applications using Stdlib badly hang. I dug a bit and discovered that the signatures of the completion callbacks are missing EFIAPI, so necessarily under Unix systems they are using the wrong ABI. When the functions arguments are pointers, the machine ends up in a triple fault I guess (I can clearly see that the first two integer parameters are fetched from %rdi and %rsi, which is the SysV ABI). I was a bit surprised to see this bug, as the buildscripts are pretty comprehensive in terms of compilers support. Does this make sense to you? > > > > Cheers, > > Marco > > > > -- > > Marco Guerri > > marco.guerri.dev@fastmail.com > > > > > > > > On Thu, Jan 18, 2018, at 11:12 AM, Daryl McDaniel (EDK2 Lists) wrote: > > Marco, > > > > Thank you for your submission. > > > > Can you please tell me which compiler you are using? > > > > Thank you, > > Daryl McDaniel > > > > > > From: Marco Guerri [mailto:notifications@github.com] > Sent: Wednesday, January 17, 2018 7:22 AM > To: tianocore/edk2 > > Cc: Subscribed > > Subject: [tianocore/edk2] Stdlib: Add calling convention to completion callbacks (#123) > > > > When compiling in Unix environments, the ABI defaults to SysV. > Callbacks are invoked directly by the system firmware so they > must necessarily use MS ABI. > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Marco Guerri marco.guerri.dev@fastmail.com > > > _____ > > > > > > You can view, comment on, or merge this pull request online at: > > > https://github.com/tianocore/edk2/pull/123 > > > Commit Summary > > > * Stdlib: Add calling convention to completion callbacks > > > File Changes > > > * M StdLib/EfiSocketLib/Ip4.c (10) > * M StdLib/EfiSocketLib/Socket.h (24) > * M StdLib/EfiSocketLib/Tcp4.c (11) > * M StdLib/EfiSocketLib/Tcp6.c (3) > * M StdLib/EfiSocketLib/Udp4.c (30) > * M StdLib/EfiSocketLib/Udp6.c (20) > > > Patch Links: > > > * https://github.com/tianocore/edk2/pull/123.patch > * https://github.com/tianocore/edk2/pull/123.diff > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub , or mute the thread . > > >