From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16478 invoked by alias); 15 Nov 2013 18:53:24 -0000 Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org Received: (qmail 16466 invoked by uid 89); 15 Nov 2013 18:53:24 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50,RDNS_NONE,URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: multi.imgtec.com Received: from Unknown (HELO multi.imgtec.com) (194.200.65.239) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 15 Nov 2013 18:53:19 +0000 Message-ID: <1384541575.2484.110.camel@ubuntu-sellcey> Subject: Re: [Patch, mips] Faster strcmp for mips From: Steve Ellcey To: Carlos O'Donell CC: "libc-ports@sourceware.org" Date: Fri, 15 Nov 2013 18:53:00 -0000 In-Reply-To: References: <1384464221.2484.86.camel@ubuntu-sellcey> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-SEF-Processed: 7_3_0_01192__2013_11_15_18_53_11 X-SW-Source: 2013-11/txt/msg00022.txt.bz2 On Fri, 2013-11-15 at 13:47 -0500, Carlos O'Donell wrote: > On Thu, Nov 14, 2013 at 4:23 PM, Steve Ellcey wrote: > > This means it could be loading bytes beyond the end of the strings being > > compared but it looks like other architecture specific strcmp functions > > are also doing this optimization and the newlib version of strcmp also does > > this. > > I thought that doing so was dangerous? I'm pretty sure we've been trying > to fix such "load bytes beyond the end of the string" issues because you > could have a string that straddles a page boundary with the next page > unmapped and such an optimized routine would fault on a read from the > unmapped page. > > How do you plan to fix that? > > Cheers, > Carlos. I think the assumption has been that if an aligned word contains at least one byte of the string, it is OK to read that entire word. I don't think a single aligned word (4 or 8 bytes depending on the architecture) can straddle a page boundary. If the word was unaligned, then I think it could straddle a page boundary and you could get into trouble. Steve Ellcey sellcey@mips.com