From owner-cvs-all Thu May 23 9:31: 9 2002 Delivered-To: cvs-all@freebsd.org Received: from mail.speakeasy.net (mail13.speakeasy.net [216.254.0.213]) by hub.freebsd.org (Postfix) with ESMTP id C5CAF37B40B for ; Thu, 23 May 2002 09:31:00 -0700 (PDT) Received: (qmail 1526 invoked from network); 23 May 2002 16:30:59 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) by mail13.speakeasy.net (qmail-ldap-1.03) with DES-CBC3-SHA encrypted SMTP for ; 23 May 2002 16:30:59 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.11.6/8.11.6) with ESMTP id g4NGUwF04726; Thu, 23 May 2002 12:30:58 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.2 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <20020523085032.R25907@stylus.haikugeek.com> Date: Thu, 23 May 2002 12:30:37 -0400 (EDT) From: John Baldwin To: Jonathan Mini Subject: Re: cvs commit: src/sys/kern kern_mutex.c Cc: Peter Jeremy , cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On 23-May-2002 Jonathan Mini wrote: > John Baldwin [jhb@FreeBSD.org] wrote : > >> >> On 23-May-2002 Jonathan Mini wrote: >> > John Baldwin [jhb@FreeBSD.org] wrote : >> > >> >> In Intel's documentation they said that all current look-alikes worked as >> >> well. It's the opcode for 'rep mov'. I am curious if some implementations >> >> trash %ecx, and if we are paranoid we could always clobber %ecx in the >> >> constraints. [ ... ] >> > >> > The rep prefix doesn't modify any registers. You do need to make >> > sure that %ecx was zero when you dispatch a rep mov (unles you're >> > dispatching a rep mov $0, %ecx), or you'll get an infinite loop. >> >> Bah, it's rep nop, not rep mov. > > Ahh. rep nop makes a lot more sense. > >> rep does modify %ecx when used with, say >> string instructions. It decrements %[e]cx once for each interation. > > Um.. no. It's the string instruction that decrements cx. rep just, well, > repeats. =) Umm no. String instructions modify %esi and %edi. See http://people.freebsd.org/~jhb/386htm/LODS.htm for example. If the string instructions modified %ecx, then code like this wouldn't work: # # Send up to CX bytes of a null-terminated string at DS:[SI] out to port DX. # spew: lodsb or %al,%al jz exit outsb loop spew exit: ret However, the text at http://people.freebsd.org/~jhb/386htm/REP.htm is a bit ambiguous. It seems to indicate that REP is only defined when used with string instructions. From this reading I think 'rep nop' probably is supposed to be an undefined operation and I'm actually kind of surprised it doesn't trigger an illegal instruction fault to be honest. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message