Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Sep 2022 16:48:22 +0200
From:      =?UTF-8?B?VMSzbA==?= Coosemans <tijl@FreeBSD.org>
To:        Konstantin Belousov <kostikbel@gmail.com>
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:  <20220902164822.205e5089@FreeBSD.org>
In-Reply-To: <YxINp1f3qQzylSBd@kib.kiev.ua>
References:  <202208241925.27OJPCm0069172@gitrepo.freebsd.org> <20220902150231.3ad4f16d@FreeBSD.org> <YxINp1f3qQzylSBd@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 2 Sep 2022 17:05:27 +0300 Konstantin Belousov
<kostikbel@gmail.com> wrote:
> On Fri, Sep 02, 2022 at 03:02:31PM +0200, T=C4=B3l Coosemans wrote:
>> On Wed, 24 Aug 2022 19:25:12 GMT Konstantin Belousov <kib@FreeBSD.org>
>> wrote:
>>> The branch main has been updated by kib:
>>>=20
>>> URL: https://cgit.FreeBSD.org/src/commit/?id=3De8b2980e4a126407e15d33ee=
8d987385c8321261
>>>=20
>>> commit e8b2980e4a126407e15d33ee8d987385c8321261
>>> Author:     Konstantin Belousov <kib@FreeBSD.org>
>>> AuthorDate: 2022-08-18 04:07:29 +0000
>>> Commit:     Konstantin Belousov <kib@FreeBSD.org>
>>> CommitDate: 2022-08-24 19:12:05 +0000
>>>=20
>>>     i386 doreti: stop saving/restoring %ecx around calls into C
>>>    =20
>>>     There is no reason to do this.  Instead just calculate it later.
>>>    =20
>>>     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(-)
>>>=20
>>> 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 =20
>>=20
>> Shouldn't this be "subl %ecx, %edx"? =20
>=20
> You are right, please fix.

Fixed in cfdc649e455b.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20220902164822.205e5089>