From owner-freebsd-arm@FreeBSD.ORG Tue Apr 28 14:02:16 2009 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 978271065674; Tue, 28 Apr 2009 14:02:16 +0000 (UTC) (envelope-from channa.kad@gmail.com) Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.31]) by mx1.freebsd.org (Postfix) with ESMTP id 3A8B88FC15; Tue, 28 Apr 2009 14:02:16 +0000 (UTC) (envelope-from channa.kad@gmail.com) Received: by yw-out-2324.google.com with SMTP id 9so352011ywe.13 for ; Tue, 28 Apr 2009 07:02:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=UjrVtFHy+3aOvNfXgN/xMfgDn44mFfEbR+KNZtdTbSg=; b=iQkmxH7EhXB/JA0OL+k6dfIVuYg0C5SVN/G8v2KsbZU0acQTTOOJxC/qv7jnDf7Tmy rfRg9WONjzM83J1ooQopsCBRcMZe2qz25cXN73aZBHuvnlvQpdKT+ejElVCjVIL3YpW3 hNtVzAPDDdxyjUAqLcIkZqvqs98bjACmY3jzc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=BO79ysnyUUOWEZOTPUux04c3opnwFvbEvsB+z0wx7f6ya/807t95bXFWUBXRp0pvgI F0wQl2iaEyr0t/XZVT8CyY4ZkqwfoS5zTgSJhNImetmoLTPzk6ibCSPmXDLszUhcvJen 1sUuAXD/XsEUNQ39yMV+iTWyrd38g/Q5Vfsj0= MIME-Version: 1.0 Received: by 10.100.163.15 with SMTP id l15mr5916143ane.22.1240927335326; Tue, 28 Apr 2009 07:02:15 -0700 (PDT) In-Reply-To: <20090428121255.GA99020@ci0.org> References: <515c64960904280252sc9fe2afy24e8db8ab13b13e4@mail.gmail.com> <1240918262.85945.1.camel@buffy.york.ac.uk> <20090428115510.GA98699@ci0.org> <515c64960904280459p3c2ef8bdu3600157eb0c47bcc@mail.gmail.com> <20090428121255.GA99020@ci0.org> Date: Tue, 28 Apr 2009 19:32:14 +0530 Message-ID: <515c64960904280702s5e29f916s5e03564adf96f9b0@mail.gmail.com> From: Channa To: Olivier Houchard Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-arm@freebsd.org, Gavin Atkinson Subject: Re: strncmp issue X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Apr 2009 14:02:16 -0000 Hi, Thank you very much for your response. I am looking forward for your fix. Thanks & Regards, Channa 2009/4/28 Olivier Houchard : > On Tue, Apr 28, 2009 at 05:29:28PM +0530, Channa wrote: >> 2009/4/28 Olivier Houchard : >> >> On Tue, 2009-04-28 at 15:22 +0530, Channa wrote: >> >> > Hi, >> >> > >> >> > I am using the freebsd implementation of strncmp for ARM which is an >> >> > assembly implementation. >> >> > I have a small doubt, when i tested the strncmp by passing the third argument: >> >> > 'n' as -1 the return values is ?'0' instead it should '-1'. >> >> > When the third argument ?to strncmp is as below: >> >> > >> >> > ret = strncmp("a","b",-1) >> >> > >> >> > I think the assembly implementation in >> >> > src/lib/libc/arm/string/strncmp.S file needs >> >> > to be modified to take care of the above condition. >> >> > >> >> > In the current implementation >> >> > /* if ((len - 1) < 0) return 0 */ >> >> > ? ? ? ? subs ? ?r2, r2, #1 >> >> > ? ? ? ? movmi ? r0, #0 >> >> > ? ? ? ? RETc(mi) >> >> > >> >> > This should be changed to check as below >> >> > >> >> > /* if ((len ) < 0) return 0 */ >> >> > /* Assembly code here */ >> >> > >> >> > Could anyone help in solving the above issue.? >> >> > >> > >> > Hi, >> > >> > This shouldn't be an issue, as the second argument of strncmp is unsigned, >> > -1 is not a valid value. >> > >> > Regards, >> > >> > Olivier >> > >> Hi, >> Thanks for the reply. >> True the third argument of strncmp is unsigned but the return value in >> the below call to strncmp >> >> ret = strncmp("a","b",-1) >> >> is '0' but it should be -1 i suppose. >> >> Please let me know if anything is wrong. >> > > True, sorry. > I'll fix this later today, thanks a lot for reporting ! > > Regards, > > Olivier >