Subject: Re: Bugs in str* routines (pr port-pc532/7709, port-pc532/7710)
To: None <dlr@above.net>
From: Ian Dall <Ian.Dall@dsto.defence.gov.au>
List: port-pc532
Date: 06/06/1999 23:36:03
Dave Rand writes:
 > [In the message entitled "Re: Bugs in str* routines (pr port-pc532/7709, port-pc532/7710)" on Jun  6, 20:43, Ian Dall writes:]
 > > [...] That still leaves strcmp and strncmp which look
 > > a bit harder if the end of page problem is to be avoided.
 > > 
 > 
 > There is no way (in general) to fix the EoP problem.

It is always solvable, but at what cost?  The current code double word
aligns s2. We can now test s1 each time around the cmpd loop to ensure
it doesn't cross a page. The comparison value can be computed outside
the inner loop. We then tip toe across the page boundary, byte at a
time for a maximum of 4 bytes and repeat until done. So at the cost of
one more cmpd and bne inside the inner loop and quite a bit more
complexity, it can be done!

Do you recall how *much* faster your method is cf a naive cmpsb
implimentation?

 > In other companies,
 > this was 'fixed' in the kernel by always allocating n+1 pages for the
 > .bss and data areas.

Er, yuck!

Ian