From nobody Fri Sep 02 14:05:27 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MK07B46nMz4ZfwR; Fri, 2 Sep 2022 14:05:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4MK07945nwz3DVN; Fri, 2 Sep 2022 14:05:41 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 282E5RYF040555 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 2 Sep 2022 17:05:31 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 282E5RUB040554; Fri, 2 Sep 2022 17:05:27 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 2 Sep 2022 17:05:27 +0300 From: Konstantin Belousov To: =?utf-8?Q?T=C4=B3l?= Coosemans Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: e8b2980e4a12 - main - i386 doreti: stop saving/restoring %ecx around calls into C Message-ID: References: <202208241925.27OJPCm0069172@gitrepo.freebsd.org> <20220902150231.3ad4f16d@FreeBSD.org> List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220902150231.3ad4f16d@FreeBSD.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on tom.home X-Rspamd-Queue-Id: 4MK07945nwz3DVN X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-1.95 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.993]; NEURAL_HAM_SHORT(-0.96)[-0.960]; MIME_GOOD(-0.10)[text/plain]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; FROM_EQ_ENVFROM(0.00)[]; MLMMJ_DEST(0.00)[dev-commits-src-all@freebsd.org,dev-commits-src-main@freebsd.org]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; R_SPF_SOFTFAIL(0.00)[~all:c]; RCPT_COUNT_THREE(0.00)[4]; FROM_HAS_DN(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FREEMAIL_FROM(0.00)[gmail.com]; HAS_XAW(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ARC_NA(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On Fri, Sep 02, 2022 at 03:02:31PM +0200, Tijl Coosemans wrote: > On Wed, 24 Aug 2022 19:25:12 GMT Konstantin Belousov > wrote: > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=e8b2980e4a126407e15d33ee8d987385c8321261 > > > > commit e8b2980e4a126407e15d33ee8d987385c8321261 > > Author: Konstantin Belousov > > AuthorDate: 2022-08-18 04:07:29 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2022-08-24 19:12:05 +0000 > > > > i386 doreti: stop saving/restoring %ecx around calls into C > > > > There is no reason to do this. Instead just calculate it later. > > > > Reviewed by: jhb > > Tested by: pho > > Sponsored by: The FreeBSD Foundation > > MFC after: 1 week > > Differential revision: https://reviews.freebsd.org/D36302 > > --- > > sys/i386/i386/exception.s | 17 ++++++++--------- > > 1 file changed, 8 insertions(+), 9 deletions(-) > > > > diff --git a/sys/i386/i386/exception.s b/sys/i386/i386/exception.s > > index 5eef9c1d512c..8279a4602ebf 100644 > > --- a/sys/i386/i386/exception.s > > +++ b/sys/i386/i386/exception.s > > @@ -518,22 +518,21 @@ doreti_exit: > > je doreti_iret_nmi > > cmpl $T_TRCTRAP, TF_TRAPNO(%esp) > > je doreti_iret_nmi > > - movl $TF_SZ, %ecx > > testl $PSL_VM,TF_EFLAGS(%esp) > > - jz 1f /* PCB_VM86CALL is not set */ > > - addl $VM86_STACK_SPACE, %ecx > > - jmp 2f > > -1: testl $SEL_RPL_MASK, TF_CS(%esp) > > + jnz 1f /* PCB_VM86CALL is not set */ > > + testl $SEL_RPL_MASK, TF_CS(%esp) > > jz doreti_popl_fs > > -2: movl $handle_ibrs_exit,%eax > > - pushl %ecx /* preserve enough call-used regs */ > > +1: movl $handle_ibrs_exit,%eax > > call *%eax > > movl mds_handler,%eax > > call *%eax > > - popl %ecx > > movl %esp, %esi > > movl PCPU(TRAMPSTK), %edx > > - subl %ecx, %edx > > + movl $TF_SZ, %ecx > > + testl $PSL_VM,TF_EFLAGS(%esp) > > + jz 2f /* PCB_VM86CALL is not set */ > > + addl $VM86_STACK_SPACE, %ecx > > +2: subl $TF_SZ, %edx > > Shouldn't this be "subl %ecx, %edx"? You are right, please fix.