Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Mar 2005 17:34:18 +0200
From:      Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   i386/79091: Small optimization for i386/support.s
Message-ID:  <20050321153418.GA461@pm514-9.comsys.ntu-kpi.kiev.ua>
Resent-Message-ID: <200503211540.j2LFe2eb084519@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         79091
>Category:       i386
>Synopsis:       Small optimization for i386/support.s
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-i386
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 21 15:40:02 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Andrey Simonenko
>Release:        FreeBSD 5.3-RELEASE-p5 i386
>Organization:
>Environment:

>Description:

suword(), suword16(), subyte() and copyinstr() from i386/support.s
restore "trashed" register %ecx, but this register is not really
trashed in case of non I386_CPU in su*() functions and in copyinstr().

The same situation with the same functions in amd64/support.S.

And the same situation with 4.x, 5.x and HEAD.

>How-To-Repeat:

>Fix:

--- support.s.orig	Sat Nov 13 11:29:48 2004
+++ support.s	Fri Mar 18 14:00:56 2005
@@ -1327,7 +1327,9 @@
 	movl	8(%esp),%eax
 	movl	%eax,(%edx)
 	xorl	%eax,%eax
-	movl	PCPU(CURPCB),%ecx
+#ifdef I386_CPU
+	movl	PCPU(CURPCB),%ecx		/* restore trashed register */
+#endif
 	movl	%eax,PCB_ONFAULT(%ecx)
 	ret
 
@@ -1370,7 +1372,9 @@
 	movw	8(%esp),%ax
 	movw	%ax,(%edx)
 	xorl	%eax,%eax
+#ifdef I386_CPU
 	movl	PCPU(CURPCB),%ecx		/* restore trashed register */
+#endif
 	movl	%eax,PCB_ONFAULT(%ecx)
 	ret
 
@@ -1412,7 +1416,9 @@
 	movb	8(%esp),%al
 	movb	%al,(%edx)
 	xorl	%eax,%eax
+#ifdef I386_CPU
 	movl	PCPU(CURPCB),%ecx		/* restore trashed register */
+#endif
 	movl	%eax,PCB_ONFAULT(%ecx)
 	ret
 
@@ -1475,7 +1481,6 @@
 
 cpystrflt_x:
 	/* set *lencopied and return %eax */
-	movl	PCPU(CURPCB),%ecx
 	movl	$0,PCB_ONFAULT(%ecx)
 	movl	20(%esp),%ecx
 	subl	%edx,%ecx
>Release-Note:
>Audit-Trail:
>Unformatted:
 To: FreeBSD-gnats-submit@freebsd.org
 From: Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
 Reply-To: Andrey Simonenko <simon@comsys.ntu-kpi.kiev.ua>
 Cc: 
 X-send-pr-version: 3.113
 X-GNATS-Notify: 
 
 



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