1997-04-01 00:37  Ulrich Drepper  <drepper@cygnus.com>

	* math/Makefile: Prevent inlining for test-{float,double,longdouble}.
	* math/libm-test.c (initialize): Make strings unique and force
	values to memory.

	* posix/regex.c: Debug debugging code.

	* sysdeps/i386/asm-syntax.h: Define `L' macro to emit correct
	syntax for local label.
	* sysdeps/i386/add_n.S: Use correct local label syntax for the
	binary format.
	* sysdeps/i386/addmul_1.S: Likewise.
	* sysdeps/i386/lshift.S: Likewise.
	* sysdeps/i386/memchr.S: Likewise.
	* sysdeps/i386/memset.S: Likewise.
	* sysdeps/i386/mul_1.S: Likewise.
	* sysdeps/i386/rshift.S: Likewise.
	* sysdeps/i386/stpcpy.S: Likewise.
	* sysdeps/i386/stpncpy.S: Likewise.
	* sysdeps/i386/strchr.S: Likewise.
	* sysdeps/i386/strcspn.S: Likewise.
	* sysdeps/i386/strlen.S: Likewise.
	* sysdeps/i386/strpbrk.S: Likewise.
	* sysdeps/i386/strrchr.S: Likewise.
	* sysdeps/i386/strspn.S: Likewise.
	* sysdeps/i386/strtok.S: Likewise.
	* sysdeps/i386/sub_n.S: Likewise.
	* sysdeps/i386/submul_1.S: Likewise.
	* sysdeps/i386/i486/strcat.S: Likewise.
	* sysdeps/i386/i486/strlen.S: Likewise.
	* sysdeps/i386/i586/add_n.S: Likewise.
	* sysdeps/i386/i586/addmul_1.S: Likewise.
	* sysdeps/i386/i586/lshift.S: Likewise.
	* sysdeps/i386/i586/memset.S: Likewise.
	* sysdeps/i386/i586/mul_1.S: Likewise.
	* sysdeps/i386/i586/rshift.S: Likewise.
	* sysdeps/i386/i586/strchr.S: Likewise.
	* sysdeps/i386/i586/strlen.S: Likewise.
	* sysdeps/i386/i586/sub_n.S: Likewise.
	* sysdeps/i386/i586/submul_1.S: Likewise.

	* sysdeps/stub/s_log2l.c: Correct function name.

	* time/africa: Updated from ADO tzdata1997e.
	* time/aantarctica: Likewise.
	* time/asia: Likewise.
	* time/australia: Likewise.
	* time/europe: Likewise.
	* time/northamerica: Likewise.
	* time/southamerica: Likewise.
	* time/private.h: Updated from ADO tzcode1997d.
	* time/scheck.c: Likewise.

1997-03-31 12:42  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/powerpc/Dist: Add kernel_*.h files.

1997-03-23 01:41  Geoff Keating  <geoffk@ozemail.com.au>

	* sysdeps/powerpc/strlen.s: Rewrote for more speed.
	* string/tst-strlen.c: Also test various string alignments.

1997-03-19 06:11  Geoff Keating  <geoffk@ozemail.com.au>

	* sysdeps/unix/sysv/linux/powerpc/statbuf.h: Removed.
	* sysdeps/unix/sysv/linux/powerpc/kernel_stat.h: Added.

	* sysdeps/powerpc/dl-machine.h (ELF_PREFERRED_ADDRESS): Assume
	program base address is 0x01800000 if we can't otherwise tell what
	it is.
	(elf_machine_rela): Replace `assertion failed' with real error
	messages.

	* sysdeps/powerpc/dl-machine.h: More comments, more GNU indenting.
	Put in extra parentheses to make explicit the relative precedence
	of + and >>.

	* sysdeps/powerpc/bsd-setjmp.S: Add `__setjmp' symbol so the tests
	pass.
	* sysdeps/powerpc/clone.S: Rewrite.  Probably still doesn't work.

	* sysdeps/unix/sysv/linux/powerpc/sys/sysdep.h: Use .section "text"
	instead of .text.

1997-03-31 02:28  Ulrich Drepper  <drepper@cygnus.com>

	* misc/tst-tsearch.c: Don't write to stderr, write to stdout
	instead.

	* inet/inet_ntoa.c (inet_ntoa): Complete rewrite.  Now uses
	thread-specific memory in multi-threaded programs.

	* sysdeps/stub/s_exp2.c: New file.  Stub version for exp2 function.
	* sysdeps/stub/s_exp2f.c: New file.
	* sysdeps/stub/s_exp2l.c: New file.
	Reported by a sun <asun@zoology.washington.edu>.

	* sysdeps/unix/sysv/linux/netatalk/atalk.h: Rename to...
	* sysdeps/unix/sysv/linux/netatalk/at.h: ...this.
	Suggested by a sun <asun@zoology.washington.edu>.

1997-03-30 14:53  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/linux/netinet/ip_icmp.h: Add former contents
	of <netinet/icmp.h>.
	Patch by a sun <asun@zoology.washington.edu>.

	* sysdeps/powerpc/strlen.S: Added.
This commit is contained in:
Ulrich Drepper 1997-03-31 22:56:24 +00:00
parent 3075e0e37c
commit 5929563ff2
65 changed files with 1668 additions and 1263 deletions

111
ChangeLog
View File

@ -1,3 +1,111 @@
1997-04-01 00:37 Ulrich Drepper <drepper@cygnus.com>
* math/Makefile: Prevent inlining for test-{float,double,longdouble}.
* math/libm-test.c (initialize): Make strings unique and force
values to memory.
* posix/regex.c: Debug debugging code.
* sysdeps/i386/asm-syntax.h: Define `L' macro to emit correct
syntax for local label.
* sysdeps/i386/add_n.S: Use correct local label syntax for the
binary format.
* sysdeps/i386/addmul_1.S: Likewise.
* sysdeps/i386/lshift.S: Likewise.
* sysdeps/i386/memchr.S: Likewise.
* sysdeps/i386/memset.S: Likewise.
* sysdeps/i386/mul_1.S: Likewise.
* sysdeps/i386/rshift.S: Likewise.
* sysdeps/i386/stpcpy.S: Likewise.
* sysdeps/i386/stpncpy.S: Likewise.
* sysdeps/i386/strchr.S: Likewise.
* sysdeps/i386/strcspn.S: Likewise.
* sysdeps/i386/strlen.S: Likewise.
* sysdeps/i386/strpbrk.S: Likewise.
* sysdeps/i386/strrchr.S: Likewise.
* sysdeps/i386/strspn.S: Likewise.
* sysdeps/i386/strtok.S: Likewise.
* sysdeps/i386/sub_n.S: Likewise.
* sysdeps/i386/submul_1.S: Likewise.
* sysdeps/i386/i486/strcat.S: Likewise.
* sysdeps/i386/i486/strlen.S: Likewise.
* sysdeps/i386/i586/add_n.S: Likewise.
* sysdeps/i386/i586/addmul_1.S: Likewise.
* sysdeps/i386/i586/lshift.S: Likewise.
* sysdeps/i386/i586/memset.S: Likewise.
* sysdeps/i386/i586/mul_1.S: Likewise.
* sysdeps/i386/i586/rshift.S: Likewise.
* sysdeps/i386/i586/strchr.S: Likewise.
* sysdeps/i386/i586/strlen.S: Likewise.
* sysdeps/i386/i586/sub_n.S: Likewise.
* sysdeps/i386/i586/submul_1.S: Likewise.
* sysdeps/stub/s_log2l.c: Correct function name.
* time/africa: Updated from ADO tzdata1997e.
* time/aantarctica: Likewise.
* time/asia: Likewise.
* time/australia: Likewise.
* time/europe: Likewise.
* time/northamerica: Likewise.
* time/southamerica: Likewise.
* time/private.h: Updated from ADO tzcode1997d.
* time/scheck.c: Likewise.
1997-03-31 12:42 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/powerpc/Dist: Add kernel_*.h files.
1997-03-23 01:41 Geoff Keating <geoffk@ozemail.com.au>
* sysdeps/powerpc/strlen.s: Rewrote for more speed.
* string/tst-strlen.c: Also test various string alignments.
1997-03-19 06:11 Geoff Keating <geoffk@ozemail.com.au>
* sysdeps/unix/sysv/linux/powerpc/statbuf.h: Removed.
* sysdeps/unix/sysv/linux/powerpc/kernel_stat.h: Added.
* sysdeps/powerpc/dl-machine.h (ELF_PREFERRED_ADDRESS): Assume
program base address is 0x01800000 if we can't otherwise tell what
it is.
(elf_machine_rela): Replace `assertion failed' with real error
messages.
* sysdeps/powerpc/dl-machine.h: More comments, more GNU indenting.
Put in extra parentheses to make explicit the relative precedence
of + and >>.
* sysdeps/powerpc/bsd-setjmp.S: Add `__setjmp' symbol so the tests
pass.
* sysdeps/powerpc/clone.S: Rewrite. Probably still doesn't work.
* sysdeps/unix/sysv/linux/powerpc/sys/sysdep.h: Use .section "text"
instead of .text.
1997-03-31 02:28 Ulrich Drepper <drepper@cygnus.com>
* misc/tst-tsearch.c: Don't write to stderr, write to stdout
instead.
* inet/inet_ntoa.c (inet_ntoa): Complete rewrite. Now uses
thread-specific memory in multi-threaded programs.
* sysdeps/stub/s_exp2.c: New file. Stub version for exp2 function.
* sysdeps/stub/s_exp2f.c: New file.
* sysdeps/stub/s_exp2l.c: New file.
Reported by a sun <asun@zoology.washington.edu>.
* sysdeps/unix/sysv/linux/netatalk/atalk.h: Rename to...
* sysdeps/unix/sysv/linux/netatalk/at.h: ...this.
Suggested by a sun <asun@zoology.washington.edu>.
1997-03-30 14:53 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/netinet/ip_icmp.h: Add former contents
of <netinet/icmp.h>.
Patch by a sun <asun@zoology.washington.edu>.
1997-03-30 03:42 Ulrich Drepper <drepper@cygnus.com> 1997-03-30 03:42 Ulrich Drepper <drepper@cygnus.com>
* math/libm-test.c: Add definition of ctanh_test, clog_test, and * math/libm-test.c: Add definition of ctanh_test, clog_test, and
@ -1418,7 +1526,7 @@
* sysdeps/powerpc/fpu_control.h: Added. * sysdeps/powerpc/fpu_control.h: Added.
* sysdeps/powerpc/jmp_buf.h: Added. * sysdeps/powerpc/jmp_buf.h: Added.
* sysdeps/powerpc/setjmp.S: Added. * sysdeps/powerpc/setjmp.S: Added.
* sysdeps/powerpc/strlen.s: Added. * sysdeps/powerpc/strlen.S: Added.
* sysdeps/powerpc/elf/start.c: Added. * sysdeps/powerpc/elf/start.c: Added.
* sysdeps/powerpc/fpu_control.h: Added. * sysdeps/powerpc/fpu_control.h: Added.
* sysdeps/powerpc/jmp_buf.h: Added. * sysdeps/powerpc/jmp_buf.h: Added.
@ -1437,7 +1545,6 @@
* sysdeps/unix/sysv/linux/powerpc/sysdep.c: Added. * sysdeps/unix/sysv/linux/powerpc/sysdep.c: Added.
* sysdeps/unix/sysv/linux/powerpc/sysdep.h: Added. * sysdeps/unix/sysv/linux/powerpc/sysdep.h: Added.
* sysdeps/unix/sysv/linux/powerpc/termbits.h: Added. * sysdeps/unix/sysv/linux/powerpc/termbits.h: Added.
* sysdeps/unix/sysv/linux/powerpc/sys/syscall.h: Added.
1997-03-05 05:24 Geoff Keating <geoffk@ozemail.com.au> 1997-03-05 05:24 Geoff Keating <geoffk@ozemail.com.au>

View File

@ -58,6 +58,13 @@ contact <bug-glibc@prep.ai.mit.edu>
- exp2 - exp2
- log2 - log2
- nearbyint
- ceil
- round
- rinttol
- rinttoll
- roundtol
- roundtoll
each with float, double, and long double arguments. Writing these each with float, double, and long double arguments. Writing these
functions should be possible when following the implementation of functions should be possible when following the implementation of
@ -68,7 +75,6 @@ contact <bug-glibc@prep.ai.mit.edu>
implementation should be possible today. I mention here the names implementation should be possible today. I mention here the names
and the way to write them (argument is z = x + iy): and the way to write them (argument is z = x + iy):
- cexp(z) = e^x (cos y + i sin y)
- sin(z) = 1/(2i) (e^(iz) - e^-(iz)) = sin(x) cosh(y) + i cos(x) sinh(y) - sin(z) = 1/(2i) (e^(iz) - e^-(iz)) = sin(x) cosh(y) + i cos(x) sinh(y)
- cos(z) = 1/2 (e^(iz) + e^-(iz)) = cos(x) cosh(y) - i sin(x) sinh(y) - cos(z) = 1/2 (e^(iz) + e^-(iz)) = cos(x) cosh(y) - i sin(x) sinh(y)
- tan(z) = 1/i (e^(iz) - e^-(iz))/(e^(iz) + e^-(iz)) - tan(z) = 1/i (e^(iz) - e^-(iz))/(e^(iz) + e^-(iz))
@ -77,8 +83,6 @@ contact <bug-glibc@prep.ai.mit.edu>
- acos(z) = -i ln(z + sqrt(z^2-1)) - acos(z) = -i ln(z + sqrt(z^2-1))
- atan(z) = 1/(2i) ln((1+iz)/(1-iz)) - atan(z) = 1/(2i) ln((1+iz)/(1-iz))
- acot(z) = -1/(2i) ln((iz+1)/(iz-1)) - acot(z) = -1/(2i) ln((iz+1)/(iz-1))
- sinh(z) = 1/2 (e^z - e^-z)
- cosh(z) = 1/2 (e^z + e^-z)
- tanh(z) = (e^z - e^-z)/(e^z + e^-z) - tanh(z) = (e^z - e^-z)/(e^z + e^-z)
- coth(z) = (e^z + e^-z)/(e^z - e^-z) - coth(z) = (e^z + e^-z)/(e^z - e^-z)

View File

@ -1,59 +1,97 @@
/* /* Convert Inet number to ASCII representation.
* Copyright (c) 1983, 1993 Copyright (C) 1997 Free Software Foundation, Inc.
* The Regents of the University of California. All rights reserved. This file is part of the GNU C Library.
* Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#if defined(LIBC_SCCS) && !defined(lint) The GNU C Library is free software; you can redistribute it and/or
static char sccsid[] = "@(#)inet_ntoa.c 8.1 (Berkeley) 6/4/93"; modify it under the terms of the GNU Library General Public License as
#endif /* LIBC_SCCS and not lint */ published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/*
* Convert network-format internet address
* to base 256 d.d.d.d representation.
*/
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <arpa/inet.h>
#include <libc-lock.h>
/* The interface of this function is completely stupid, it requires a
static buffer. We relax this a bit in that we allow at least one
buffer for each thread. */
__libc_lock_define_initialized (static, lock);
/* This is the key for the thread specific memory. */
static __libc_key_t key;
/* Destructor for the thread-specific data. */
static void free_key_mem (void *mem);
char * char *
inet_ntoa(in) inet_ntoa (struct in_addr in)
struct in_addr in;
{ {
static char b[18]; static char static_buf[18];
register char *p; static int initialized = 0;
char *buffer = NULL;
unsigned char *bytes;
p = (char *)&in; /* If we have not yet initialized the buffer do it now. */
#define UC(b) (((int)b)&0xff) if (!initialized)
(void)snprintf(b, sizeof(b), {
"%d.%d.%d.%d", UC(p[0]), UC(p[1]), UC(p[2]), UC(p[3])); /* Make sure there is only one process doing the initialization. */
return (b); __libc_lock_lock (lock);
if (!initialized)
{
if (__libc_key_create (&key, free_key_mem))
/* Creating the key failed. This either means we run
have only a single-threaded application or something
really went wrong. In any case use a static buffer
which is better than nothing. */
buffer = static_buf;
}
__libc_lock_unlock (lock);
}
if (buffer == NULL)
{
/* We don't use the static buffer and so we have a key. Use it
to get the thread-specific buffer. */
buffer = __libc_getspecific (key);
if (buffer == NULL)
{
/* No buffer allocated so far. */
buffer = malloc (18);
if (buffer == NULL)
/* No more memory available. We use the static buffer. */
buffer = static_buf;
else
__libc_setspecific (key, buffer);
}
}
bytes = (unsigned char *) &in;
snprintf (buffer, 18, "%d.%d.%d.%d", bytes[0], bytes[1], bytes[2], bytes[3]);
return buffer;
}
static void
free_key_mem (void *mem)
{
free (mem);
/* And we must set the data to NULL so that the destructor is not
called again. */
__libc_setspecific (key, NULL);
} }

View File

@ -73,6 +73,9 @@ tests = test-float test-double $(test-longdouble-$(long-double-fcts))
# XXX This test is disabled for now since the functions are too buggy. # XXX This test is disabled for now since the functions are too buggy.
#test-longdouble-yes = test-longdouble #test-longdouble-yes = test-longdouble
CFLAGS-test-float.c = -fno-inline
CFLAGS-test-double.c = -fno-inline
CFLAGS-test-longdouble.c = -fno-inline
LDLIBS-test-float = libm LDLIBS-test-float = libm
LDLIBS-test-double = libm LDLIBS-test-double = libm
LDLIBS-test-longdouble = libm LDLIBS-test-longdouble = libm

View File

@ -2947,7 +2947,7 @@ basic_tests (void)
static void static void
initialize (void) initialize (void)
{ {
fpstack_test ("*init*"); fpstack_test ("start *init*");
plus_zero = 0.0; plus_zero = 0.0;
nan_value = plus_zero / plus_zero; /* Suppress GCC warning */ nan_value = plus_zero / plus_zero; /* Suppress GCC warning */
@ -2955,8 +2955,14 @@ initialize (void)
plus_infty = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF); plus_infty = CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF);
minus_infty = -CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF); minus_infty = -CHOOSE (HUGE_VALL, HUGE_VAL, HUGE_VALF);
(void) &plus_zero;
(void) &nan_value;
(void) &minus_zero;
(void) &plus_infty;
(void) &minus_infty;
/* Test to make sure we start correctly. */ /* Test to make sure we start correctly. */
fpstack_test ("*init*"); fpstack_test ("end *init*");
} }

View File

@ -112,7 +112,7 @@ walk_action (const void *nodep, const VISIT which, const int depth)
if (depths[key] != depth) if (depths[key] != depth)
{ {
fputs ("Depth for one element is not constant during tree walk.\n", fputs ("Depth for one element is not constant during tree walk.\n",
stderr); stdout);
} }
} }
} }
@ -129,7 +129,7 @@ walk_tree (void *root, int expected_count)
for (i = 0; i < expected_count; ++i) for (i = 0; i < expected_count; ++i)
if (z[i] != 1) if (z[i] != 1)
{ {
fputs ("Node was not visited.\n", stderr); fputs ("Node was not visited.\n", stdout);
error = 1; error = 1;
} }
@ -139,7 +139,7 @@ walk_tree (void *root, int expected_count)
if (max_depth > expected_count) if (max_depth > expected_count)
#endif #endif
{ {
fputs ("Depth too large during tree walk.\n", stderr); fputs ("Depth too large during tree walk.\n", stdout);
error = 1; error = 1;
} }
} }
@ -196,7 +196,7 @@ mangle_tree (enum order how, enum action what, void **root, int lag)
{ {
if (tfind (x + j, (const void **) root, cmp_fn) != NULL) if (tfind (x + j, (const void **) root, cmp_fn) != NULL)
{ {
fputs ("Found element which is not in tree yet.\n", stderr); fputs ("Found element which is not in tree yet.\n", stdout);
error = 1; error = 1;
} }
elem = tsearch (x + j, root, cmp_fn); elem = tsearch (x + j, root, cmp_fn);
@ -204,7 +204,7 @@ mangle_tree (enum order how, enum action what, void **root, int lag)
|| tfind (x + j, (const void **) root, cmp_fn) == NULL) || tfind (x + j, (const void **) root, cmp_fn) == NULL)
{ {
fputs ("Couldn't find element after it was added.\n", fputs ("Couldn't find element after it was added.\n",
stderr); stdout);
error = 1; error = 1;
} }
} }
@ -219,7 +219,7 @@ mangle_tree (enum order how, enum action what, void **root, int lag)
elem = tfind (x + j, (const void **) root, cmp_fn); elem = tfind (x + j, (const void **) root, cmp_fn);
if (elem == NULL || tdelete (x + j, root, cmp_fn) == NULL) if (elem == NULL || tdelete (x + j, root, cmp_fn) == NULL)
{ {
fputs ("Error deleting element.\n", stderr); fputs ("Error deleting element.\n", stdout);
error = 1; error = 1;
} }
break; break;
@ -227,7 +227,7 @@ mangle_tree (enum order how, enum action what, void **root, int lag)
case find: case find:
if (tfind (x + j, (const void **) root, cmp_fn) == NULL) if (tfind (x + j, (const void **) root, cmp_fn) == NULL)
{ {
fputs ("Couldn't find element after it was added.\n", stderr); fputs ("Couldn't find element after it was added.\n", stdout);
error = 1; error = 1;
} }
break; break;
@ -252,10 +252,10 @@ main (int argc, char **argv)
/* Do this loop several times to get different permutations for the /* Do this loop several times to get different permutations for the
random case. */ random case. */
fputs ("Series I\n", stderr); fputs ("Series I\n", stdout);
for (i = 0; i < PASSES; ++i) for (i = 0; i < PASSES; ++i)
{ {
fprintf (stderr, "Pass %d... ", i + 1); fprintf (stdout, "Pass %d... ", i + 1);
fflush (stdout); fflush (stdout);
error = 0; error = 0;
@ -301,14 +301,14 @@ main (int argc, char **argv)
mangle_tree (randomorder, build_and_del, &root, j); mangle_tree (randomorder, build_and_del, &root, j);
} }
fputs (error ? " failed!\n" : " ok.\n", stderr); fputs (error ? " failed!\n" : " ok.\n", stdout);
total_error |= error; total_error |= error;
} }
fputs ("Series II\n", stderr); fputs ("Series II\n", stdout);
for (i = 1; i < SIZE; i *= 2) for (i = 1; i < SIZE; i *= 2)
{ {
fprintf (stderr, "For size %d... ", i); fprintf (stdout, "For size %d... ", i);
fflush (stdout); fflush (stdout);
error = 0; error = 0;
@ -321,7 +321,7 @@ main (int argc, char **argv)
mangle_tree (ascending, build_and_del, &root, i); mangle_tree (ascending, build_and_del, &root, i);
mangle_tree (descending, build_and_del, &root, i); mangle_tree (descending, build_and_del, &root, i);
fputs (error ? " failed!\n" : " ok.\n", stderr); fputs (error ? " failed!\n" : " ok.\n", stdout);
total_error |= error; total_error |= error;
} }

View File

@ -618,6 +618,7 @@ print_partial_compiled_pattern (start, end)
unsigned char *end; unsigned char *end;
{ {
int mcnt, mcnt2; int mcnt, mcnt2;
unsigned char *p1;
unsigned char *p = start; unsigned char *p = start;
unsigned char *pend = end; unsigned char *pend = end;
@ -759,20 +760,23 @@ print_partial_compiled_pattern (start, end)
case succeed_n: case succeed_n:
extract_number_and_incr (&mcnt, &p); extract_number_and_incr (&mcnt, &p);
p1 = p + mcnt;
extract_number_and_incr (&mcnt2, &p); extract_number_and_incr (&mcnt2, &p);
printf ("/succeed_n to %d, %d times", p + mcnt - start, mcnt2); printf ("/succeed_n to %d, %d times", p1 - start, mcnt2);
break; break;
case jump_n: case jump_n:
extract_number_and_incr (&mcnt, &p); extract_number_and_incr (&mcnt, &p);
p1 = p + mcnt;
extract_number_and_incr (&mcnt2, &p); extract_number_and_incr (&mcnt2, &p);
printf ("/jump_n to %d, %d times", p + mcnt - start, mcnt2); printf ("/jump_n to %d, %d times", p1 - start, mcnt2);
break; break;
case set_number_at: case set_number_at:
extract_number_and_incr (&mcnt, &p); extract_number_and_incr (&mcnt, &p);
p1 = p + mcnt;
extract_number_and_incr (&mcnt2, &p); extract_number_and_incr (&mcnt2, &p);
printf ("/set_number_at location %d to %d", p + mcnt - start, mcnt2); printf ("/set_number_at location %d to %d", p1 - start, mcnt2);
break; break;
case wordbound: case wordbound:
@ -850,7 +854,8 @@ print_compiled_pattern (bufp)
unsigned char *buffer = bufp->buffer; unsigned char *buffer = bufp->buffer;
print_partial_compiled_pattern (buffer, buffer + bufp->used); print_partial_compiled_pattern (buffer, buffer + bufp->used);
printf ("%d bytes used/%d bytes allocated.\n", bufp->used, bufp->allocated); printf ("%ld bytes used/%ld bytes allocated.\n",
bufp->used, bufp->allocated);
if (bufp->fastmap_accurate && bufp->fastmap) if (bufp->fastmap_accurate && bufp->fastmap)
{ {
@ -865,7 +870,7 @@ print_compiled_pattern (bufp)
printf ("no_sub: %d\t", bufp->no_sub); printf ("no_sub: %d\t", bufp->no_sub);
printf ("not_bol: %d\t", bufp->not_bol); printf ("not_bol: %d\t", bufp->not_bol);
printf ("not_eol: %d\t", bufp->not_eol); printf ("not_eol: %d\t", bufp->not_eol);
printf ("syntax: %d\n", bufp->syntax); printf ("syntax: %lx\n", bufp->syntax);
/* Perhaps we should print the translate table? */ /* Perhaps we should print the translate table? */
} }
@ -878,7 +883,7 @@ print_double_string (where, string1, size1, string2, size2)
int size1; int size1;
int size2; int size2;
{ {
unsigned this_char; int this_char;
if (where == NULL) if (where == NULL)
printf ("(null)"); printf ("(null)");
@ -1245,7 +1250,7 @@ typedef struct
DEBUG_PRINT2 (" Pushing high active reg: %d\n", highest_active_reg);\ DEBUG_PRINT2 (" Pushing high active reg: %d\n", highest_active_reg);\
PUSH_FAILURE_INT (highest_active_reg); \ PUSH_FAILURE_INT (highest_active_reg); \
\ \
DEBUG_PRINT2 (" Pushing pattern 0x%x: ", pattern_place); \ DEBUG_PRINT2 (" Pushing pattern 0x%x:\n", pattern_place); \
DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \ DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \
PUSH_FAILURE_POINTER (pattern_place); \ PUSH_FAILURE_POINTER (pattern_place); \
\ \
@ -1329,7 +1334,7 @@ typedef struct
DEBUG_PRINT1 ("'\n"); \ DEBUG_PRINT1 ("'\n"); \
\ \
pat = (unsigned char *) POP_FAILURE_POINTER (); \ pat = (unsigned char *) POP_FAILURE_POINTER (); \
DEBUG_PRINT2 (" Popping pattern 0x%x: ", pat); \ DEBUG_PRINT2 (" Popping pattern 0x%x:\n", pat); \
DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \ DEBUG_PRINT_COMPILED_PATTERN (bufp, pat, pend); \
\ \
/* Restore register info. */ \ /* Restore register info. */ \
@ -3882,7 +3887,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
dend = end_match_2; dend = end_match_2;
} }
DEBUG_PRINT1 ("The compiled pattern is: "); DEBUG_PRINT1 ("The compiled pattern is:\n");
DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend); DEBUG_PRINT_COMPILED_PATTERN (bufp, p, pend);
DEBUG_PRINT1 ("The string to match is: `"); DEBUG_PRINT1 ("The string to match is: `");
DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2); DEBUG_PRINT_DOUBLE_STRING (d, string1, size1, string2, size2);
@ -3893,7 +3898,11 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
fails at this starting point in the input data. */ fails at this starting point in the input data. */
for (;;) for (;;)
{ {
#ifdef _LIBC
DEBUG_PRINT2 ("\n%p: ", p);
#else
DEBUG_PRINT2 ("\n0x%x: ", p); DEBUG_PRINT2 ("\n0x%x: ", p);
#endif
if (p == pend) if (p == pend)
{ /* End of pattern means we might have succeeded. */ { /* End of pattern means we might have succeeded. */
@ -4472,7 +4481,11 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump"); DEBUG_PRINT1 ("EXECUTING on_failure_keep_string_jump");
EXTRACT_NUMBER_AND_INCR (mcnt, p); EXTRACT_NUMBER_AND_INCR (mcnt, p);
#ifdef _LIBC
DEBUG_PRINT3 (" %d (to %p):\n", mcnt, p + mcnt);
#else
DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt); DEBUG_PRINT3 (" %d (to 0x%x):\n", mcnt, p + mcnt);
#endif
PUSH_FAILURE_POINT (p + mcnt, NULL, -2); PUSH_FAILURE_POINT (p + mcnt, NULL, -2);
break; break;
@ -4495,7 +4508,11 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
DEBUG_PRINT1 ("EXECUTING on_failure_jump"); DEBUG_PRINT1 ("EXECUTING on_failure_jump");
EXTRACT_NUMBER_AND_INCR (mcnt, p); EXTRACT_NUMBER_AND_INCR (mcnt, p);
#ifdef _LIBC
DEBUG_PRINT3 (" %d (to %p)", mcnt, p + mcnt);
#else
DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt); DEBUG_PRINT3 (" %d (to 0x%x)", mcnt, p + mcnt);
#endif
/* If this on_failure_jump comes right before a group (i.e., /* If this on_failure_jump comes right before a group (i.e.,
the original * applied to a group), save the information the original * applied to a group), save the information
@ -4708,16 +4725,25 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
dummy_low_reg, dummy_high_reg, dummy_low_reg, dummy_high_reg,
reg_dummy, reg_dummy, reg_info_dummy); reg_dummy, reg_dummy, reg_info_dummy);
} }
/* Note fall through. */
unconditional_jump:
#ifdef _LIBC
DEBUG_PRINT2 ("\n%p: ", p);
#else
DEBUG_PRINT2 ("\n0x%x: ", p);
#endif
/* Note fall through. */
/* Unconditionally jump (without popping any failure points). */ /* Unconditionally jump (without popping any failure points). */
case jump: case jump:
unconditional_jump:
EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */ EXTRACT_NUMBER_AND_INCR (mcnt, p); /* Get the amount to jump. */
DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt); DEBUG_PRINT2 ("EXECUTING jump %d ", mcnt);
p += mcnt; /* Do the jump. */ p += mcnt; /* Do the jump. */
#ifdef _LIBC
DEBUG_PRINT2 ("(to %p).\n", p);
#else
DEBUG_PRINT2 ("(to 0x%x).\n", p); DEBUG_PRINT2 ("(to 0x%x).\n", p);
#endif
break; break;
@ -4766,11 +4792,19 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
mcnt--; mcnt--;
p += 2; p += 2;
STORE_NUMBER_AND_INCR (p, mcnt); STORE_NUMBER_AND_INCR (p, mcnt);
DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p, mcnt); #ifdef _LIBC
DEBUG_PRINT3 (" Setting %p to %d.\n", p - 2, mcnt);
#else
DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p - 2, mcnt);
#endif
} }
else if (mcnt == 0) else if (mcnt == 0)
{ {
#ifdef _LIBC
DEBUG_PRINT2 (" Setting two bytes from %p to no_op.\n", p+2);
#else
DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n", p+2); DEBUG_PRINT2 (" Setting two bytes from 0x%x to no_op.\n", p+2);
#endif
p[2] = (unsigned char) no_op; p[2] = (unsigned char) no_op;
p[3] = (unsigned char) no_op; p[3] = (unsigned char) no_op;
goto on_failure; goto on_failure;
@ -4786,6 +4820,11 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
{ {
mcnt--; mcnt--;
STORE_NUMBER (p + 2, mcnt); STORE_NUMBER (p + 2, mcnt);
#ifdef _LIBC
DEBUG_PRINT3 (" Setting %p to %d.\n", p + 2, mcnt);
#else
DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p + 2, mcnt);
#endif
goto unconditional_jump; goto unconditional_jump;
} }
/* If don't have to jump any more, skip over the rest of command. */ /* If don't have to jump any more, skip over the rest of command. */
@ -4800,7 +4839,11 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
EXTRACT_NUMBER_AND_INCR (mcnt, p); EXTRACT_NUMBER_AND_INCR (mcnt, p);
p1 = p + mcnt; p1 = p + mcnt;
EXTRACT_NUMBER_AND_INCR (mcnt, p); EXTRACT_NUMBER_AND_INCR (mcnt, p);
#ifdef _LIBC
DEBUG_PRINT3 (" Setting %p to %d.\n", p1, mcnt);
#else
DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt); DEBUG_PRINT3 (" Setting 0x%x to %d.\n", p1, mcnt);
#endif
STORE_NUMBER (p1, mcnt); STORE_NUMBER (p1, mcnt);
break; break;
} }

View File

@ -6,26 +6,33 @@ main(int argc, char *argv[])
{ {
static const size_t lens[] = { 0, 1, 0, 2, 0, 1, 0, 3, static const size_t lens[] = { 0, 1, 0, 2, 0, 1, 0, 3,
0, 1, 0, 2, 0, 1, 0, 4 }; 0, 1, 0, 2, 0, 1, 0, 4 };
char buf[24]; char basebuf[24 + 32];
size_t words; size_t base;
for (words = 0; words < 4; ++words) for (base = 0; base < 32; ++base)
{ {
size_t last; char *buf = basebuf + base;
memset (buf, 'a', words * 4); size_t words;
for (last = 0; last < 16; ++last) for (words = 0; words < 4; ++words)
{ {
buf[words * 4 + 0] = (last & 1) != 0 ? 'b' : '\0'; size_t last;
buf[words * 4 + 1] = (last & 2) != 0 ? 'c' : '\0'; memset (buf, 'a', words * 4);
buf[words * 4 + 2] = (last & 4) != 0 ? 'd' : '\0';
buf[words * 4 + 3] = (last & 8) != 0 ? 'e' : '\0';
buf[words * 4 + 4] = '\0';
if (strlen (buf) != words * 4 + lens[last]) for (last = 0; last < 16; ++last)
{ {
printf ("failed for words=%d and last=%d\n", words, last); buf[words * 4 + 0] = (last & 1) != 0 ? 'b' : '\0';
return 1; buf[words * 4 + 1] = (last & 2) != 0 ? 'c' : '\0';
buf[words * 4 + 2] = (last & 4) != 0 ? 'd' : '\0';
buf[words * 4 + 3] = (last & 8) != 0 ? 'e' : '\0';
buf[words * 4 + 4] = '\0';
if (strlen (buf) != words * 4 + lens[last])
{
printf ("failed for base=%d, words=%d, and last=%d\n",
base, words, last);
return 1;
}
} }
} }
} }

View File

@ -1,24 +1,22 @@
/* i80386 __mpn_add_n -- Add two limb vectors of the same length > 0 and store /* Add two limb vectors of the same length > 0 and store sum in a third
sum in a third limb vector. limb vector.
Copyright (C) 1992, 1994, 1995, 1997 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc. The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This file is part of the GNU MP Library. The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
The GNU MP Library is free software; you can redistribute it and/or modify You should have received a copy of the GNU Library General Public License
it under the terms of the GNU Library General Public License as published by along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation; either version 2 of the License, or (at your the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
option) any later version. MA 02111-1307, USA. */
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/* /*
INPUT PARAMETERS INPUT PARAMETERS
@ -47,7 +45,7 @@ C_SYMBOL_NAME(__mpn_add_n:)
shrl $3,%ecx /* compute count for unrolled loop */ shrl $3,%ecx /* compute count for unrolled loop */
negl %eax negl %eax
andl $7,%eax /* get index where to start loop */ andl $7,%eax /* get index where to start loop */
jz Loop /* necessary special case for 0 */ jz L(oop) /* necessary special case for 0 */
incl %ecx /* adjust loop count */ incl %ecx /* adjust loop count */
shll $2,%eax /* adjustment for pointers... */ shll $2,%eax /* adjustment for pointers... */
subl %eax,%edi /* ... since they are offset ... */ subl %eax,%edi /* ... since they are offset ... */
@ -57,18 +55,18 @@ C_SYMBOL_NAME(__mpn_add_n:)
#ifdef PIC #ifdef PIC
/* Calculate start address in loop for PIC. Due to limitations in some /* Calculate start address in loop for PIC. Due to limitations in some
assemblers, Loop-L0-3 cannot be put into the leal */ assemblers, Loop-L0-3 cannot be put into the leal */
call L0 call L(0)
L0: leal (%eax,%eax,8),%eax L(0): leal (%eax,%eax,8),%eax
addl (%esp),%eax addl (%esp),%eax
addl $(Loop-L0-3),%eax addl $(L(oop)-L(0)-3),%eax
addl $4,%esp addl $4,%esp
#else #else
/* Calculate start address in loop for non-PIC. */ /* Calculate start address in loop for non-PIC. */
leal (Loop - 3)(%eax,%eax,8),%eax leal (L(oop) - 3)(%eax,%eax,8),%eax
#endif #endif
jmp *%eax /* jump into loop */ jmp *%eax /* jump into loop */
ALIGN (3) ALIGN (3)
Loop: movl (%esi),%eax L(oop): movl (%esi),%eax
adcl (%edx),%eax adcl (%edx),%eax
movl %eax,(%edi) movl %eax,(%edi)
movl 4(%esi),%eax movl 4(%esi),%eax
@ -96,7 +94,7 @@ Loop: movl (%esi),%eax
leal 32(%esi),%esi leal 32(%esi),%esi
leal 32(%edx),%edx leal 32(%edx),%edx
decl %ecx decl %ecx
jnz Loop jnz L(oop)
sbbl %eax,%eax sbbl %eax,%eax
negl %eax negl %eax

View File

@ -1,24 +1,22 @@
/* i80386 __mpn_addmul_1 -- Multiply a limb vector with a limb and add /* i80386 __mpn_addmul_1 -- Multiply a limb vector with a limb and add
the result to a second limb vector. the result to a second limb vector.
Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
Copyright (C) 1992, 1994 Free Software Foundation, Inc. The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This file is part of the GNU MP Library. The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
The GNU MP Library is free software; you can redistribute it and/or modify You should have received a copy of the GNU Library General Public License
it under the terms of the GNU Library General Public License as published by along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation; either version 2 of the License, or (at your the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
option) any later version. MA 02111-1307, USA. */
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/* /*
INPUT PARAMETERS INPUT PARAMETERS
@ -56,7 +54,7 @@ C_SYMBOL_NAME(__mpn_addmul_1:)
INSN1(neg,l ,R(size)) INSN1(neg,l ,R(size))
INSN2(xor,l ,R(ebx),R(ebx)) INSN2(xor,l ,R(ebx),R(ebx))
ALIGN (3) ALIGN (3)
Loop: L(oop):
INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4)) INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4))
INSN1(mul,l ,R(s2_limb)) INSN1(mul,l ,R(s2_limb))
INSN2(add,l ,R(eax),R(ebx)) INSN2(add,l ,R(eax),R(ebx))
@ -66,7 +64,7 @@ Loop:
INSN2(mov,l ,R(ebx),R(edx)) INSN2(mov,l ,R(ebx),R(edx))
INSN1(inc,l ,R(size)) INSN1(inc,l ,R(size))
INSN1(jnz, ,Loop) INSN1(jnz, ,L(oop))
INSN2(mov,l ,R(eax),R(ebx)) INSN2(mov,l ,R(eax),R(ebx))
INSN1(pop,l ,R(ebp)) INSN1(pop,l ,R(ebp))

View File

@ -63,3 +63,18 @@
#undef ALIGN #undef ALIGN
#define ALIGN(log) .align 1<<log #define ALIGN(log) .align 1<<log
#endif #endif
#undef L
#ifdef __ELF__
#ifdef __STDC__
#define L(body) .L##body
#else
#define L(body) .L/**/body
#endif
#else
#ifdef __STDC__
#define L(body) L##body
#else
#define L(body) L/**/body
#endif
#endif

View File

@ -1,6 +1,6 @@
/* strcat(dest, src) -- Append SRC on the end of DEST. /* strcat(dest, src) -- Append SRC on the end of DEST.
For Intel 80x86, x>=4. For Intel 80x86, x>=4.
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>. Contributed by Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>.
Optimised a little by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> Optimised a little by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@ -37,35 +37,35 @@ ENTRY (strcat)
movl 8(%esp), %edx /* load destination pointer */ movl 8(%esp), %edx /* load destination pointer */
testb $0xff, (%ecx) /* Is source string empty? */ testb $0xff, (%ecx) /* Is source string empty? */
jz L8 /* yes => return */ jz L(8) /* yes => return */
/* Test the first bytes separately until destination is aligned. */ /* Test the first bytes separately until destination is aligned. */
testl $3, %edx /* destination pointer aligned? */ testl $3, %edx /* destination pointer aligned? */
jz L1 /* yes => begin scan loop */ jz L(1) /* yes => begin scan loop */
testb $0xff, (%edx) /* is end of string? */ testb $0xff, (%edx) /* is end of string? */
jz L2 /* yes => start appending */ jz L(2) /* yes => start appending */
incl %edx /* increment source pointer */ incl %edx /* increment source pointer */
testl $3, %edx /* destination pointer aligned? */ testl $3, %edx /* destination pointer aligned? */
jz L1 /* yes => begin scan loop */ jz L(1) /* yes => begin scan loop */
testb $0xff, (%edx) /* is end of string? */ testb $0xff, (%edx) /* is end of string? */
jz L2 /* yes => start appending */ jz L(2) /* yes => start appending */
incl %edx /* increment source pointer */ incl %edx /* increment source pointer */
testl $3, %edx /* destination pointer aligned? */ testl $3, %edx /* destination pointer aligned? */
jz L1 /* yes => begin scan loop */ jz L(1) /* yes => begin scan loop */
testb $0xff, (%edx) /* is end of string? */ testb $0xff, (%edx) /* is end of string? */
jz L2 /* yes => start appending */ jz L(2) /* yes => start appending */
incl %edx /* increment source pointer */ incl %edx /* increment source pointer */
/* Now we are aligned. Begin scan loop. */ /* Now we are aligned. Begin scan loop. */
jmp L1 jmp L(1)
ALIGN(4) ALIGN(4)
L4: addl $16,%edx /* increment destination pointer for round */ L(4): addl $16,%edx /* increment destination pointer for round */
L1: movl (%edx), %eax /* get word (= 4 bytes) in question */ L(1): movl (%edx), %eax /* get word (= 4 bytes) in question */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
/* If you compare this with the algorithm in memchr.S you will /* If you compare this with the algorithm in memchr.S you will
@ -83,7 +83,7 @@ L1: movl (%edx), %eax /* get word (= 4 bytes) in question */
representation with more than 32 bits) not alter then last representation with more than 32 bits) not alter then last
overflow, we can now test this condition. If no carry is signaled overflow, we can now test this condition. If no carry is signaled
no overflow must have occurred in the last byte => it was 0. */ no overflow must have occurred in the last byte => it was 0. */
jnc L3 jnc L(3)
/* We are only interested in carry bits that change due to the /* We are only interested in carry bits that change due to the
previous add, so remove original bits */ previous add, so remove original bits */
@ -95,106 +95,106 @@ L1: movl (%edx), %eax /* get word (= 4 bytes) in question */
the addition will not result in 0. */ the addition will not result in 0. */
/* If at least one byte of the word is C we don't get 0 in %ecx. */ /* If at least one byte of the word is C we don't get 0 in %ecx. */
jnz L3 jnz L(3)
movl 4(%edx), %eax /* get word from source */ movl 4(%edx), %eax /* get word from source */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
addl %eax, %edi /* add the magic value to the word. We get addl %eax, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L5 /* highest byte is C => stop copying */ jnc L(5) /* highest byte is C => stop copying */
xorl %eax, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %eax, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L5 /* one byte is NUL => stop copying */ jnz L(5) /* one byte is NUL => stop copying */
movl 8(%edx), %eax /* get word from source */ movl 8(%edx), %eax /* get word from source */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
addl %eax, %edi /* add the magic value to the word. We get addl %eax, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L6 /* highest byte is C => stop copying */ jnc L(6) /* highest byte is C => stop copying */
xorl %eax, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %eax, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L6 /* one byte is NUL => stop copying */ jnz L(6) /* one byte is NUL => stop copying */
movl 12(%edx), %eax /* get word from source */ movl 12(%edx), %eax /* get word from source */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
addl %eax, %edi /* add the magic value to the word. We get addl %eax, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L7 /* highest byte is C => stop copying */ jnc L(7) /* highest byte is C => stop copying */
xorl %eax, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %eax, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jz L4 /* no byte is NUL => carry on copying */ jz L(4) /* no byte is NUL => carry on copying */
L7: addl $4, %edx /* adjust source pointer */ L(7): addl $4, %edx /* adjust source pointer */
L6: addl $4, %edx L(6): addl $4, %edx
L5: addl $4, %edx L(5): addl $4, %edx
L3: testb %al, %al /* is first byte NUL? */ L(3): testb %al, %al /* is first byte NUL? */
jz L2 /* yes => start copying */ jz L(2) /* yes => start copying */
incl %edx /* increment source pointer */ incl %edx /* increment source pointer */
testb %ah, %ah /* is second byte NUL? */ testb %ah, %ah /* is second byte NUL? */
jz L2 /* yes => start copying */ jz L(2) /* yes => start copying */
incl %edx /* increment source pointer */ incl %edx /* increment source pointer */
testl $0xff0000, %eax /* is third byte NUL? */ testl $0xff0000, %eax /* is third byte NUL? */
jz L2 /* yes => start copying */ jz L(2) /* yes => start copying */
incl %edx /* increment source pointer */ incl %edx /* increment source pointer */
L2: subl %ecx, %edx /* reduce number of loop variants */ L(2): subl %ecx, %edx /* reduce number of loop variants */
/* Now we have to align the source pointer. */ /* Now we have to align the source pointer. */
testl $3, %ecx /* pointer correctly aligned? */ testl $3, %ecx /* pointer correctly aligned? */
jz L29 /* yes => start copy loop */ jz L(29) /* yes => start copy loop */
movb (%ecx), %al /* get first byte */ movb (%ecx), %al /* get first byte */
movb %al, (%ecx,%edx) /* and store it */ movb %al, (%ecx,%edx) /* and store it */
andb %al, %al /* is byte NUL? */ andb %al, %al /* is byte NUL? */
jz L8 /* yes => return */ jz L(8) /* yes => return */
incl %ecx /* increment pointer */ incl %ecx /* increment pointer */
testl $3, %ecx /* pointer correctly aligned? */ testl $3, %ecx /* pointer correctly aligned? */
jz L29 /* yes => start copy loop */ jz L(29) /* yes => start copy loop */
movb (%ecx), %al /* get first byte */ movb (%ecx), %al /* get first byte */
movb %al, (%ecx,%edx) /* and store it */ movb %al, (%ecx,%edx) /* and store it */
andb %al, %al /* is byte NUL? */ andb %al, %al /* is byte NUL? */
jz L8 /* yes => return */ jz L(8) /* yes => return */
incl %ecx /* increment pointer */ incl %ecx /* increment pointer */
testl $3, %ecx /* pointer correctly aligned? */ testl $3, %ecx /* pointer correctly aligned? */
jz L29 /* yes => start copy loop */ jz L(29) /* yes => start copy loop */
movb (%ecx), %al /* get first byte */ movb (%ecx), %al /* get first byte */
movb %al, (%ecx,%edx) /* and store it */ movb %al, (%ecx,%edx) /* and store it */
andb %al, %al /* is byte NUL? */ andb %al, %al /* is byte NUL? */
jz L8 /* yes => return */ jz L(8) /* yes => return */
incl %ecx /* increment pointer */ incl %ecx /* increment pointer */
/* Now we are aligned. */ /* Now we are aligned. */
jmp L29 /* start copy loop */ jmp L(29) /* start copy loop */
ALIGN(4) ALIGN(4)
L28: movl %eax, 12(%ecx,%edx)/* store word at destination */ L(28): movl %eax, 12(%ecx,%edx)/* store word at destination */
addl $16, %ecx /* adjust pointer for full round */ addl $16, %ecx /* adjust pointer for full round */
L29: movl (%ecx), %eax /* get word from source */ L(29): movl (%ecx), %eax /* get word from source */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
addl %eax, %edi /* add the magic value to the word. We get addl %eax, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L9 /* highest byte is C => stop copying */ jnc L(9) /* highest byte is C => stop copying */
xorl %eax, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %eax, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L9 /* one byte is NUL => stop copying */ jnz L(9) /* one byte is NUL => stop copying */
movl %eax, (%ecx,%edx) /* store word to destination */ movl %eax, (%ecx,%edx) /* store word to destination */
movl 4(%ecx), %eax /* get word from source */ movl 4(%ecx), %eax /* get word from source */
@ -202,12 +202,12 @@ L29: movl (%ecx), %eax /* get word from source */
addl %eax, %edi /* add the magic value to the word. We get addl %eax, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L91 /* highest byte is C => stop copying */ jnc L(91) /* highest byte is C => stop copying */
xorl %eax, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %eax, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L91 /* one byte is NUL => stop copying */ jnz L(91) /* one byte is NUL => stop copying */
movl %eax, 4(%ecx,%edx) /* store word to destination */ movl %eax, 4(%ecx,%edx) /* store word to destination */
movl 8(%ecx), %eax /* get word from source */ movl 8(%ecx), %eax /* get word from source */
@ -215,12 +215,12 @@ L29: movl (%ecx), %eax /* get word from source */
addl %eax, %edi /* add the magic value to the word. We get addl %eax, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L92 /* highest byte is C => stop copying */ jnc L(92) /* highest byte is C => stop copying */
xorl %eax, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %eax, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L92 /* one byte is NUL => stop copying */ jnz L(92) /* one byte is NUL => stop copying */
movl %eax, 8(%ecx,%edx) /* store word to destination */ movl %eax, 8(%ecx,%edx) /* store word to destination */
movl 12(%ecx), %eax /* get word from source */ movl 12(%ecx), %eax /* get word from source */
@ -228,33 +228,33 @@ L29: movl (%ecx), %eax /* get word from source */
addl %eax, %edi /* add the magic value to the word. We get addl %eax, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L93 /* highest byte is C => stop copying */ jnc L(93) /* highest byte is C => stop copying */
xorl %eax, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %eax, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jz L28 /* no is NUL => carry on copying */ jz L(28) /* no is NUL => carry on copying */
L93: addl $4, %ecx /* adjust pointer */ L(93): addl $4, %ecx /* adjust pointer */
L92: addl $4, %ecx L(92): addl $4, %ecx
L91: addl $4, %ecx L(91): addl $4, %ecx
L9: movb %al, (%ecx,%edx) /* store first byte of last word */ L(9): movb %al, (%ecx,%edx) /* store first byte of last word */
orb %al, %al /* is it NUL? */ orb %al, %al /* is it NUL? */
jz L8 /* yes => return */ jz L(8) /* yes => return */
movb %ah, 1(%ecx,%edx) /* store second byte of last word */ movb %ah, 1(%ecx,%edx) /* store second byte of last word */
orb %ah, %ah /* is it NUL? */ orb %ah, %ah /* is it NUL? */
jz L8 /* yes => return */ jz L(8) /* yes => return */
shrl $16, %eax /* make upper bytes accessible */ shrl $16, %eax /* make upper bytes accessible */
movb %al, 2(%ecx,%edx) /* store third byte of last word */ movb %al, 2(%ecx,%edx) /* store third byte of last word */
orb %al, %al /* is it NUL? */ orb %al, %al /* is it NUL? */
jz L8 /* yes => return */ jz L(8) /* yes => return */
movb %ah, 3(%ecx,%edx) /* store fourth byte of last word */ movb %ah, 3(%ecx,%edx) /* store fourth byte of last word */
L8: movl 8(%esp), %eax /* start address of destination is result */ L(8): movl 8(%esp), %eax /* start address of destination is result */
popl %edi /* restore saved register */ popl %edi /* restore saved register */
ret ret

View File

@ -1,23 +1,23 @@
/* strlen(str) -- determine the length of the string STR. /* strlen(str) -- determine the length of the string STR.
Optimized for Intel 80x86, x>=4. Optimized for Intel 80x86, x>=4.
Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc. Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <sysdep.h> #include <sysdep.h>
#include "asm-syntax.h" #include "asm-syntax.h"
@ -33,21 +33,21 @@ ENTRY (strlen)
movl %ecx, %eax /* duplicate it */ movl %ecx, %eax /* duplicate it */
andl $3, %ecx /* mask alignment bits */ andl $3, %ecx /* mask alignment bits */
jz L1 /* aligned => start loop */ jz L(1) /* aligned => start loop */
cmpb %ch, (%eax) /* is byte NUL? */ cmpb %ch, (%eax) /* is byte NUL? */
je L2 /* yes => return */ je L(2) /* yes => return */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
xorl $3, %ecx /* was alignment = 3? */ xorl $3, %ecx /* was alignment = 3? */
jz L1 /* yes => now it is aligned and start loop */ jz L(1) /* yes => now it is aligned and start loop */
cmpb %ch, (%eax) /* is byte NUL? */ cmpb %ch, (%eax) /* is byte NUL? */
je L2 /* yes => return */ je L(2) /* yes => return */
addl $1, %eax /* increment pointer */ addl $1, %eax /* increment pointer */
subl $1, %ecx /* was alignment = 2? */ subl $1, %ecx /* was alignment = 2? */
jz L1 /* yes => now it is aligned and start loop */ jz L(1) /* yes => now it is aligned and start loop */
cmpb %ch, (%eax) /* is byte NUL? */ cmpb %ch, (%eax) /* is byte NUL? */
je L2 /* yes => return */ je L(2) /* yes => return */
/* Don't change the above `addl $1,%eax' and `subl $1, %ecx' into `incl %eax' /* Don't change the above `addl $1,%eax' and `subl $1, %ecx' into `incl %eax'
and `decl %ecx' resp. The additional two byte per instruction make the and `decl %ecx' resp. The additional two byte per instruction make the
@ -61,73 +61,73 @@ ENTRY (strlen)
subl $15, %eax /* effectively +1 */ subl $15, %eax /* effectively +1 */
L4: addl $16, %eax /* adjust pointer for full loop */ L(4): addl $16, %eax /* adjust pointer for full loop */
L1: movl (%eax), %ecx /* get word (= 4 bytes) in question */ L(1): movl (%eax), %ecx /* get word (= 4 bytes) in question */
movl $0xfefefeff, %edx /* magic value */ movl $0xfefefeff, %edx /* magic value */
addl %ecx, %edx /* add the magic value to the word. We get addl %ecx, %edx /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L3 /* highest byte is NUL => return pointer */ jnc L(3) /* highest byte is NUL => return pointer */
xorl %ecx, %edx /* (word+magic)^word */ xorl %ecx, %edx /* (word+magic)^word */
orl $0xfefefeff, %edx /* set all non-carry bits */ orl $0xfefefeff, %edx /* set all non-carry bits */
incl %edx /* add 1: if one carry bit was *not* set incl %edx /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L3 /* found NUL => return pointer */ jnz L(3) /* found NUL => return pointer */
movl 4(%eax), %ecx /* get word (= 4 bytes) in question */ movl 4(%eax), %ecx /* get word (= 4 bytes) in question */
movl $0xfefefeff, %edx /* magic value */ movl $0xfefefeff, %edx /* magic value */
addl %ecx, %edx /* add the magic value to the word. We get addl %ecx, %edx /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L5 /* highest byte is NUL => return pointer */ jnc L(5) /* highest byte is NUL => return pointer */
xorl %ecx, %edx /* (word+magic)^word */ xorl %ecx, %edx /* (word+magic)^word */
orl $0xfefefeff, %edx /* set all non-carry bits */ orl $0xfefefeff, %edx /* set all non-carry bits */
incl %edx /* add 1: if one carry bit was *not* set incl %edx /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L5 /* found NUL => return pointer */ jnz L(5) /* found NUL => return pointer */
movl 8(%eax), %ecx /* get word (= 4 bytes) in question */ movl 8(%eax), %ecx /* get word (= 4 bytes) in question */
movl $0xfefefeff, %edx /* magic value */ movl $0xfefefeff, %edx /* magic value */
addl %ecx, %edx /* add the magic value to the word. We get addl %ecx, %edx /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L6 /* highest byte is NUL => return pointer */ jnc L(6) /* highest byte is NUL => return pointer */
xorl %ecx, %edx /* (word+magic)^word */ xorl %ecx, %edx /* (word+magic)^word */
orl $0xfefefeff, %edx /* set all non-carry bits */ orl $0xfefefeff, %edx /* set all non-carry bits */
incl %edx /* add 1: if one carry bit was *not* set incl %edx /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L6 /* found NUL => return pointer */ jnz L(6) /* found NUL => return pointer */
movl 12(%eax), %ecx /* get word (= 4 bytes) in question */ movl 12(%eax), %ecx /* get word (= 4 bytes) in question */
movl $0xfefefeff, %edx /* magic value */ movl $0xfefefeff, %edx /* magic value */
addl %ecx, %edx /* add the magic value to the word. We get addl %ecx, %edx /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L7 /* highest byte is NUL => return pointer */ jnc L(7) /* highest byte is NUL => return pointer */
xorl %ecx, %edx /* (word+magic)^word */ xorl %ecx, %edx /* (word+magic)^word */
orl $0xfefefeff, %edx /* set all non-carry bits */ orl $0xfefefeff, %edx /* set all non-carry bits */
incl %edx /* add 1: if one carry bit was *not* set incl %edx /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jz L4 /* no NUL found => continue loop */ jz L(4) /* no NUL found => continue loop */
L7: addl $4, %eax /* adjust pointer */ L(7): addl $4, %eax /* adjust pointer */
L6: addl $4, %eax L(6): addl $4, %eax
L5: addl $4, %eax L(5): addl $4, %eax
L3: testb %cl, %cl /* is first byte NUL? */ L(3): testb %cl, %cl /* is first byte NUL? */
jz L2 /* yes => return */ jz L(2) /* yes => return */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
testb %ch, %ch /* is second byte NUL? */ testb %ch, %ch /* is second byte NUL? */
jz L2 /* yes => return */ jz L(2) /* yes => return */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
testl $0xff0000, %ecx /* is third byte NUL? */ testl $0xff0000, %ecx /* is third byte NUL? */
jz L2 /* yes => return pointer */ jz L(2) /* yes => return pointer */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
L2: subl 4(%esp), %eax /* compute difference to string start */ L(2): subl 4(%esp), %eax /* compute difference to string start */
ret ret
END (strlen) END (strlen)

View File

@ -1,24 +1,22 @@
/* Pentium __mpn_add_n -- Add two limb vectors of the same length > 0 and store /* Pentium __mpn_add_n -- Add two limb vectors of the same length > 0 and store
sum in a third limb vector. sum in a third limb vector.
Copyright (C) 1992, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
Copyright (C) 1992, 1994, 1995, 1996 Free Software Foundation, Inc. The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This file is part of the GNU MP Library. The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
The GNU MP Library is free software; you can redistribute it and/or modify You should have received a copy of the GNU Library General Public License
it under the terms of the GNU Library General Public License as published by along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation; either version 2 of the License, or (at your the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
option) any later version. MA 02111-1307, USA. */
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/* /*
INPUT PARAMETERS INPUT PARAMETERS
@ -52,14 +50,14 @@ C_SYMBOL_NAME(__mpn_add_n:)
shrl $3,%ecx shrl $3,%ecx
andl $7,%edx andl $7,%edx
testl %ecx,%ecx /* zero carry flag */ testl %ecx,%ecx /* zero carry flag */
jz Lend jz L(end)
pushl %edx pushl %edx
ALIGN (3) ALIGN (3)
Loop: movl 28(%edi),%eax /* fetch destination cache line */ L(oop): movl 28(%edi),%eax /* fetch destination cache line */
leal 32(%edi),%edi leal 32(%edi),%edi
L1: movl (%esi),%eax L(1): movl (%esi),%eax
movl 4(%esi),%edx movl 4(%esi),%edx
adcl %ebx,%eax adcl %ebx,%eax
movl 4(%ebp),%ebx movl 4(%ebp),%ebx
@ -68,7 +66,7 @@ L1: movl (%esi),%eax
movl %eax,-32(%edi) movl %eax,-32(%edi)
movl %edx,-28(%edi) movl %edx,-28(%edi)
L2: movl 8(%esi),%eax L(2): movl 8(%esi),%eax
movl 12(%esi),%edx movl 12(%esi),%edx
adcl %ebx,%eax adcl %ebx,%eax
movl 12(%ebp),%ebx movl 12(%ebp),%ebx
@ -77,7 +75,7 @@ L2: movl 8(%esi),%eax
movl %eax,-24(%edi) movl %eax,-24(%edi)
movl %edx,-20(%edi) movl %edx,-20(%edi)
L3: movl 16(%esi),%eax L(3): movl 16(%esi),%eax
movl 20(%esi),%edx movl 20(%esi),%edx
adcl %ebx,%eax adcl %ebx,%eax
movl 20(%ebp),%ebx movl 20(%ebp),%ebx
@ -86,7 +84,7 @@ L3: movl 16(%esi),%eax
movl %eax,-16(%edi) movl %eax,-16(%edi)
movl %edx,-12(%edi) movl %edx,-12(%edi)
L4: movl 24(%esi),%eax L(4): movl 24(%esi),%eax
movl 28(%esi),%edx movl 28(%esi),%edx
adcl %ebx,%eax adcl %ebx,%eax
movl 28(%ebp),%ebx movl 28(%ebp),%ebx
@ -98,14 +96,14 @@ L4: movl 24(%esi),%eax
leal 32(%esi),%esi leal 32(%esi),%esi
leal 32(%ebp),%ebp leal 32(%ebp),%ebp
decl %ecx decl %ecx
jnz Loop jnz L(oop)
popl %edx popl %edx
Lend: L(end):
decl %edx /* test %edx w/o clobbering carry */ decl %edx /* test %edx w/o clobbering carry */
js Lend2 js L(end2)
incl %edx incl %edx
Loop2: L(oop2):
leal 4(%edi),%edi leal 4(%edi),%edi
movl (%esi),%eax movl (%esi),%eax
adcl %ebx,%eax adcl %ebx,%eax
@ -114,8 +112,8 @@ Loop2:
leal 4(%esi),%esi leal 4(%esi),%esi
leal 4(%ebp),%ebp leal 4(%ebp),%ebp
decl %edx decl %edx
jnz Loop2 jnz L(oop2)
Lend2: L(end2):
movl (%esi),%eax movl (%esi),%eax
adcl %ebx,%eax adcl %ebx,%eax
movl %eax,(%edi) movl %eax,(%edi)

View File

@ -1,24 +1,22 @@
/* Pentium __mpn_addmul_1 -- Multiply a limb vector with a limb and add /* Pentium __mpn_addmul_1 -- Multiply a limb vector with a limb and add
the result to a second limb vector. the result to a second limb vector.
Copyright (C) 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
Copyright (C) 1992, 1994, 1996 Free Software Foundation, Inc. The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This file is part of the GNU MP Library. The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
The GNU MP Library is free software; you can redistribute it and/or modify You should have received a copy of the GNU Library General Public License
it under the terms of the GNU Library General Public License as published by along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation; either version 2 of the License, or (at your the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
option) any later version. MA 02111-1307, USA. */
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/* /*
INPUT PARAMETERS INPUT PARAMETERS
@ -57,7 +55,7 @@ C_SYMBOL_NAME(__mpn_addmul_1:)
INSN2(xor,l ,R(ebx),R(ebx)) INSN2(xor,l ,R(ebx),R(ebx))
ALIGN (3) ALIGN (3)
Loop: INSN2(adc,l ,R(ebx),$0) L(oop): INSN2(adc,l ,R(ebx),$0)
INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4)) INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4))
INSN1(mul,l ,R(s2_limb)) INSN1(mul,l ,R(s2_limb))
@ -72,7 +70,7 @@ Loop: INSN2(adc,l ,R(ebx),$0)
INSN1(inc,l ,R(size)) INSN1(inc,l ,R(size))
INSN2(mov,l ,R(ebx),R(edx)) INSN2(mov,l ,R(ebx),R(edx))
INSN1(jnz, ,Loop) INSN1(jnz, ,L(oop))
INSN2(adc,l ,R(ebx),$0) INSN2(adc,l ,R(ebx),$0)
INSN2(mov,l ,R(eax),R(ebx)) INSN2(mov,l ,R(eax),R(ebx))

View File

@ -1,5 +1,5 @@
/* Pentium optimized __mpn_lshift -- /* Pentium optimized __mpn_lshift --
Copyright (C) 1992, 1994, 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1992, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or modify The GNU C Library is free software; you can redistribute it and/or modify
@ -44,15 +44,15 @@ C_SYMBOL_NAME(__mpn_lshift:)
/* We can use faster code for shift-by-1 under certain conditions. */ /* We can use faster code for shift-by-1 under certain conditions. */
cmp $1,%ecx cmp $1,%ecx
jne Lnormal jne L(normal)
leal 4(%esi),%eax leal 4(%esi),%eax
cmpl %edi,%eax cmpl %edi,%eax
jnc Lspecial /* jump if s_ptr + 1 >= res_ptr */ jnc L(special) /* jump if s_ptr + 1 >= res_ptr */
leal (%esi,%ebp,4),%eax leal (%esi,%ebp,4),%eax
cmpl %eax,%edi cmpl %eax,%edi
jnc Lspecial /* jump if res_ptr >= s_ptr + size */ jnc L(special) /* jump if res_ptr >= s_ptr + size */
Lnormal: L(normal):
leal -4(%edi,%ebp,4),%edi leal -4(%edi,%ebp,4),%edi
leal -4(%esi,%ebp,4),%esi leal -4(%esi,%ebp,4),%esi
@ -65,12 +65,12 @@ Lnormal:
decl %ebp decl %ebp
pushl %ebp pushl %ebp
shrl $3,%ebp shrl $3,%ebp
jz Lend jz L(end)
movl (%edi),%eax /* fetch destination cache line */ movl (%edi),%eax /* fetch destination cache line */
ALIGN (2) ALIGN (2)
Loop: movl -28(%edi),%eax /* fetch destination cache line */ L(oop): movl -28(%edi),%eax /* fetch destination cache line */
movl %edx,%ebx movl %edx,%ebx
movl (%esi),%eax movl (%esi),%eax
@ -104,21 +104,23 @@ Loop: movl -28(%edi),%eax /* fetch destination cache line */
subl $32,%esi subl $32,%esi
subl $32,%edi subl $32,%edi
decl %ebp decl %ebp
jnz Loop jnz L(oop)
Lend: popl %ebp L(end): popl %ebp
andl $7,%ebp andl $7,%ebp
jz Lend2 jz L(end2)
Loop2: movl (%esi),%eax L(oop2):
movl (%esi),%eax
shldl %cl,%eax,%edx shldl %cl,%eax,%edx
movl %edx,(%edi) movl %edx,(%edi)
movl %eax,%edx movl %eax,%edx
subl $4,%esi subl $4,%esi
subl $4,%edi subl $4,%edi
decl %ebp decl %ebp
jnz Loop2 jnz L(oop2)
Lend2: shll %cl,%edx /* compute least significant limb */ L(end2):
shll %cl,%edx /* compute least significant limb */
movl %edx,(%edi) /* store it */ movl %edx,(%edi) /* store it */
popl %eax /* pop carry limb */ popl %eax /* pop carry limb */
@ -134,7 +136,7 @@ Lend2: shll %cl,%edx /* compute least significant limb */
function is documented to work for overlapping source and destination. function is documented to work for overlapping source and destination.
*/ */
Lspecial: L(special):
movl (%esi),%edx movl (%esi),%edx
addl $4,%esi addl $4,%esi
@ -145,12 +147,13 @@ Lspecial:
addl %edx,%edx addl %edx,%edx
incl %ebp incl %ebp
decl %ebp decl %ebp
jz LLend jz L(Lend)
movl (%edi),%eax /* fetch destination cache line */ movl (%edi),%eax /* fetch destination cache line */
ALIGN (2) ALIGN (2)
LLoop: movl 28(%edi),%eax /* fetch destination cache line */ L(Loop):
movl 28(%edi),%eax /* fetch destination cache line */
movl %edx,%ebx movl %edx,%ebx
movl (%esi),%eax movl (%esi),%eax
@ -184,14 +187,16 @@ LLoop: movl 28(%edi),%eax /* fetch destination cache line */
leal 32(%esi),%esi /* use leal not to clobber carry */ leal 32(%esi),%esi /* use leal not to clobber carry */
leal 32(%edi),%edi leal 32(%edi),%edi
decl %ebp decl %ebp
jnz LLoop jnz L(Loop)
LLend: popl %ebp L(Lend):
popl %ebp
sbbl %eax,%eax /* save carry in %eax */ sbbl %eax,%eax /* save carry in %eax */
andl $7,%ebp andl $7,%ebp
jz LLend2 jz L(Lend2)
addl %eax,%eax /* restore carry from eax */ addl %eax,%eax /* restore carry from eax */
LLoop2: movl %edx,%ebx L(Loop2):
movl %edx,%ebx
movl (%esi),%edx movl (%esi),%edx
adcl %edx,%edx adcl %edx,%edx
movl %ebx,(%edi) movl %ebx,(%edi)
@ -199,11 +204,12 @@ LLoop2: movl %edx,%ebx
leal 4(%esi),%esi /* use leal not to clobber carry */ leal 4(%esi),%esi /* use leal not to clobber carry */
leal 4(%edi),%edi leal 4(%edi),%edi
decl %ebp decl %ebp
jnz LLoop2 jnz L(Loop2)
jmp LL1 jmp L(L1)
LLend2: addl %eax,%eax /* restore carry from eax */ L(Lend2):
LL1: movl %edx,(%edi) /* store last limb */ addl %eax,%eax /* restore carry from eax */
L(L1): movl %edx,(%edi) /* store last limb */
sbbl %eax,%eax sbbl %eax,%eax
negl %eax negl %eax

View File

@ -1,25 +1,26 @@
/* memset/bzero -- set memory area to CH/0 /* memset/bzero -- set memory area to CH/0
Highly optimized version for ix85, x>=5. Highly optimized version for ix85, x>=5.
Copyright (C) 1996 Free Software Foundation, Inc. Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Torbjorn Granlund, <tege@matematik.su.se> Contributed by Torbjorn Granlund, <tege@matematik.su.se>
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <sysdep.h> #include <sysdep.h>
#include "asm-syntax.h"
/* /*
INPUT PARAMETERS: INPUT PARAMETERS:
@ -52,7 +53,7 @@ ENTRY (memset)
/* If less than 36 bytes to write, skip tricky code (it wouldn't work). */ /* If less than 36 bytes to write, skip tricky code (it wouldn't work). */
cmpl $36, %edx cmpl $36, %edx
movl %edx, %ecx /* needed when branch is taken! */ movl %edx, %ecx /* needed when branch is taken! */
jl L2 jl L(2)
/* First write 0-3 bytes to make the pointer 32-bit aligned. */ /* First write 0-3 bytes to make the pointer 32-bit aligned. */
movl %edi, %ecx /* Copy ptr to ecx... */ movl %edi, %ecx /* Copy ptr to ecx... */
@ -66,7 +67,7 @@ ENTRY (memset)
movl (%edi), %ecx /* Fetch destination cache line */ movl (%edi), %ecx /* Fetch destination cache line */
.align 2, 0x90 /* supply 0x90 for broken assemblers */ .align 2, 0x90 /* supply 0x90 for broken assemblers */
L1: movl 28(%edi), %ecx /* allocate cache line for destination */ L(1): movl 28(%edi), %ecx /* allocate cache line for destination */
subl $32, %edx /* decr loop count */ subl $32, %edx /* decr loop count */
movl %eax, 0(%edi) /* store words pairwise */ movl %eax, 0(%edi) /* store words pairwise */
movl %eax, 4(%edi) movl %eax, 4(%edi)
@ -77,12 +78,12 @@ L1: movl 28(%edi), %ecx /* allocate cache line for destination */
movl %eax, 24(%edi) movl %eax, 24(%edi)
movl %eax, 28(%edi) movl %eax, 28(%edi)
leal 32(%edi), %edi /* update destination pointer */ leal 32(%edi), %edi /* update destination pointer */
jge L1 jge L(1)
leal 32(%edx), %ecx /* reset offset count */ leal 32(%edx), %ecx /* reset offset count */
/* Write last 0-7 full 32-bit words (up to 8 words if loop was skipped). */ /* Write last 0-7 full 32-bit words (up to 8 words if loop was skipped). */
L2: shrl $2, %ecx /* convert byte count to longword count */ L(2): shrl $2, %ecx /* convert byte count to longword count */
rep rep
stosl stosl

View File

@ -1,24 +1,22 @@
/* Pentium __mpn_mul_1 -- Multiply a limb vector with a limb and store /* Pentium __mpn_mul_1 -- Multiply a limb vector with a limb and store
the result in a second limb vector. the result in a second limb vector.
Copyright (C) 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
Copyright (C) 1992, 1994, 1996 Free Software Foundation, Inc. The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This file is part of the GNU MP Library. The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
The GNU MP Library is free software; you can redistribute it and/or modify You should have received a copy of the GNU Library General Public License
it under the terms of the GNU Library General Public License as published by along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation; either version 2 of the License, or (at your the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
option) any later version. MA 02111-1307, USA. */
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/* /*
INPUT PARAMETERS INPUT PARAMETERS
@ -57,7 +55,7 @@ C_SYMBOL_NAME(__mpn_mul_1:)
INSN2(xor,l ,R(ebx),R(ebx)) INSN2(xor,l ,R(ebx),R(ebx))
ALIGN (3) ALIGN (3)
Loop: INSN2(adc,l ,R(ebx),$0) L(oop): INSN2(adc,l ,R(ebx),$0)
INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4)) INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4))
INSN1(mul,l ,R(s2_limb)) INSN1(mul,l ,R(s2_limb))
@ -68,7 +66,7 @@ Loop: INSN2(adc,l ,R(ebx),$0)
INSN1(inc,l ,R(size)) INSN1(inc,l ,R(size))
INSN2(mov,l ,R(ebx),R(edx)) INSN2(mov,l ,R(ebx),R(edx))
INSN1(jnz, ,Loop) INSN1(jnz, ,L(oop))
INSN2(adc,l ,R(ebx),$0) INSN2(adc,l ,R(ebx),$0)
INSN2(mov,l ,R(eax),R(ebx)) INSN2(mov,l ,R(eax),R(ebx))

View File

@ -1,23 +1,21 @@
/* Pentium optimized __mpn_rshift -- /* Pentium optimized __mpn_rshift --
Copyright (C) 1992, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
Copyright (C) 1992, 1994, 1995, 1996 Free Software Foundation, Inc. The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This file is part of the GNU MP Library. The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
The GNU MP Library is free software; you can redistribute it and/or modify You should have received a copy of the GNU Library General Public License
it under the terms of the GNU Library General Public License as published by along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation; either version 2 of the License, or (at your the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
option) any later version. MA 02111-1307, USA. */
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/* /*
INPUT PARAMETERS INPUT PARAMETERS
@ -46,15 +44,15 @@ C_SYMBOL_NAME(__mpn_rshift:)
/* We can use faster code for shift-by-1 under certain conditions. */ /* We can use faster code for shift-by-1 under certain conditions. */
cmp $1,%ecx cmp $1,%ecx
jne Lnormal jne L(normal)
leal 4(%edi),%eax leal 4(%edi),%eax
cmpl %esi,%eax cmpl %esi,%eax
jnc Lspecial /* jump if res_ptr + 1 >= s_ptr */ jnc L(special) /* jump if res_ptr + 1 >= s_ptr */
leal (%edi,%ebp,4),%eax leal (%edi,%ebp,4),%eax
cmpl %eax,%esi cmpl %eax,%esi
jnc Lspecial /* jump if s_ptr >= res_ptr + size */ jnc L(special) /* jump if s_ptr >= res_ptr + size */
Lnormal: L(normal):
movl (%esi),%edx movl (%esi),%edx
addl $4,%esi addl $4,%esi
xorl %eax,%eax xorl %eax,%eax
@ -64,12 +62,12 @@ Lnormal:
decl %ebp decl %ebp
pushl %ebp pushl %ebp
shrl $3,%ebp shrl $3,%ebp
jz Lend jz L(end)
movl (%edi),%eax /* fetch destination cache line */ movl (%edi),%eax /* fetch destination cache line */
ALIGN (2) ALIGN (2)
Loop: movl 28(%edi),%eax /* fetch destination cache line */ L(oop): movl 28(%edi),%eax /* fetch destination cache line */
movl %edx,%ebx movl %edx,%ebx
movl (%esi),%eax movl (%esi),%eax
@ -103,21 +101,23 @@ Loop: movl 28(%edi),%eax /* fetch destination cache line */
addl $32,%esi addl $32,%esi
addl $32,%edi addl $32,%edi
decl %ebp decl %ebp
jnz Loop jnz L(oop)
Lend: popl %ebp L(end): popl %ebp
andl $7,%ebp andl $7,%ebp
jz Lend2 jz L(end2)
Loop2: movl (%esi),%eax L(oop2):
movl (%esi),%eax
shrdl %cl,%eax,%edx /* compute result limb */ shrdl %cl,%eax,%edx /* compute result limb */
movl %edx,(%edi) movl %edx,(%edi)
movl %eax,%edx movl %eax,%edx
addl $4,%esi addl $4,%esi
addl $4,%edi addl $4,%edi
decl %ebp decl %ebp
jnz Loop2 jnz L(oop2)
Lend2: shrl %cl,%edx /* compute most significant limb */ L(end2):
shrl %cl,%edx /* compute most significant limb */
movl %edx,(%edi) /* store it */ movl %edx,(%edi) /* store it */
popl %eax /* pop carry limb */ popl %eax /* pop carry limb */
@ -133,7 +133,7 @@ Lend2: shrl %cl,%edx /* compute most significant limb */
function is documented to work for overlapping source and destination. function is documented to work for overlapping source and destination.
*/ */
Lspecial: L(special):
leal -4(%edi,%ebp,4),%edi leal -4(%edi,%ebp,4),%edi
leal -4(%esi,%ebp,4),%esi leal -4(%esi,%ebp,4),%esi
@ -147,12 +147,13 @@ Lspecial:
shrl $1,%edx shrl $1,%edx
incl %ebp incl %ebp
decl %ebp decl %ebp
jz LLend jz L(Lend)
movl (%edi),%eax /* fetch destination cache line */ movl (%edi),%eax /* fetch destination cache line */
ALIGN (2) ALIGN (2)
LLoop: movl -28(%edi),%eax /* fetch destination cache line */ L(Loop):
movl -28(%edi),%eax /* fetch destination cache line */
movl %edx,%ebx movl %edx,%ebx
movl (%esi),%eax movl (%esi),%eax
@ -186,14 +187,16 @@ LLoop: movl -28(%edi),%eax /* fetch destination cache line */
leal -32(%esi),%esi /* use leal not to clobber carry */ leal -32(%esi),%esi /* use leal not to clobber carry */
leal -32(%edi),%edi leal -32(%edi),%edi
decl %ebp decl %ebp
jnz LLoop jnz L(Loop)
LLend: popl %ebp L(Lend):
popl %ebp
sbbl %eax,%eax /* save carry in %eax */ sbbl %eax,%eax /* save carry in %eax */
andl $7,%ebp andl $7,%ebp
jz LLend2 jz L(Lend2)
addl %eax,%eax /* restore carry from eax */ addl %eax,%eax /* restore carry from eax */
LLoop2: movl %edx,%ebx L(Loop2):
movl %edx,%ebx
movl (%esi),%edx movl (%esi),%edx
rcrl $1,%edx rcrl $1,%edx
movl %ebx,(%edi) movl %ebx,(%edi)
@ -201,11 +204,12 @@ LLoop2: movl %edx,%ebx
leal -4(%esi),%esi /* use leal not to clobber carry */ leal -4(%esi),%esi /* use leal not to clobber carry */
leal -4(%edi),%edi leal -4(%edi),%edi
decl %ebp decl %ebp
jnz LLoop2 jnz L(Loop2)
jmp LL1 jmp L(L1)
LLend2: addl %eax,%eax /* restore carry from eax */ L(Lend2):
LL1: movl %edx,(%edi) /* store last limb */ addl %eax,%eax /* restore carry from eax */
L(L1): movl %edx,(%edi) /* store last limb */
movl $0,%eax movl $0,%eax
rcrl $1,%eax rcrl $1,%eax

View File

@ -1,6 +1,6 @@
/* strchr -- find character CH in a NUL terminated string. /* Find character CH in a NUL terminated string.
Highly optimized version for ix85, x>=5. Highly optimized version for ix85, x>=5.
Copyright (C) 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>. Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
@ -20,6 +20,7 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <sysdep.h> #include <sysdep.h>
#include "asm-syntax.h"
/* This version is especially optimized for the i586 (and following?) /* This version is especially optimized for the i586 (and following?)
processors. This is mainly done by using the two pipelines. The processors. This is mainly done by using the two pipelines. The
@ -67,38 +68,38 @@ ENTRY (strchr)
orl %ecx, %edx /* and finally c|c|c|c */ orl %ecx, %edx /* and finally c|c|c|c */
andl $3, %edi /* mask alignment bits */ andl $3, %edi /* mask alignment bits */
jz L11 /* alignment is 0 => start loop */ jz L(11) /* alignment is 0 => start loop */
movb %dl, %cl /* 0 is needed below */ movb %dl, %cl /* 0 is needed below */
jp L0 /* exactly two bits set */ jp L(0) /* exactly two bits set */
xorb (%eax), %cl /* is byte the one we are looking for? */ xorb (%eax), %cl /* is byte the one we are looking for? */
jz L2 /* yes => return pointer */ jz L(2) /* yes => return pointer */
xorb %dl, %cl /* load single byte and test for NUL */ xorb %dl, %cl /* load single byte and test for NUL */
je L3 /* yes => return NULL */ je L(3) /* yes => return NULL */
movb 1(%eax), %cl /* load single byte */ movb 1(%eax), %cl /* load single byte */
incl %eax incl %eax
cmpb %cl, %dl /* is byte == C? */ cmpb %cl, %dl /* is byte == C? */
je L2 /* aligned => return pointer */ je L(2) /* aligned => return pointer */
cmpb $0, %cl /* is byte NUL? */ cmpb $0, %cl /* is byte NUL? */
je L3 /* yes => return NULL */ je L(3) /* yes => return NULL */
incl %eax incl %eax
decl %edi decl %edi
jne L11 jne L(11)
L0: movb (%eax), %cl /* load single byte */ L(0): movb (%eax), %cl /* load single byte */
cmpb %cl, %dl /* is byte == C? */ cmpb %cl, %dl /* is byte == C? */
je L2 /* aligned => return pointer */ je L(2) /* aligned => return pointer */
cmpb $0, %cl /* is byte NUL? */ cmpb $0, %cl /* is byte NUL? */
je L3 /* yes => return NULL */ je L(3) /* yes => return NULL */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
@ -106,7 +107,7 @@ L0: movb (%eax), %cl /* load single byte */
four instruction up to `L1' will not be executed in the loop four instruction up to `L1' will not be executed in the loop
because the same code is found at the end of the loop, but because the same code is found at the end of the loop, but
there it is executed in parallel with other instructions. */ there it is executed in parallel with other instructions. */
L11: movl (%eax), %ecx L(11): movl (%eax), %ecx
movl $magic, %ebp movl $magic, %ebp
movl $magic, %edi movl $magic, %edi
@ -135,17 +136,17 @@ L11: movl (%eax), %ecx
C allows us to overlap the test for 0 in the next word with C allows us to overlap the test for 0 in the next word with
the test for C. */ the test for C. */
L1: xorl %ecx, %ebp /* (word^magic) */ L(1): xorl %ecx, %ebp /* (word^magic) */
addl %ecx, %edi /* add magic word */ addl %ecx, %edi /* add magic word */
leal 4(%eax), %eax /* increment pointer */ leal 4(%eax), %eax /* increment pointer */
jnc L4 /* previous addl caused overflow? */ jnc L(4) /* previous addl caused overflow? */
movl %ecx, %ebx /* duplicate original word */ movl %ecx, %ebx /* duplicate original word */
orl $magic, %ebp /* (word^magic)|magic */ orl $magic, %ebp /* (word^magic)|magic */
addl $1, %ebp /* (word^magic)|magic == 0xffffffff? */ addl $1, %ebp /* (word^magic)|magic == 0xffffffff? */
jne L4 /* yes => we found word with NUL */ jne L(4) /* yes => we found word with NUL */
movl $magic, %esi /* load magic value */ movl $magic, %esi /* load magic value */
xorl %edx, %ebx /* clear words which are C */ xorl %edx, %ebx /* clear words which are C */
@ -154,7 +155,7 @@ L1: xorl %ecx, %ebp /* (word^magic) */
addl %ebx, %esi /* (word+magic) */ addl %ebx, %esi /* (word+magic) */
movl $magic, %edi movl $magic, %edi
jnc L5 /* previous addl caused overflow? */ jnc L(5) /* previous addl caused overflow? */
movl %edi, %ebp movl %edi, %ebp
xorl %ebx, %esi /* (word+magic)^word */ xorl %ebx, %esi /* (word+magic)^word */
@ -163,19 +164,19 @@ L1: xorl %ecx, %ebp /* (word^magic) */
orl $magic, %esi /* ((word+magic)^word)|magic */ orl $magic, %esi /* ((word+magic)^word)|magic */
addl $1, %esi /* ((word+magic)^word)|magic==0xf..f?*/ addl $1, %esi /* ((word+magic)^word)|magic==0xf..f?*/
jne L5 /* yes => we found word with C */ jne L(5) /* yes => we found word with C */
xorl %ecx, %ebp xorl %ecx, %ebp
addl %ecx, %edi addl %ecx, %edi
leal 4(%eax), %eax leal 4(%eax), %eax
jnc L4 jnc L(4)
movl %ecx, %ebx movl %ecx, %ebx
orl $magic, %ebp orl $magic, %ebp
addl $1, %ebp addl $1, %ebp
jne L4 jne L(4)
movl $magic, %esi movl $magic, %esi
xorl %edx, %ebx xorl %edx, %ebx
@ -184,7 +185,7 @@ L1: xorl %ecx, %ebp /* (word^magic) */
addl %ebx, %esi addl %ebx, %esi
movl $magic, %edi movl $magic, %edi
jnc L5 jnc L(5)
movl %edi, %ebp movl %edi, %ebp
xorl %ebx, %esi xorl %ebx, %esi
@ -193,19 +194,19 @@ L1: xorl %ecx, %ebp /* (word^magic) */
orl $magic, %esi orl $magic, %esi
addl $1, %esi addl $1, %esi
jne L5 jne L(5)
xorl %ecx, %ebp xorl %ecx, %ebp
addl %ecx, %edi addl %ecx, %edi
leal 4(%eax), %eax leal 4(%eax), %eax
jnc L4 jnc L(4)
movl %ecx, %ebx movl %ecx, %ebx
orl $magic, %ebp orl $magic, %ebp
addl $1, %ebp addl $1, %ebp
jne L4 jne L(4)
movl $magic, %esi movl $magic, %esi
xorl %edx, %ebx xorl %edx, %ebx
@ -214,7 +215,7 @@ L1: xorl %ecx, %ebp /* (word^magic) */
addl %ebx, %esi addl %ebx, %esi
movl $magic, %edi movl $magic, %edi
jnc L5 jnc L(5)
movl %edi, %ebp movl %edi, %ebp
xorl %ebx, %esi xorl %ebx, %esi
@ -223,19 +224,19 @@ L1: xorl %ecx, %ebp /* (word^magic) */
orl $magic, %esi orl $magic, %esi
addl $1, %esi addl $1, %esi
jne L5 jne L(5)
xorl %ecx, %ebp xorl %ecx, %ebp
addl %ecx, %edi addl %ecx, %edi
leal 4(%eax), %eax leal 4(%eax), %eax
jnc L4 jnc L(4)
movl %ecx, %ebx movl %ecx, %ebx
orl $magic, %ebp orl $magic, %ebp
addl $1, %ebp addl $1, %ebp
jne L4 jne L(4)
movl $magic, %esi movl $magic, %esi
xorl %edx, %ebx xorl %edx, %ebx
@ -244,7 +245,7 @@ L1: xorl %ecx, %ebp /* (word^magic) */
addl %ebx, %esi addl %ebx, %esi
movl $magic, %edi movl $magic, %edi
jnc L5 jnc L(5)
movl %edi, %ebp movl %edi, %ebp
xorl %ebx, %esi xorl %ebx, %esi
@ -254,29 +255,29 @@ L1: xorl %ecx, %ebp /* (word^magic) */
addl $1, %esi addl $1, %esi
je L1 je L(1)
/* We know there is no NUL byte but a C byte in the word. /* We know there is no NUL byte but a C byte in the word.
%ebx contains NUL in this particular byte. */ %ebx contains NUL in this particular byte. */
L5: subl $4, %eax /* adjust pointer */ L(5): subl $4, %eax /* adjust pointer */
testb %bl, %bl /* first byte == C? */ testb %bl, %bl /* first byte == C? */
jz L2 /* yes => return pointer */ jz L(2) /* yes => return pointer */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
testb %bh, %bh /* second byte == C? */ testb %bh, %bh /* second byte == C? */
jz L2 /* yes => return pointer */ jz L(2) /* yes => return pointer */
shrl $16, %ebx /* make upper bytes accessible */ shrl $16, %ebx /* make upper bytes accessible */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
cmp $0, %bl /* third byte == C */ cmp $0, %bl /* third byte == C */
je L2 /* yes => return pointer */ je L(2) /* yes => return pointer */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
L2: popl %ebp /* restore saved registers */ L(2): popl %ebp /* restore saved registers */
popl %ebx popl %ebx
popl %esi popl %esi
@ -286,38 +287,38 @@ L2: popl %ebp /* restore saved registers */
/* We know there is a NUL byte in the word. But we have to test /* We know there is a NUL byte in the word. But we have to test
whether there is an C byte before it in the word. */ whether there is an C byte before it in the word. */
L4: subl $4, %eax /* adjust pointer */ L(4): subl $4, %eax /* adjust pointer */
cmpb %dl, %cl /* first byte == C? */ cmpb %dl, %cl /* first byte == C? */
je L2 /* yes => return pointer */ je L(2) /* yes => return pointer */
cmpb $0, %cl /* first byte == NUL? */ cmpb $0, %cl /* first byte == NUL? */
je L3 /* yes => return NULL */ je L(3) /* yes => return NULL */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
cmpb %dl, %ch /* second byte == C? */ cmpb %dl, %ch /* second byte == C? */
je L2 /* yes => return pointer */ je L(2) /* yes => return pointer */
cmpb $0, %ch /* second byte == NUL? */ cmpb $0, %ch /* second byte == NUL? */
je L3 /* yes => return NULL */ je L(3) /* yes => return NULL */
shrl $16, %ecx /* make upper bytes accessible */ shrl $16, %ecx /* make upper bytes accessible */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
cmpb %dl, %cl /* third byte == C? */ cmpb %dl, %cl /* third byte == C? */
je L2 /* yes => return pointer */ je L(2) /* yes => return pointer */
cmpb $0, %cl /* third byte == NUL? */ cmpb $0, %cl /* third byte == NUL? */
je L3 /* yes => return NULL */ je L(3) /* yes => return NULL */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
/* The test four the fourth byte is necessary! */ /* The test four the fourth byte is necessary! */
cmpb %dl, %ch /* fourth byte == C? */ cmpb %dl, %ch /* fourth byte == C? */
je L2 /* yes => return pointer */ je L(2) /* yes => return pointer */
L3: xorl %eax, %eax /* set return value = NULL */ L(3): xorl %eax, %eax /* set return value = NULL */
popl %ebp /* restore saved registers */ popl %ebp /* restore saved registers */
popl %ebx popl %ebx

View File

@ -1,6 +1,6 @@
/* strlen -- Compute length og NUL terminated string. /* strlen -- Compute length og NUL terminated string.
Highly optimized version for ix86, x>=5. Highly optimized version for ix86, x>=5.
Copyright (C) 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>. Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
@ -20,6 +20,7 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <sysdep.h> #include <sysdep.h>
#include "asm-syntax.h"
/* This version is especially optimized for the i586 (and following?) /* This version is especially optimized for the i586 (and following?)
processors. This is mainly done by using the two pipelines. The processors. This is mainly done by using the two pipelines. The
@ -46,24 +47,24 @@ ENTRY(strlen)
andl %eax, %edx /* separate last two bits of address */ andl %eax, %edx /* separate last two bits of address */
jz L1 /* aligned => start loop */ jz L(1) /* aligned => start loop */
jp L0 /* exactly two bits set */ jp L(0) /* exactly two bits set */
cmpb %dh, (%eax) /* is byte NUL? */ cmpb %dh, (%eax) /* is byte NUL? */
je L2 /* yes => return */ je L(2) /* yes => return */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
cmpb %dh, (%eax) /* is byte NUL? */ cmpb %dh, (%eax) /* is byte NUL? */
je L2 /* yes => return */ je L(2) /* yes => return */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
xorl $2, %edx xorl $2, %edx
jz L1 jz L(1)
L0: cmpb %dh, (%eax) /* is byte NUL? */ L(0): cmpb %dh, (%eax) /* is byte NUL? */
je L2 /* yes => return */ je L(2) /* yes => return */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
xorl %edx, %edx /* We need %edx == 0 for later */ xorl %edx, %edx /* We need %edx == 0 for later */
@ -91,7 +92,7 @@ L0: cmpb %dh, (%eax) /* is byte NUL? */
Note: %edx == 0 in any case here. */ Note: %edx == 0 in any case here. */
L1: L(1):
movl (%eax), %ecx /* get word (= 4 bytes) in question */ movl (%eax), %ecx /* get word (= 4 bytes) in question */
addl $4, %eax /* adjust pointer for *next* word */ addl $4, %eax /* adjust pointer for *next* word */
@ -99,13 +100,13 @@ L1:
addl $magic, %ecx /* add magic word */ addl $magic, %ecx /* add magic word */
decl %edx /* complete negation of word */ decl %edx /* complete negation of word */
jnc L3 /* previous addl caused overflow? */ jnc L(3) /* previous addl caused overflow? */
xorl %ecx, %edx /* (word+magic)^word */ xorl %ecx, %edx /* (word+magic)^word */
andl $~magic, %edx /* any of the carry flags set? */ andl $~magic, %edx /* any of the carry flags set? */
jne L3 /* yes => determine byte */ jne L(3) /* yes => determine byte */
movl (%eax), %ecx /* get word (= 4 bytes) in question */ movl (%eax), %ecx /* get word (= 4 bytes) in question */
@ -115,13 +116,13 @@ L1:
addl $magic, %ecx /* add magic word */ addl $magic, %ecx /* add magic word */
decl %edx /* complete negation of word */ decl %edx /* complete negation of word */
jnc L3 /* previous addl caused overflow? */ jnc L(3) /* previous addl caused overflow? */
xorl %ecx, %edx /* (word+magic)^word */ xorl %ecx, %edx /* (word+magic)^word */
andl $~magic, %edx /* any of the carry flags set? */ andl $~magic, %edx /* any of the carry flags set? */
jne L3 /* yes => determine byte */ jne L(3) /* yes => determine byte */
movl (%eax), %ecx /* get word (= 4 bytes) in question */ movl (%eax), %ecx /* get word (= 4 bytes) in question */
@ -131,13 +132,13 @@ L1:
addl $magic, %ecx /* add magic word */ addl $magic, %ecx /* add magic word */
decl %edx /* complete negation of word */ decl %edx /* complete negation of word */
jnc L3 /* previous addl caused overflow? */ jnc L(3) /* previous addl caused overflow? */
xorl %ecx, %edx /* (word+magic)^word */ xorl %ecx, %edx /* (word+magic)^word */
andl $~magic, %edx /* any of the carry flags set? */ andl $~magic, %edx /* any of the carry flags set? */
jne L3 /* yes => determine byte */ jne L(3) /* yes => determine byte */
movl (%eax), %ecx /* get word (= 4 bytes) in question */ movl (%eax), %ecx /* get word (= 4 bytes) in question */
@ -147,35 +148,35 @@ L1:
addl $magic, %ecx /* add magic word */ addl $magic, %ecx /* add magic word */
decl %edx /* complete negation of word */ decl %edx /* complete negation of word */
jnc L3 /* previous addl caused overflow? */ jnc L(3) /* previous addl caused overflow? */
xorl %ecx, %edx /* (word+magic)^word */ xorl %ecx, %edx /* (word+magic)^word */
andl $~magic, %edx /* any of the carry flags set? */ andl $~magic, %edx /* any of the carry flags set? */
je L1 /* no => start loop again */ je L(1) /* no => start loop again */
L3: subl $4, %eax /* correct too early pointer increment */ L(3): subl $4, %eax /* correct too early pointer increment */
subl $magic, %ecx subl $magic, %ecx
cmpb $0, %cl /* lowest byte NUL? */ cmpb $0, %cl /* lowest byte NUL? */
jz L2 /* yes => return */ jz L(2) /* yes => return */
inc %eax /* increment pointer */ inc %eax /* increment pointer */
testb %ch, %ch /* second byte NUL? */ testb %ch, %ch /* second byte NUL? */
jz L2 /* yes => return */ jz L(2) /* yes => return */
shrl $16, %ecx /* make upper bytes accessible */ shrl $16, %ecx /* make upper bytes accessible */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
cmpb $0, %cl /* is third byte NUL? */ cmpb $0, %cl /* is third byte NUL? */
jz L2 /* yes => return */ jz L(2) /* yes => return */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
L2: subl 4(%esp), %eax /* now compute the length as difference L(2): subl 4(%esp), %eax /* now compute the length as difference
between start and terminating NUL between start and terminating NUL
character */ character */

View File

@ -1,24 +1,22 @@
/* Pentium __mpn_sub_n -- Subtract two limb vectors of the same length > 0 /* Pentium __mpn_sub_n -- Subtract two limb vectors of the same length > 0
and store difference in a third limb vector. and store difference in a third limb vector.
Copyright (C) 1992, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
Copyright (C) 1992, 1994, 1995, 1996 Free Software Foundation, Inc. The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This file is part of the GNU MP Library. The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
The GNU MP Library is free software; you can redistribute it and/or modify You should have received a copy of the GNU Library General Public License
it under the terms of the GNU Library General Public License as published by along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation; either version 2 of the License, or (at your the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
option) any later version. MA 02111-1307, USA. */
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/* /*
INPUT PARAMETERS INPUT PARAMETERS
@ -52,14 +50,14 @@ C_SYMBOL_NAME(__mpn_sub_n:)
shrl $3,%ecx shrl $3,%ecx
andl $7,%edx andl $7,%edx
testl %ecx,%ecx /* zero carry flag */ testl %ecx,%ecx /* zero carry flag */
jz Lend jz L(end)
pushl %edx pushl %edx
ALIGN (3) ALIGN (3)
Loop: movl 28(%edi),%eax /* fetch destination cache line */ L(oop): movl 28(%edi),%eax /* fetch destination cache line */
leal 32(%edi),%edi leal 32(%edi),%edi
L1: movl (%esi),%eax L(1): movl (%esi),%eax
movl 4(%esi),%edx movl 4(%esi),%edx
sbbl %ebx,%eax sbbl %ebx,%eax
movl 4(%ebp),%ebx movl 4(%ebp),%ebx
@ -68,7 +66,7 @@ L1: movl (%esi),%eax
movl %eax,-32(%edi) movl %eax,-32(%edi)
movl %edx,-28(%edi) movl %edx,-28(%edi)
L2: movl 8(%esi),%eax L(2): movl 8(%esi),%eax
movl 12(%esi),%edx movl 12(%esi),%edx
sbbl %ebx,%eax sbbl %ebx,%eax
movl 12(%ebp),%ebx movl 12(%ebp),%ebx
@ -77,7 +75,7 @@ L2: movl 8(%esi),%eax
movl %eax,-24(%edi) movl %eax,-24(%edi)
movl %edx,-20(%edi) movl %edx,-20(%edi)
L3: movl 16(%esi),%eax L(3): movl 16(%esi),%eax
movl 20(%esi),%edx movl 20(%esi),%edx
sbbl %ebx,%eax sbbl %ebx,%eax
movl 20(%ebp),%ebx movl 20(%ebp),%ebx
@ -86,7 +84,7 @@ L3: movl 16(%esi),%eax
movl %eax,-16(%edi) movl %eax,-16(%edi)
movl %edx,-12(%edi) movl %edx,-12(%edi)
L4: movl 24(%esi),%eax L(4): movl 24(%esi),%eax
movl 28(%esi),%edx movl 28(%esi),%edx
sbbl %ebx,%eax sbbl %ebx,%eax
movl 28(%ebp),%ebx movl 28(%ebp),%ebx
@ -98,14 +96,14 @@ L4: movl 24(%esi),%eax
leal 32(%esi),%esi leal 32(%esi),%esi
leal 32(%ebp),%ebp leal 32(%ebp),%ebp
decl %ecx decl %ecx
jnz Loop jnz L(oop)
popl %edx popl %edx
Lend: L(end):
decl %edx /* test %edx w/o clobbering carry */ decl %edx /* test %edx w/o clobbering carry */
js Lend2 js L(end2)
incl %edx incl %edx
Loop2: L(oop2):
leal 4(%edi),%edi leal 4(%edi),%edi
movl (%esi),%eax movl (%esi),%eax
sbbl %ebx,%eax sbbl %ebx,%eax
@ -114,8 +112,8 @@ Loop2:
leal 4(%esi),%esi leal 4(%esi),%esi
leal 4(%ebp),%ebp leal 4(%ebp),%ebp
decl %edx decl %edx
jnz Loop2 jnz L(oop2)
Lend2: L(end2):
movl (%esi),%eax movl (%esi),%eax
sbbl %ebx,%eax sbbl %ebx,%eax
movl %eax,(%edi) movl %eax,(%edi)

View File

@ -1,24 +1,22 @@
/* Pentium __mpn_submul_1 -- Multiply a limb vector with a limb and subtract /* Pentium __mpn_submul_1 -- Multiply a limb vector with a limb and subtract
the result from a second limb vector. the result from a second limb vector.
Copyright (C) 1992, 1994, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
Copyright (C) 1992, 1994, 1996 Free Software Foundation, Inc. The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This file is part of the GNU MP Library. The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
The GNU MP Library is free software; you can redistribute it and/or modify You should have received a copy of the GNU Library General Public License
it under the terms of the GNU Library General Public License as published by along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation; either version 2 of the License, or (at your the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
option) any later version. MA 02111-1307, USA. */
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/* /*
INPUT PARAMETERS INPUT PARAMETERS
@ -57,7 +55,7 @@ C_SYMBOL_NAME(__mpn_submul_1:)
INSN2(xor,l ,R(ebx),R(ebx)) INSN2(xor,l ,R(ebx),R(ebx))
ALIGN (3) ALIGN (3)
Loop: INSN2(adc,l ,R(ebx),$0) L(oop): INSN2(adc,l ,R(ebx),$0)
INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4)) INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4))
INSN1(mul,l ,R(s2_limb)) INSN1(mul,l ,R(s2_limb))
@ -72,7 +70,7 @@ Loop: INSN2(adc,l ,R(ebx),$0)
INSN1(inc,l ,R(size)) INSN1(inc,l ,R(size))
INSN2(mov,l ,R(ebx),R(edx)) INSN2(mov,l ,R(ebx),R(edx))
INSN1(jnz, ,Loop) INSN1(jnz, ,L(oop))
INSN2(adc,l ,R(ebx),$0) INSN2(adc,l ,R(ebx),$0)
INSN2(mov,l ,R(eax),R(ebx)) INSN2(mov,l ,R(eax),R(ebx))

View File

@ -1,23 +1,21 @@
/* i80386 __mpn_lshift -- /* i80386 __mpn_lshift --
Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
Copyright (C) 1992, 1994 Free Software Foundation, Inc. The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This file is part of the GNU MP Library. The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
The GNU MP Library is free software; you can redistribute it and/or modify You should have received a copy of the GNU Library General Public License
it under the terms of the GNU Library General Public License as published by along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation; either version 2 of the License, or (at your the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
option) any later version. MA 02111-1307, USA. */
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/* /*
INPUT PARAMETERS INPUT PARAMETERS
@ -49,22 +47,22 @@ C_SYMBOL_NAME(__mpn_lshift:)
xorl %eax,%eax xorl %eax,%eax
shldl %cl,%ebx,%eax /* compute carry limb */ shldl %cl,%ebx,%eax /* compute carry limb */
decl %edx decl %edx
jz Lend jz L(end)
pushl %eax /* push carry limb onto stack */ pushl %eax /* push carry limb onto stack */
testb $1,%edx testb $1,%edx
jnz L1 /* enter loop in the middle */ jnz L(1) /* enter loop in the middle */
movl %ebx,%eax movl %ebx,%eax
ALIGN (3) ALIGN (3)
Loop: movl (%esi,%edx,4),%ebx /* load next lower limb */ L(oop): movl (%esi,%edx,4),%ebx /* load next lower limb */
shldl %cl,%ebx,%eax /* compute result limb */ shldl %cl,%ebx,%eax /* compute result limb */
movl %eax,(%edi,%edx,4) /* store it */ movl %eax,(%edi,%edx,4) /* store it */
decl %edx decl %edx
L1: movl (%esi,%edx,4),%eax L(1): movl (%esi,%edx,4),%eax
shldl %cl,%eax,%ebx shldl %cl,%eax,%ebx
movl %ebx,(%edi,%edx,4) movl %ebx,(%edi,%edx,4)
decl %edx decl %edx
jnz Loop jnz L(oop)
shll %cl,%eax /* compute least significant limb */ shll %cl,%eax /* compute least significant limb */
movl %eax,(%edi) /* store it */ movl %eax,(%edi) /* store it */
@ -76,7 +74,7 @@ L1: movl (%esi,%edx,4),%eax
popl %edi popl %edi
ret ret
Lend: shll %cl,%ebx /* compute least significant limb */ L(end): shll %cl,%ebx /* compute least significant limb */
movl %ebx,(%edi) /* store it */ movl %ebx,(%edi) /* store it */
popl %ebx popl %ebx

View File

@ -1,7 +1,7 @@
/* memchr (str, ch, n) -- Return pointer to first occurrence of CH in STR less /* memchr (str, ch, n) -- Return pointer to first occurrence of CH in STR less
than N. than N.
For Intel 80x86, x>=3. For Intel 80x86, x>=3.
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
Optimised a little by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> Optimised a little by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@ -54,7 +54,7 @@ ENTRY (memchr)
/* If my must not test more than three characters test /* If my must not test more than three characters test
them one by one. This is especially true for 0. */ them one by one. This is especially true for 0. */
cmpl $4, %esi cmpl $4, %esi
jb L3 jb L(3)
/* At the moment %edx contains C. What we need for the /* At the moment %edx contains C. What we need for the
algorithm is C in all bytes of the dword. Avoid algorithm is C in all bytes of the dword. Avoid
@ -71,30 +71,30 @@ ENTRY (memchr)
reached. Don't use a loop for better performance. */ reached. Don't use a loop for better performance. */
testb $3, %eax /* correctly aligned ? */ testb $3, %eax /* correctly aligned ? */
je L2 /* yes => begin loop */ je L(2) /* yes => begin loop */
cmpb %dl, (%eax) /* compare byte */ cmpb %dl, (%eax) /* compare byte */
je L9 /* target found => return */ je L(9) /* target found => return */
incl %eax /* increment source pointer */ incl %eax /* increment source pointer */
decl %esi /* decrement length counter */ decl %esi /* decrement length counter */
je L4 /* len==0 => return NULL */ je L(4) /* len==0 => return NULL */
testb $3, %eax /* correctly aligned ? */ testb $3, %eax /* correctly aligned ? */
je L2 /* yes => begin loop */ je L(2) /* yes => begin loop */
cmpb %dl, (%eax) /* compare byte */ cmpb %dl, (%eax) /* compare byte */
je L9 /* target found => return */ je L(9) /* target found => return */
incl %eax /* increment source pointer */ incl %eax /* increment source pointer */
decl %esi /* decrement length counter */ decl %esi /* decrement length counter */
je L4 /* len==0 => return NULL */ je L(4) /* len==0 => return NULL */
testb $3, %eax /* correctly aligned ? */ testb $3, %eax /* correctly aligned ? */
je L2 /* yes => begin loop */ je L(2) /* yes => begin loop */
cmpb %dl, (%eax) /* compare byte */ cmpb %dl, (%eax) /* compare byte */
je L9 /* target found => return */ je L(9) /* target found => return */
incl %eax /* increment source pointer */ incl %eax /* increment source pointer */
decl %esi /* decrement length counter */ decl %esi /* decrement length counter */
/* no test for len==0 here, because this is done in the /* no test for len==0 here, because this is done in the
loop head */ loop head */
jmp L2 jmp L(2)
/* We exit the loop if adding MAGIC_BITS to LONGWORD fails to /* We exit the loop if adding MAGIC_BITS to LONGWORD fails to
change any of the hole bits of LONGWORD. change any of the hole bits of LONGWORD.
@ -127,7 +127,7 @@ ENTRY (memchr)
ALIGN (4) ALIGN (4)
L1: movl (%eax), %ecx /* get word (= 4 bytes) in question */ L(1): movl (%eax), %ecx /* get word (= 4 bytes) in question */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
xorl %edx, %ecx /* XOR with word c|c|c|c => bytes of str == c xorl %edx, %ecx /* XOR with word c|c|c|c => bytes of str == c
are now 0 */ are now 0 */
@ -141,7 +141,7 @@ L1: movl (%eax), %ecx /* get word (= 4 bytes) in question */
representation with more than 32 bits) not alter then last representation with more than 32 bits) not alter then last
overflow, we can now test this condition. If no carry is signaled overflow, we can now test this condition. If no carry is signaled
no overflow must have occurred in the last byte => it was 0. */ no overflow must have occurred in the last byte => it was 0. */
jnc L8 jnc L(8)
/* We are only interested in carry bits that change due to the /* We are only interested in carry bits that change due to the
previous add, so remove original bits */ previous add, so remove original bits */
@ -153,7 +153,7 @@ L1: movl (%eax), %ecx /* get word (= 4 bytes) in question */
the addition will not result in 0. */ the addition will not result in 0. */
/* If at least one byte of the word is C we don't get 0 in %edi. */ /* If at least one byte of the word is C we don't get 0 in %edi. */
jnz L8 /* found it => return pointer */ jnz L(8) /* found it => return pointer */
/* This process is unfolded four times for better performance. /* This process is unfolded four times for better performance.
we don't increment the source pointer each time. Instead we we don't increment the source pointer each time. Instead we
@ -169,12 +169,12 @@ L1: movl (%eax), %ecx /* get word (= 4 bytes) in question */
addl %ecx, %edi /* add the magic value to the word. We get addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L7 /* highest byte is C => return pointer */ jnc L(7) /* highest byte is C => return pointer */
xorl %ecx, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %ecx, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L7 /* found it => return pointer */ jnz L(7) /* found it => return pointer */
movl 8(%eax), %ecx /* get word (= 4 bytes) in question */ movl 8(%eax), %ecx /* get word (= 4 bytes) in question */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
@ -183,12 +183,12 @@ L1: movl (%eax), %ecx /* get word (= 4 bytes) in question */
addl %ecx, %edi /* add the magic value to the word. We get addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L6 /* highest byte is C => return pointer */ jnc L(6) /* highest byte is C => return pointer */
xorl %ecx, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %ecx, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L6 /* found it => return pointer */ jnz L(6) /* found it => return pointer */
movl 12(%eax), %ecx /* get word (= 4 bytes) in question */ movl 12(%eax), %ecx /* get word (= 4 bytes) in question */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
@ -197,21 +197,21 @@ L1: movl (%eax), %ecx /* get word (= 4 bytes) in question */
addl %ecx, %edi /* add the magic value to the word. We get addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L5 /* highest byte is C => return pointer */ jnc L(5) /* highest byte is C => return pointer */
xorl %ecx, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %ecx, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L5 /* found it => return pointer */ jnz L(5) /* found it => return pointer */
/* Adjust both counters for a full round, i.e. 16 bytes. */ /* Adjust both counters for a full round, i.e. 16 bytes. */
addl $16, %eax addl $16, %eax
L2: subl $16, %esi L(2): subl $16, %esi
jae L1 /* Still more than 16 bytes remaining */ jae L(1) /* Still more than 16 bytes remaining */
/* Process remaining bytes separately. */ /* Process remaining bytes separately. */
cmpl $4-16, %esi /* rest < 4 bytes? */ cmpl $4-16, %esi /* rest < 4 bytes? */
jb L3 /* yes, than test byte by byte */ jb L(3) /* yes, than test byte by byte */
movl (%eax), %ecx /* get word (= 4 bytes) in question */ movl (%eax), %ecx /* get word (= 4 bytes) in question */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
@ -220,16 +220,16 @@ L2: subl $16, %esi
addl %ecx, %edi /* add the magic value to the word. We get addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L8 /* highest byte is C => return pointer */ jnc L(8) /* highest byte is C => return pointer */
xorl %ecx, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %ecx, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jne L8 /* found it => return pointer */ jne L(8) /* found it => return pointer */
addl $4, %eax /* adjust source pointer */ addl $4, %eax /* adjust source pointer */
cmpl $8-16, %esi /* rest < 8 bytes? */ cmpl $8-16, %esi /* rest < 8 bytes? */
jb L3 /* yes, than test byte by byte */ jb L(3) /* yes, than test byte by byte */
movl (%eax), %ecx /* get word (= 4 bytes) in question */ movl (%eax), %ecx /* get word (= 4 bytes) in question */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
@ -238,16 +238,16 @@ L2: subl $16, %esi
addl %ecx, %edi /* add the magic value to the word. We get addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L8 /* highest byte is C => return pointer */ jnc L(8) /* highest byte is C => return pointer */
xorl %ecx, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %ecx, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jne L8 /* found it => return pointer */ jne L(8) /* found it => return pointer */
addl $4, %eax /* adjust source pointer */ addl $4, %eax /* adjust source pointer */
cmpl $12-16, %esi /* rest < 12 bytes? */ cmpl $12-16, %esi /* rest < 12 bytes? */
jb L3 /* yes, than test byte by byte */ jb L(3) /* yes, than test byte by byte */
movl (%eax), %ecx /* get word (= 4 bytes) in question */ movl (%eax), %ecx /* get word (= 4 bytes) in question */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
@ -256,60 +256,60 @@ L2: subl $16, %esi
addl %ecx, %edi /* add the magic value to the word. We get addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L8 /* highest byte is C => return pointer */ jnc L(8) /* highest byte is C => return pointer */
xorl %ecx, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %ecx, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jne L8 /* found it => return pointer */ jne L(8) /* found it => return pointer */
addl $4, %eax /* adjust source pointer */ addl $4, %eax /* adjust source pointer */
/* Check the remaining bytes one by one. */ /* Check the remaining bytes one by one. */
L3: andl $3, %esi /* mask out uninteresting bytes */ L(3): andl $3, %esi /* mask out uninteresting bytes */
jz L4 /* no remaining bytes => return NULL */ jz L(4) /* no remaining bytes => return NULL */
cmpb %dl, (%eax) /* compare byte with C */ cmpb %dl, (%eax) /* compare byte with C */
je L9 /* equal, than return pointer */ je L(9) /* equal, than return pointer */
incl %eax /* increment source pointer */ incl %eax /* increment source pointer */
decl %esi /* decrement length */ decl %esi /* decrement length */
jz L4 /* no remaining bytes => return NULL */ jz L(4) /* no remaining bytes => return NULL */
cmpb %dl, (%eax) /* compare byte with C */ cmpb %dl, (%eax) /* compare byte with C */
je L9 /* equal, than return pointer */ je L(9) /* equal, than return pointer */
incl %eax /* increment source pointer */ incl %eax /* increment source pointer */
decl %esi /* decrement length */ decl %esi /* decrement length */
jz L4 /* no remaining bytes => return NULL */ jz L(4) /* no remaining bytes => return NULL */
cmpb %dl, (%eax) /* compare byte with C */ cmpb %dl, (%eax) /* compare byte with C */
je L9 /* equal, than return pointer */ je L(9) /* equal, than return pointer */
L4: /* no byte found => return NULL */ L(4): /* no byte found => return NULL */
xorl %eax, %eax xorl %eax, %eax
jmp L9 jmp L(9)
/* add missing source pointer increments */ /* add missing source pointer increments */
L5: addl $4, %eax L(5): addl $4, %eax
L6: addl $4, %eax L(6): addl $4, %eax
L7: addl $4, %eax L(7): addl $4, %eax
/* Test for the matching byte in the word. %ecx contains a NUL /* Test for the matching byte in the word. %ecx contains a NUL
char in the byte which originally was the byte we are looking char in the byte which originally was the byte we are looking
at. */ at. */
L8: testb %cl, %cl /* test first byte in dword */ L(8): testb %cl, %cl /* test first byte in dword */
jz L9 /* if zero => return pointer */ jz L(9) /* if zero => return pointer */
incl %eax /* increment source pointer */ incl %eax /* increment source pointer */
testb %ch, %ch /* test second byte in dword */ testb %ch, %ch /* test second byte in dword */
jz L9 /* if zero => return pointer */ jz L(9) /* if zero => return pointer */
incl %eax /* increment source pointer */ incl %eax /* increment source pointer */
testl $0xff0000, %ecx /* test third byte in dword */ testl $0xff0000, %ecx /* test third byte in dword */
jz L9 /* if zero => return pointer */ jz L(9) /* if zero => return pointer */
incl %eax /* increment source pointer */ incl %eax /* increment source pointer */
/* No further test needed we we know it is one of the four bytes. */ /* No further test needed we we know it is one of the four bytes. */
L9: popl %edi /* pop saved registers */ L(9): popl %edi /* pop saved registers */
popl %esi popl %esi
ret ret

View File

@ -1,22 +1,21 @@
/* memcmp -- compare two memory blocks for differences in the first COUNT /* Compare two memory blocks for differences in the first COUNT bytes.
bytes. Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1995, 1996 Free Software Foundation, Inc. This file is part of the GNU C Library.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <sysdep.h> #include <sysdep.h>
#include "asm-syntax.h" #include "asm-syntax.h"
@ -44,7 +43,7 @@ ENTRY (memcmp)
repe /* Compare at most %ecx bytes. */ repe /* Compare at most %ecx bytes. */
cmpsb cmpsb
jz L1 /* If even last byte was equal we return 0. */ jz L(1) /* If even last byte was equal we return 0. */
/* The memory blocks are not equal. So result of the last /* The memory blocks are not equal. So result of the last
subtraction is present in the carry flag. It is set when subtraction is present in the carry flag. It is set when
@ -59,7 +58,7 @@ ENTRY (memcmp)
Note that the following operation does not change 0xffffffff. */ Note that the following operation does not change 0xffffffff. */
orb $1, %al /* Change 0 to 1. */ orb $1, %al /* Change 0 to 1. */
L1: popl %esi /* Restore registers. */ L(1): popl %esi /* Restore registers. */
movl %edx, %edi movl %edx, %edi
ret ret

View File

@ -1,32 +1,30 @@
/* memset -- set a block of memory to some byte value. /* Set a block of memory to some byte value.
For Intel 80x86, x>=3. For Intel 80x86, x>=3.
Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc. Copyright (C) 1991, 1992, 1993, 1997 Free Software Foundation, Inc.
Contributed by Torbjorn Granlund (tege@sics.se). Contributed by Torbjorn Granlund (tege@sics.se).
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 675 Mass Ave, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Cambridge, MA 02139, USA. */ Boston, MA 02111-1307, USA. */
#include <ansidecl.h>
#include <string.h> #include <string.h>
#include <memcopy.h> #include <memcopy.h>
#ifdef __GNUC__ #ifdef __GNUC__
PTR vod *
DEFUN(memset, (dstpp, c, len), memset (void *dstpp, int c, size_t len)
PTR dstpp AND int c AND size_t len)
{ {
unsigned long int dstp = (unsigned long int) dstpp; unsigned long int dstp = (unsigned long int) dstpp;

View File

@ -1,24 +1,22 @@
/* i80386 __mpn_mul_1 -- Multiply a limb vector with a limb and store /* i80386 __mpn_mul_1 -- Multiply a limb vector with a limb and store
the result in a second limb vector. the result in a second limb vector.
Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
Copyright (C) 1992, 1994 Free Software Foundation, Inc. The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This file is part of the GNU MP Library. The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
The GNU MP Library is free software; you can redistribute it and/or modify You should have received a copy of the GNU Library General Public License
it under the terms of the GNU Library General Public License as published by along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation; either version 2 of the License, or (at your the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
option) any later version. MA 02111-1307, USA. */
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/* /*
INPUT PARAMETERS INPUT PARAMETERS
@ -56,7 +54,7 @@ C_SYMBOL_NAME(__mpn_mul_1:)
INSN1(neg,l ,R(size)) INSN1(neg,l ,R(size))
INSN2(xor,l ,R(ebx),R(ebx)) INSN2(xor,l ,R(ebx),R(ebx))
ALIGN (3) ALIGN (3)
Loop: L(oop):
INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4)) INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4))
INSN1(mul,l ,R(s2_limb)) INSN1(mul,l ,R(s2_limb))
INSN2(add,l ,R(eax),R(ebx)) INSN2(add,l ,R(eax),R(ebx))
@ -65,7 +63,7 @@ Loop:
INSN2(mov,l ,R(ebx),R(edx)) INSN2(mov,l ,R(ebx),R(edx))
INSN1(inc,l ,R(size)) INSN1(inc,l ,R(size))
INSN1(jnz, ,Loop) INSN1(jnz, ,L(oop))
INSN2(mov,l ,R(eax),R(ebx)) INSN2(mov,l ,R(eax),R(ebx))
INSN1(pop,l ,R(ebp)) INSN1(pop,l ,R(ebp))

View File

@ -1,23 +1,21 @@
/* i80386 __mpn_rshift -- /* i80386 __mpn_rshift --
Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
Copyright (C) 1992, 1994 Free Software Foundation, Inc. The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This file is part of the GNU MP Library. The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
The GNU MP Library is free software; you can redistribute it and/or modify You should have received a copy of the GNU Library General Public License
it under the terms of the GNU Library General Public License as published by along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation; either version 2 of the License, or (at your the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
option) any later version. MA 02111-1307, USA. */
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/* /*
INPUT PARAMETERS INPUT PARAMETERS
@ -51,22 +49,22 @@ C_SYMBOL_NAME(__mpn_rshift:)
xorl %eax,%eax xorl %eax,%eax
shrdl %cl,%ebx,%eax /* compute carry limb */ shrdl %cl,%ebx,%eax /* compute carry limb */
incl %edx incl %edx
jz Lend jz L(end)
pushl %eax /* push carry limb onto stack */ pushl %eax /* push carry limb onto stack */
testb $1,%edx testb $1,%edx
jnz L1 /* enter loop in the middle */ jnz L(1) /* enter loop in the middle */
movl %ebx,%eax movl %ebx,%eax
ALIGN (3) ALIGN (3)
Loop: movl (%esi,%edx,4),%ebx /* load next higher limb */ L(oop): movl (%esi,%edx,4),%ebx /* load next higher limb */
shrdl %cl,%ebx,%eax /* compute result limb */ shrdl %cl,%ebx,%eax /* compute result limb */
movl %eax,(%edi,%edx,4) /* store it */ movl %eax,(%edi,%edx,4) /* store it */
incl %edx incl %edx
L1: movl (%esi,%edx,4),%eax L(1): movl (%esi,%edx,4),%eax
shrdl %cl,%eax,%ebx shrdl %cl,%eax,%ebx
movl %ebx,(%edi,%edx,4) movl %ebx,(%edi,%edx,4)
incl %edx incl %edx
jnz Loop jnz L(oop)
shrl %cl,%eax /* compute most significant limb */ shrl %cl,%eax /* compute most significant limb */
movl %eax,(%edi) /* store it */ movl %eax,(%edi) /* store it */
@ -78,7 +76,7 @@ L1: movl (%esi,%edx,4),%eax
popl %edi popl %edi
ret ret
Lend: shrl %cl,%ebx /* compute most significant limb */ L(end): shrl %cl,%ebx /* compute most significant limb */
movl %ebx,(%edi) /* store it */ movl %ebx,(%edi) /* store it */
popl %ebx popl %ebx

View File

@ -1,7 +1,6 @@
/* stpcpy -- copy SRC to DEST returning the address of the terminating '\0' /* Copy SRC to DEST returning the address of the terminating '\0' in DEST.
in DEST.
For Intel 80x86, x>=3. For Intel 80x86, x>=3.
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper (drepper@gnu.ai.mit.edu). Contributed by Ulrich Drepper (drepper@gnu.ai.mit.edu).
@ -56,32 +55,32 @@ ENTRY (__stpcpy)
is achieved by the use of index+base addressing mode. As the is achieved by the use of index+base addressing mode. As the
loop counter we use the destination address because this is loop counter we use the destination address because this is
also the result. */ also the result. */
L1: addl $4, %eax /* increment loop counter */ L(1): addl $4, %eax /* increment loop counter */
movb (%eax,%ecx), %dl /* load current char */ movb (%eax,%ecx), %dl /* load current char */
movb %dl, (%eax) /* and store it */ movb %dl, (%eax) /* and store it */
testb %dl, %dl /* was it NUL? */ testb %dl, %dl /* was it NUL? */
jz L2 /* yes, then exit */ jz L(2) /* yes, then exit */
movb 1(%eax,%ecx), %dl /* load current char */ movb 1(%eax,%ecx), %dl /* load current char */
movb %dl, 1(%eax) /* and store it */ movb %dl, 1(%eax) /* and store it */
testb %dl, %dl /* was it NUL? */ testb %dl, %dl /* was it NUL? */
jz L3 /* yes, then exit */ jz L(3) /* yes, then exit */
movb 2(%eax,%ecx), %dl /* load current char */ movb 2(%eax,%ecx), %dl /* load current char */
movb %dl, 2(%eax) /* and store it */ movb %dl, 2(%eax) /* and store it */
testb %dl, %dl /* was it NUL? */ testb %dl, %dl /* was it NUL? */
jz L4 /* yes, then exit */ jz L(4) /* yes, then exit */
movb 3(%eax,%ecx), %dl /* load current char */ movb 3(%eax,%ecx), %dl /* load current char */
movb %dl, 3(%eax) /* and store it */ movb %dl, 3(%eax) /* and store it */
testb %dl, %dl /* was it NUL? */ testb %dl, %dl /* was it NUL? */
jnz L1 /* no, then continue loop */ jnz L(1) /* no, then continue loop */
incl %eax /* correct loop counter */ incl %eax /* correct loop counter */
L4: incl %eax L(4): incl %eax
L3: incl %eax L(3): incl %eax
L2: L(2):
ret ret
END (__stpcpy) END (__stpcpy)

View File

@ -1,7 +1,7 @@
/* stpncpy -- copy no more then N bytes from SRC to DEST, returning the /* copy no more then N bytes from SRC to DEST, returning the address of
address of the terminating '\0' in DEST. the terminating '\0' in DEST.
For Intel 80x86, x>=3. For Intel 80x86, x>=3.
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
Some bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> Some bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@ -45,98 +45,98 @@ ENTRY (__stpncpy)
subl %eax, %esi /* magic: reduce number of loop variants subl %eax, %esi /* magic: reduce number of loop variants
to one using addressing mode */ to one using addressing mode */
jmp L1 /* jump to loop "head" */ jmp L(1) /* jump to loop "head" */
ALIGN(4) ALIGN(4)
/* Four times unfolded loop with two loop counters. We get the /* Four times unfolded loop with two loop counters. We get the
the third value (the source address) by using the index+base the third value (the source address) by using the index+base
addressing mode. */ addressing mode. */
L2: movb (%eax,%esi), %dl /* load current char */ L(2): movb (%eax,%esi), %dl /* load current char */
movb %dl, (%eax) /* and store it */ movb %dl, (%eax) /* and store it */
testb %dl, %dl /* was it NUL? */ testb %dl, %dl /* was it NUL? */
jz L7 /* yes, then exit */ jz L(7) /* yes, then exit */
movb 1(%eax,%esi), %dl /* load current char */ movb 1(%eax,%esi), %dl /* load current char */
movb %dl, 1(%eax) /* and store it */ movb %dl, 1(%eax) /* and store it */
testb %dl, %dl /* was it NUL? */ testb %dl, %dl /* was it NUL? */
jz L6 /* yes, then exit */ jz L(6) /* yes, then exit */
movb 2(%eax,%esi), %dl /* load current char */ movb 2(%eax,%esi), %dl /* load current char */
movb %dl, 2(%eax) /* and store it */ movb %dl, 2(%eax) /* and store it */
testb %dl, %dl /* was it NUL? */ testb %dl, %dl /* was it NUL? */
jz L5 /* yes, then exit */ jz L(5) /* yes, then exit */
movb 3(%eax,%esi), %dl /* load current char */ movb 3(%eax,%esi), %dl /* load current char */
movb %dl, 3(%eax) /* and store it */ movb %dl, 3(%eax) /* and store it */
testb %dl, %dl /* was it NUL? */ testb %dl, %dl /* was it NUL? */
jz L4 /* yes, then exit */ jz L(4) /* yes, then exit */
addl $4, %eax /* increment loop counter for full round */ addl $4, %eax /* increment loop counter for full round */
L1: subl $4, %ecx /* still more than 4 bytes allowed? */ L(1): subl $4, %ecx /* still more than 4 bytes allowed? */
jae L2 /* yes, then go to start of loop */ jae L(2) /* yes, then go to start of loop */
/* The maximal remaining 15 bytes are not processed in a loop. */ /* The maximal remaining 15 bytes are not processed in a loop. */
addl $4, %ecx /* correct above subtraction */ addl $4, %ecx /* correct above subtraction */
jz L9 /* maximal allowed char reached => go to end */ jz L(9) /* maximal allowed char reached => go to end */
movb (%eax,%esi), %dl /* load current char */ movb (%eax,%esi), %dl /* load current char */
movb %dl, (%eax) /* and store it */ movb %dl, (%eax) /* and store it */
testb %dl, %dl /* was it NUL? */ testb %dl, %dl /* was it NUL? */
jz L3 /* yes, then exit */ jz L(3) /* yes, then exit */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
decl %ecx /* decrement length counter */ decl %ecx /* decrement length counter */
jz L9 /* no more allowed => exit */ jz L(9) /* no more allowed => exit */
movb (%eax,%esi), %dl /* load current char */ movb (%eax,%esi), %dl /* load current char */
movb %dl, (%eax) /* and store it */ movb %dl, (%eax) /* and store it */
testb %dl, %dl /* was it NUL? */ testb %dl, %dl /* was it NUL? */
jz L3 /* yes, then exit */ jz L(3) /* yes, then exit */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
decl %ecx /* decrement length counter */ decl %ecx /* decrement length counter */
jz L9 /* no more allowed => exit */ jz L(9) /* no more allowed => exit */
movb (%eax,%esi), %dl /* load current char */ movb (%eax,%esi), %dl /* load current char */
movb %dl, (%eax) /* and store it */ movb %dl, (%eax) /* and store it */
testb %dl, %dl /* was it NUL? */ testb %dl, %dl /* was it NUL? */
jz L3 /* yes, then exit */ jz L(3) /* yes, then exit */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
jmp L9 /* we don't have to test for counter underflow jmp L(9) /* we don't have to test for counter underflow
because we know we had a most 3 bytes because we know we had a most 3 bytes
remaining => exit */ remaining => exit */
/* When coming from the main loop we have to adjust the pointer. */ /* When coming from the main loop we have to adjust the pointer. */
L4: decl %ecx /* decrement counter */ L(4): decl %ecx /* decrement counter */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
L5: decl %ecx /* increment pointer */ L(5): decl %ecx /* increment pointer */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
L6: decl %ecx /* increment pointer */ L(6): decl %ecx /* increment pointer */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
L7: L(7):
addl $3, %ecx /* correct pre-decrementation of counter addl $3, %ecx /* correct pre-decrementation of counter
at the beginning of the loop; but why 3 at the beginning of the loop; but why 3
and not 4? Very simple, we have to count and not 4? Very simple, we have to count
the NUL char we already wrote. */ the NUL char we already wrote. */
jz L9 /* counter is also 0 => exit */ jz L(9) /* counter is also 0 => exit */
/* We now have to fill the rest of the buffer with NUL. This /* We now have to fill the rest of the buffer with NUL. This
is done in a tricky way. Please note that the addressing mode is done in a tricky way. Please note that the addressing mode
used below is not the same we used above. Here we use the used below is not the same we used above. Here we use the
%ecx register. */ %ecx register. */
L8: L(8):
movb $0, (%ecx,%eax) /* store NUL char */ movb $0, (%ecx,%eax) /* store NUL char */
L3: decl %ecx /* all bytes written? */ L(3): decl %ecx /* all bytes written? */
jnz L8 /* no, then again */ jnz L(8) /* no, then again */
L9: popl %esi /* restore saved register content */ L(9): popl %esi /* restore saved register content */
ret ret
END (__stpncpy) END (__stpncpy)

View File

@ -1,6 +1,6 @@
/* strchr (str, ch) -- Return pointer to first occurrence of CH in STR. /* strchr (str, ch) -- Return pointer to first occurrence of CH in STR.
For Intel 80x86, x>=3. For Intel 80x86, x>=3.
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
Some optimisations by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> Some optimisations by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@ -57,34 +57,34 @@ ENTRY (strchr)
boundaries are multiples of 4. */ boundaries are multiples of 4. */
testb $3, %eax /* correctly aligned ? */ testb $3, %eax /* correctly aligned ? */
jz L11 /* yes => begin loop */ jz L(11) /* yes => begin loop */
movb (%eax), %cl /* load byte in question (we need it twice) */ movb (%eax), %cl /* load byte in question (we need it twice) */
cmpb %cl, %dl /* compare byte */ cmpb %cl, %dl /* compare byte */
je L6 /* target found => return */ je L(6) /* target found => return */
testb %cl, %cl /* is NUL? */ testb %cl, %cl /* is NUL? */
jz L2 /* yes => return NULL */ jz L(2) /* yes => return NULL */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
testb $3, %eax /* correctly aligned ? */ testb $3, %eax /* correctly aligned ? */
jz L11 /* yes => begin loop */ jz L(11) /* yes => begin loop */
movb (%eax), %cl /* load byte in question (we need it twice) */ movb (%eax), %cl /* load byte in question (we need it twice) */
cmpb %cl, %dl /* compare byte */ cmpb %cl, %dl /* compare byte */
je L6 /* target found => return */ je L(6) /* target found => return */
testb %cl, %cl /* is NUL? */ testb %cl, %cl /* is NUL? */
jz L2 /* yes => return NULL */ jz L(2) /* yes => return NULL */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
testb $3, %eax /* correctly aligned ? */ testb $3, %eax /* correctly aligned ? */
jz L11 /* yes => begin loop */ jz L(11) /* yes => begin loop */
movb (%eax), %cl /* load byte in question (we need it twice) */ movb (%eax), %cl /* load byte in question (we need it twice) */
cmpb %cl, %dl /* compare byte */ cmpb %cl, %dl /* compare byte */
je L6 /* target found => return */ je L(6) /* target found => return */
testb %cl, %cl /* is NUL? */ testb %cl, %cl /* is NUL? */
jz L2 /* yes => return NULL */ jz L(2) /* yes => return NULL */
incl %eax /* increment pointer */ incl %eax /* increment pointer */
/* No we have reached alignment. */ /* No we have reached alignment. */
jmp L11 /* begin loop */ jmp L(11) /* begin loop */
/* We exit the loop if adding MAGIC_BITS to LONGWORD fails to /* We exit the loop if adding MAGIC_BITS to LONGWORD fails to
change any of the hole bits of LONGWORD. change any of the hole bits of LONGWORD.
@ -116,9 +116,9 @@ ENTRY (strchr)
ALIGN(4) ALIGN(4)
L1: addl $16, %eax /* adjust pointer for whole round */ L(1): addl $16, %eax /* adjust pointer for whole round */
L11: movl (%eax), %ecx /* get word (= 4 bytes) in question */ L(11): movl (%eax), %ecx /* get word (= 4 bytes) in question */
xorl %edx, %ecx /* XOR with word c|c|c|c => bytes of str == c xorl %edx, %ecx /* XOR with word c|c|c|c => bytes of str == c
are now 0 */ are now 0 */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
@ -132,7 +132,7 @@ L11: movl (%eax), %ecx /* get word (= 4 bytes) in question */
representation with more than 32 bits) not alter then last representation with more than 32 bits) not alter then last
overflow, we can now test this condition. If no carry is signaled overflow, we can now test this condition. If no carry is signaled
no overflow must have occurred in the last byte => it was 0. */ no overflow must have occurred in the last byte => it was 0. */
jnc L7 jnc L(7)
/* We are only interested in carry bits that change due to the /* We are only interested in carry bits that change due to the
previous add, so remove original bits */ previous add, so remove original bits */
@ -144,7 +144,7 @@ L11: movl (%eax), %ecx /* get word (= 4 bytes) in question */
the addition will not result in 0. */ the addition will not result in 0. */
/* If at least one byte of the word is C we don't get 0 in %edi. */ /* If at least one byte of the word is C we don't get 0 in %edi. */
jnz L7 /* found it => return pointer */ jnz L(7) /* found it => return pointer */
/* Now we made sure the dword does not contain the character we are /* Now we made sure the dword does not contain the character we are
looking for. But because we deal with strings we have to check looking for. But because we deal with strings we have to check
@ -155,12 +155,12 @@ L11: movl (%eax), %ecx /* get word (= 4 bytes) in question */
addl %ecx, %edi /* add the magic value to the word. We get addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L2 /* highest byte is NUL => return NULL */ jnc L(2) /* highest byte is NUL => return NULL */
xorl %ecx, %edi /* (word+magic)^word */ xorl %ecx, %edi /* (word+magic)^word */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L2 /* found NUL => return NULL */ jnz L(2) /* found NUL => return NULL */
movl 4(%eax), %ecx /* get word (= 4 bytes) in question */ movl 4(%eax), %ecx /* get word (= 4 bytes) in question */
xorl %edx, %ecx /* XOR with word c|c|c|c => bytes of str == c xorl %edx, %ecx /* XOR with word c|c|c|c => bytes of str == c
@ -169,23 +169,23 @@ L11: movl (%eax), %ecx /* get word (= 4 bytes) in question */
addl %ecx, %edi /* add the magic value to the word. We get addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* C */ is *not* C */
jnc L71 /* highest byte is C => return pointer */ jnc L(71) /* highest byte is C => return pointer */
xorl %ecx, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %ecx, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L71 /* found it => return pointer */ jnz L(71) /* found it => return pointer */
xorl %edx, %ecx /* restore original dword without reload */ xorl %edx, %ecx /* restore original dword without reload */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
addl %ecx, %edi /* add the magic value to the word. We get addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L2 /* highest byte is NUL => return NULL */ jnc L(2) /* highest byte is NUL => return NULL */
xorl %ecx, %edi /* (word+magic)^word */ xorl %ecx, %edi /* (word+magic)^word */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L2 /* found NUL => return NULL */ jnz L(2) /* found NUL => return NULL */
movl 8(%eax), %ecx /* get word (= 4 bytes) in question */ movl 8(%eax), %ecx /* get word (= 4 bytes) in question */
xorl %edx, %ecx /* XOR with word c|c|c|c => bytes of str == c xorl %edx, %ecx /* XOR with word c|c|c|c => bytes of str == c
@ -194,23 +194,23 @@ L11: movl (%eax), %ecx /* get word (= 4 bytes) in question */
addl %ecx, %edi /* add the magic value to the word. We get addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* C */ is *not* C */
jnc L72 /* highest byte is C => return pointer */ jnc L(72) /* highest byte is C => return pointer */
xorl %ecx, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %ecx, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L72 /* found it => return pointer */ jnz L(72) /* found it => return pointer */
xorl %edx, %ecx /* restore original dword without reload */ xorl %edx, %ecx /* restore original dword without reload */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
addl %ecx, %edi /* add the magic value to the word. We get addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L2 /* highest byte is NUL => return NULL */ jnc L(2) /* highest byte is NUL => return NULL */
xorl %ecx, %edi /* (word+magic)^word */ xorl %ecx, %edi /* (word+magic)^word */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L2 /* found NUL => return NULL */ jnz L(2) /* found NUL => return NULL */
movl 12(%eax), %ecx /* get word (= 4 bytes) in question */ movl 12(%eax), %ecx /* get word (= 4 bytes) in question */
xorl %edx, %ecx /* XOR with word c|c|c|c => bytes of str == c xorl %edx, %ecx /* XOR with word c|c|c|c => bytes of str == c
@ -219,59 +219,59 @@ L11: movl (%eax), %ecx /* get word (= 4 bytes) in question */
addl %ecx, %edi /* add the magic value to the word. We get addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* C */ is *not* C */
jnc L73 /* highest byte is C => return pointer */ jnc L(73) /* highest byte is C => return pointer */
xorl %ecx, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %ecx, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L73 /* found it => return pointer */ jnz L(73) /* found it => return pointer */
xorl %edx, %ecx /* restore original dword without reload */ xorl %edx, %ecx /* restore original dword without reload */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
addl %ecx, %edi /* add the magic value to the word. We get addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L2 /* highest byte is NUL => return NULL */ jnc L(2) /* highest byte is NUL => return NULL */
xorl %ecx, %edi /* (word+magic)^word */ xorl %ecx, %edi /* (word+magic)^word */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jz L1 /* no NUL found => restart loop */ jz L(1) /* no NUL found => restart loop */
L2: /* Return NULL. */ L(2): /* Return NULL. */
xorl %eax, %eax /* load NULL in return value register */ xorl %eax, %eax /* load NULL in return value register */
popl %edi /* restore saved register content */ popl %edi /* restore saved register content */
ret ret
L73: addl $4, %eax /* adjust pointer */ L(73): addl $4, %eax /* adjust pointer */
L72: addl $4, %eax L(72): addl $4, %eax
L71: addl $4, %eax L(71): addl $4, %eax
/* We now scan for the byte in which the character was matched. /* We now scan for the byte in which the character was matched.
But we have to take care of the case that a NUL char is But we have to take care of the case that a NUL char is
found before this in the dword. */ found before this in the dword. */
L7: testb %cl, %cl /* is first byte C? */ L(7): testb %cl, %cl /* is first byte C? */
jz L6 /* yes => return pointer */ jz L(6) /* yes => return pointer */
cmpb %dl, %cl /* is first byte NUL? */ cmpb %dl, %cl /* is first byte NUL? */
je L2 /* yes => return NULL */ je L(2) /* yes => return NULL */
incl %eax /* it's not in the first byte */ incl %eax /* it's not in the first byte */
testb %ch, %ch /* is second byte C? */ testb %ch, %ch /* is second byte C? */
jz L6 /* yes => return pointer */ jz L(6) /* yes => return pointer */
cmpb %dl, %ch /* is second byte NUL? */ cmpb %dl, %ch /* is second byte NUL? */
je L2 /* yes => return NULL? */ je L(2) /* yes => return NULL? */
incl %eax /* it's not in the second byte */ incl %eax /* it's not in the second byte */
shrl $16, %ecx /* make upper byte accessible */ shrl $16, %ecx /* make upper byte accessible */
testb %cl, %cl /* is third byte C? */ testb %cl, %cl /* is third byte C? */
jz L6 /* yes => return pointer */ jz L(6) /* yes => return pointer */
cmpb %dl, %cl /* is third byte NUL? */ cmpb %dl, %cl /* is third byte NUL? */
je L2 /* yes => return NULL */ je L(2) /* yes => return NULL */
/* It must be in the fourth byte and it cannot be NUL. */ /* It must be in the fourth byte and it cannot be NUL. */
incl %eax incl %eax
L6: popl %edi /* restore saved register content */ L(6): popl %edi /* restore saved register content */
ret ret
END (strchr) END (strchr)

View File

@ -1,7 +1,7 @@
/* strcspn (str, ss) -- Return the length of the initial segment of STR /* strcspn (str, ss) -- Return the length of the initial segment of STR
which contains no characters from SS. which contains no characters from SS.
For Intel 80x86, x>=3. For Intel 80x86, x>=3.
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@ -114,28 +114,28 @@ ENTRY (strcspn)
/* Don't change the "testb $0xff,%%cl" to "testb %%cl,%%cl". We want /* Don't change the "testb $0xff,%%cl" to "testb %%cl,%%cl". We want
longer instructions so that the next loop aligns without adding nops. */ longer instructions so that the next loop aligns without adding nops. */
L2: movb (%eax), %cl /* get byte from stopset */ L(2): movb (%eax), %cl /* get byte from stopset */
testb %cl, %cl /* is NUL char? */ testb %cl, %cl /* is NUL char? */
jz L1 /* yes => start compare loop */ jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 1(%eax), %cl /* get byte from stopset */ movb 1(%eax), %cl /* get byte from stopset */
testb $0xff, %cl /* is NUL char? */ testb $0xff, %cl /* is NUL char? */
jz L1 /* yes => start compare loop */ jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 2(%eax), %cl /* get byte from stopset */ movb 2(%eax), %cl /* get byte from stopset */
testb $0xff, %cl /* is NUL char? */ testb $0xff, %cl /* is NUL char? */
jz L1 /* yes => start compare loop */ jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 3(%eax), %cl /* get byte from stopset */ movb 3(%eax), %cl /* get byte from stopset */
addl $4, %eax /* increment stopset pointer */ addl $4, %eax /* increment stopset pointer */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
testb $0xff, %cl /* is NUL char? */ testb $0xff, %cl /* is NUL char? */
jnz L2 /* no => process next dword from stopset */ jnz L(2) /* no => process next dword from stopset */
L1: leal -4(%edx), %eax /* prepare loop */ L(1): leal -4(%edx), %eax /* prepare loop */
/* We use a neat trick for the following loop. Normally we would /* We use a neat trick for the following loop. Normally we would
have to test for two termination conditions have to test for two termination conditions
@ -146,29 +146,29 @@ L1: leal -4(%edx), %eax /* prepare loop */
value in the table. But the value of NUL is NUL so the loop value in the table. But the value of NUL is NUL so the loop
terminates for NUL in every case. */ terminates for NUL in every case. */
L3: addl $4, %eax /* adjust pointer for full loop round */ L(3): addl $4, %eax /* adjust pointer for full loop round */
movb (%eax), %cl /* get byte from string */ movb (%eax), %cl /* get byte from string */
cmpb %cl, (%esp,%ecx) /* is it contained in stopset? */ cmpb %cl, (%esp,%ecx) /* is it contained in stopset? */
je L4 /* yes => return */ je L(4) /* yes => return */
movb 1(%eax), %cl /* get byte from string */ movb 1(%eax), %cl /* get byte from string */
cmpb %cl, (%esp,%ecx) /* is it contained in stopset? */ cmpb %cl, (%esp,%ecx) /* is it contained in stopset? */
je L5 /* yes => return */ je L(5) /* yes => return */
movb 2(%eax), %cl /* get byte from string */ movb 2(%eax), %cl /* get byte from string */
cmpb %cl, (%esp,%ecx) /* is it contained in stopset? */ cmpb %cl, (%esp,%ecx) /* is it contained in stopset? */
je L6 /* yes => return */ je L(6) /* yes => return */
movb 3(%eax), %cl /* get byte from string */ movb 3(%eax), %cl /* get byte from string */
cmpb %cl, (%esp,%ecx) /* is it contained in stopset? */ cmpb %cl, (%esp,%ecx) /* is it contained in stopset? */
jne L3 /* yes => return */ jne L(3) /* yes => return */
incl %eax /* adjust pointer */ incl %eax /* adjust pointer */
L6: incl %eax L(6): incl %eax
L5: incl %eax L(5): incl %eax
L4: subl %edx, %eax /* we have to return the number of valid L(4): subl %edx, %eax /* we have to return the number of valid
characters, so compute distance to first characters, so compute distance to first
non-valid character */ non-valid character */
addl $256, %esp /* remove stopset */ addl $256, %esp /* remove stopset */

View File

@ -1,22 +1,21 @@
/* strlen -- determine the length of a string. /* Determine the length of a string. For Intel 80x86, x>=3.
For Intel 80x86, x>=3. Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1991, 1992, 1993, 1996 Free Software Foundation, Inc.
Contributed by Torbjorn Granlund (tege@sics.se). Contributed by Torbjorn Granlund (tege@sics.se).
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 675 Mass Ave, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Cambridge, MA 02139, USA. */ Boston, MA 02111-1307, USA. */
#include <string.h> #include <string.h>

View File

@ -1,25 +1,25 @@
/* strcspn (str, ss) -- Return the length of the initial segement of STR /* strcspn (str, ss) -- Return the length of the initial segement of STR
which contains no characters from SS. which contains no characters from SS.
For Intel 80x86, x>=3. For Intel 80x86, x>=3.
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <sysdep.h> #include <sysdep.h>
#include "asm-syntax.h" #include "asm-syntax.h"
@ -114,28 +114,28 @@ ENTRY (strpbrk)
/* Don't change the "testb $0xff,%%cl" to "testb %%cl,%%cl". We want /* Don't change the "testb $0xff,%%cl" to "testb %%cl,%%cl". We want
longer instructions so that the next loop aligns without adding nops. */ longer instructions so that the next loop aligns without adding nops. */
L2: movb (%eax), %cl /* get byte from stopset */ L(2): movb (%eax), %cl /* get byte from stopset */
testb %cl, %cl /* is NUL char? */ testb %cl, %cl /* is NUL char? */
jz L1 /* yes => start compare loop */ jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 1(%eax), %cl /* get byte from stopset */ movb 1(%eax), %cl /* get byte from stopset */
testb $0xff, %cl /* is NUL char? */ testb $0xff, %cl /* is NUL char? */
jz L1 /* yes => start compare loop */ jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 2(%eax), %cl /* get byte from stopset */ movb 2(%eax), %cl /* get byte from stopset */
testb $0xff, %cl /* is NUL char? */ testb $0xff, %cl /* is NUL char? */
jz L1 /* yes => start compare loop */ jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 3(%eax), %cl /* get byte from stopset */ movb 3(%eax), %cl /* get byte from stopset */
addl $4, %eax /* increment stopset pointer */ addl $4, %eax /* increment stopset pointer */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
testb $0xff, %cl /* is NUL char? */ testb $0xff, %cl /* is NUL char? */
jnz L2 /* no => process next dword from stopset */ jnz L(2) /* no => process next dword from stopset */
L1: leal -4(%edx), %eax /* prepare loop */ L(1): leal -4(%edx), %eax /* prepare loop */
/* We use a neat trick for the following loop. Normally we would /* We use a neat trick for the following loop. Normally we would
have to test for two termination conditions have to test for two termination conditions
@ -146,33 +146,33 @@ L1: leal -4(%edx), %eax /* prepare loop */
value in the table. But the value of NUL is NUL so the loop value in the table. But the value of NUL is NUL so the loop
terminates for NUL in every case. */ terminates for NUL in every case. */
L3: addl $4, %eax /* adjust pointer for full loop round */ L(3): addl $4, %eax /* adjust pointer for full loop round */
movb (%eax), %cl /* get byte from string */ movb (%eax), %cl /* get byte from string */
cmpb %cl, (%esp,%ecx) /* is it contained in stopset? */ cmpb %cl, (%esp,%ecx) /* is it contained in stopset? */
je L4 /* yes => return */ je L(4) /* yes => return */
movb 1(%eax), %cl /* get byte from string */ movb 1(%eax), %cl /* get byte from string */
cmpb %cl, (%esp,%ecx) /* is it contained in stopset? */ cmpb %cl, (%esp,%ecx) /* is it contained in stopset? */
je L5 /* yes => return */ je L(5) /* yes => return */
movb 2(%eax), %cl /* get byte from string */ movb 2(%eax), %cl /* get byte from string */
cmpb %cl, (%esp,%ecx) /* is it contained in stopset? */ cmpb %cl, (%esp,%ecx) /* is it contained in stopset? */
je L6 /* yes => return */ je L(6) /* yes => return */
movb 3(%eax), %cl /* get byte from string */ movb 3(%eax), %cl /* get byte from string */
cmpb %cl, (%esp,%ecx) /* is it contained in stopset? */ cmpb %cl, (%esp,%ecx) /* is it contained in stopset? */
jne L3 /* yes => return */ jne L(3) /* yes => return */
incl %eax /* adjust pointer */ incl %eax /* adjust pointer */
L6: incl %eax L(6): incl %eax
L5: incl %eax L(5): incl %eax
L4: addl $256, %esp /* remove stopset */ L(4): addl $256, %esp /* remove stopset */
orb %cl, %cl /* was last character NUL? */ orb %cl, %cl /* was last character NUL? */
jnz L7 /* no => return pointer */ jnz L(7) /* no => return pointer */
xorl %eax, %eax /* return NULL */ xorl %eax, %eax /* return NULL */
L7: ret L(7): ret
END (strpbrk) END (strpbrk)

View File

@ -1,6 +1,6 @@
/* strrchr (str, ch) -- Return pointer to last occurrence of CH in STR. /* strrchr (str, ch) -- Return pointer to last occurrence of CH in STR.
For Intel 80x86, x>=3. For Intel 80x86, x>=3.
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
Some optimisations by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> Some optimisations by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@ -59,37 +59,37 @@ ENTRY (strrchr)
boundaries are multiples of 4. */ boundaries are multiples of 4. */
testl $3, %esi /* correctly aligned ? */ testl $3, %esi /* correctly aligned ? */
jz L19 /* yes => begin loop */ jz L(19) /* yes => begin loop */
movb (%esi), %dl /* load byte in question (we need it twice) */ movb (%esi), %dl /* load byte in question (we need it twice) */
cmpb %dl, %cl /* compare byte */ cmpb %dl, %cl /* compare byte */
jne L11 /* target found => return */ jne L(11) /* target found => return */
movl %esi, %eax /* remember pointer as possible result */ movl %esi, %eax /* remember pointer as possible result */
L11: orb %dl, %dl /* is NUL? */ L(11): orb %dl, %dl /* is NUL? */
jz L2 /* yes => return NULL */ jz L(2) /* yes => return NULL */
incl %esi /* increment pointer */ incl %esi /* increment pointer */
testl $3, %esi /* correctly aligned ? */ testl $3, %esi /* correctly aligned ? */
jz L19 /* yes => begin loop */ jz L(19) /* yes => begin loop */
movb (%esi), %dl /* load byte in question (we need it twice) */ movb (%esi), %dl /* load byte in question (we need it twice) */
cmpb %dl, %cl /* compare byte */ cmpb %dl, %cl /* compare byte */
jne L12 /* target found => return */ jne L(12) /* target found => return */
movl %esi, %eax /* remember pointer as result */ movl %esi, %eax /* remember pointer as result */
L12: orb %dl, %dl /* is NUL? */ L(12): orb %dl, %dl /* is NUL? */
jz L2 /* yes => return NULL */ jz L(2) /* yes => return NULL */
incl %esi /* increment pointer */ incl %esi /* increment pointer */
testl $3, %esi /* correctly aligned ? */ testl $3, %esi /* correctly aligned ? */
jz L19 /* yes => begin loop */ jz L(19) /* yes => begin loop */
movb (%esi), %dl /* load byte in question (we need it twice) */ movb (%esi), %dl /* load byte in question (we need it twice) */
cmpb %dl, %cl /* compare byte */ cmpb %dl, %cl /* compare byte */
jne L13 /* target found => return */ jne L(13) /* target found => return */
movl %esi, %eax /* remember pointer as result */ movl %esi, %eax /* remember pointer as result */
L13: orb %dl, %dl /* is NUL? */ L(13): orb %dl, %dl /* is NUL? */
jz L2 /* yes => return NULL */ jz L(2) /* yes => return NULL */
incl %esi /* increment pointer */ incl %esi /* increment pointer */
/* No we have reached alignment. */ /* No we have reached alignment. */
jmp L19 /* begin loop */ jmp L(19) /* begin loop */
/* We exit the loop if adding MAGIC_BITS to LONGWORD fails to /* We exit the loop if adding MAGIC_BITS to LONGWORD fails to
change any of the hole bits of LONGWORD. change any of the hole bits of LONGWORD.
@ -140,34 +140,34 @@ L13: orb %dl, %dl /* is NUL? */
.byte 0 .byte 0
#endif #endif
L4: subl $4, %esi /* adjust pointer */ L(4): subl $4, %esi /* adjust pointer */
L41: subl $4, %esi L(41): subl $4, %esi
L42: subl $4, %esi L(42): subl $4, %esi
L43: testl $0xff000000, %edx /* is highest byte == C? */ L(43): testl $0xff000000, %edx /* is highest byte == C? */
jnz L33 /* no => try other bytes */ jnz L(33) /* no => try other bytes */
leal 15(%esi), %eax /* store address as result */ leal 15(%esi), %eax /* store address as result */
jmp L1 /* and start loop again */ jmp L(1) /* and start loop again */
L3: subl $4, %esi /* adjust pointer */ L(3): subl $4, %esi /* adjust pointer */
L31: subl $4, %esi L(31): subl $4, %esi
L32: subl $4, %esi L(32): subl $4, %esi
L33: testl $0xff0000, %edx /* is C in third byte? */ L(33): testl $0xff0000, %edx /* is C in third byte? */
jnz L51 /* no => try other bytes */ jnz L(51) /* no => try other bytes */
leal 14(%esi), %eax /* store address as result */ leal 14(%esi), %eax /* store address as result */
jmp L1 /* and start loop again */ jmp L(1) /* and start loop again */
L51: L(51):
/* At this point we know that the byte is in one of the lower bytes. /* At this point we know that the byte is in one of the lower bytes.
We make a guess and correct it if necessary. This reduces the We make a guess and correct it if necessary. This reduces the
number of necessary jumps. */ number of necessary jumps. */
leal 12(%esi), %eax /* guess address of lowest byte as result */ leal 12(%esi), %eax /* guess address of lowest byte as result */
testb %dh, %dh /* is guess correct? */ testb %dh, %dh /* is guess correct? */
jnz L1 /* yes => start loop */ jnz L(1) /* yes => start loop */
leal 13(%esi), %eax /* correct guess to second byte */ leal 13(%esi), %eax /* correct guess to second byte */
L1: addl $16, %esi /* increment pointer for full round */ L(1): addl $16, %esi /* increment pointer for full round */
L19: movl (%esi), %edx /* get word (= 4 bytes) in question */ L(19): movl (%esi), %edx /* get word (= 4 bytes) in question */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
addl %edx, %edi /* add the magic value to the word. We get addl %edx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
@ -180,7 +180,7 @@ L19: movl (%esi), %edx /* get word (= 4 bytes) in question */
overflow, we can now test this condition. If no carry is signaled overflow, we can now test this condition. If no carry is signaled
no overflow must have occurred in the last byte => it was 0. */ no overflow must have occurred in the last byte => it was 0. */
jnc L20 /* found NUL => check last word */ jnc L(20) /* found NUL => check last word */
/* We are only interested in carry bits that change due to the /* We are only interested in carry bits that change due to the
previous add, so remove original bits */ previous add, so remove original bits */
@ -192,7 +192,7 @@ L19: movl (%esi), %edx /* get word (= 4 bytes) in question */
the addition will not result in 0. */ the addition will not result in 0. */
/* If at least one byte of the word is C we don't get 0 in %edi. */ /* If at least one byte of the word is C we don't get 0 in %edi. */
jnz L20 /* found NUL => check last word */ jnz L(20) /* found NUL => check last word */
/* Now we made sure the dword does not contain the character we are /* Now we made sure the dword does not contain the character we are
looking for. But because we deal with strings we have to check looking for. But because we deal with strings we have to check
@ -204,89 +204,89 @@ L19: movl (%esi), %edx /* get word (= 4 bytes) in question */
addl %edx, %edi /* add the magic value to the word. We get addl %edx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L4 /* highest byte is C => examine dword */ jnc L(4) /* highest byte is C => examine dword */
xorl %edx, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %edx, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L3 /* C is detected in the word => examine it */ jnz L(3) /* C is detected in the word => examine it */
movl 4(%esi), %edx /* get word (= 4 bytes) in question */ movl 4(%esi), %edx /* get word (= 4 bytes) in question */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
addl %edx, %edi /* add the magic value to the word. We get addl %edx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L21 /* found NUL => check last word */ jnc L(21) /* found NUL => check last word */
xorl %edx, %edi /* (word+magic)^word */ xorl %edx, %edi /* (word+magic)^word */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L21 /* found NUL => check last word */ jnz L(21) /* found NUL => check last word */
xorl %ecx, %edx /* XOR with word c|c|c|c => bytes of str == c xorl %ecx, %edx /* XOR with word c|c|c|c => bytes of str == c
are now 0 */ are now 0 */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
addl %edx, %edi /* add the magic value to the word. We get addl %edx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L41 /* highest byte is C => examine dword */ jnc L(41) /* highest byte is C => examine dword */
xorl %edx, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %edx, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L31 /* C is detected in the word => examine it */ jnz L(31) /* C is detected in the word => examine it */
movl 8(%esi), %edx /* get word (= 4 bytes) in question */ movl 8(%esi), %edx /* get word (= 4 bytes) in question */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
addl %edx, %edi /* add the magic value to the word. We get addl %edx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L22 /* found NUL => check last word */ jnc L(22) /* found NUL => check last word */
xorl %edx, %edi /* (word+magic)^word */ xorl %edx, %edi /* (word+magic)^word */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L22 /* found NUL => check last word */ jnz L(22) /* found NUL => check last word */
xorl %ecx, %edx /* XOR with word c|c|c|c => bytes of str == c xorl %ecx, %edx /* XOR with word c|c|c|c => bytes of str == c
are now 0 */ are now 0 */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
addl %edx, %edi /* add the magic value to the word. We get addl %edx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L42 /* highest byte is C => examine dword */ jnc L(42) /* highest byte is C => examine dword */
xorl %edx, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %edx, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L32 /* C is detected in the word => examine it */ jnz L(32) /* C is detected in the word => examine it */
movl 12(%esi), %edx /* get word (= 4 bytes) in question */ movl 12(%esi), %edx /* get word (= 4 bytes) in question */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
addl %edx, %edi /* add the magic value to the word. We get addl %edx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L23 /* found NUL => check last word */ jnc L(23) /* found NUL => check last word */
xorl %edx, %edi /* (word+magic)^word */ xorl %edx, %edi /* (word+magic)^word */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jnz L23 /* found NUL => check last word */ jnz L(23) /* found NUL => check last word */
xorl %ecx, %edx /* XOR with word c|c|c|c => bytes of str == c xorl %ecx, %edx /* XOR with word c|c|c|c => bytes of str == c
are now 0 */ are now 0 */
movl $0xfefefeff, %edi /* magic value */ movl $0xfefefeff, %edi /* magic value */
addl %edx, %edi /* add the magic value to the word. We get addl %edx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which carry bits reported for each byte which
is *not* 0 */ is *not* 0 */
jnc L43 /* highest byte is C => examine dword */ jnc L(43) /* highest byte is C => examine dword */
xorl %edx, %edi /* ((word^charmask)+magic)^(word^charmask) */ xorl %edx, %edi /* ((word^charmask)+magic)^(word^charmask) */
orl $0xfefefeff, %edi /* set all non-carry bits */ orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */ the addition will not result in 0. */
jz L1 /* C is not detected => restart loop */ jz L(1) /* C is not detected => restart loop */
jmp L33 /* examine word */ jmp L(33) /* examine word */
L23: addl $4, %esi /* adjust pointer */ L(23): addl $4, %esi /* adjust pointer */
L22: addl $4, %esi L(22): addl $4, %esi
L21: addl $4, %esi L(21): addl $4, %esi
/* What remains to do is to test which byte the NUL char is and /* What remains to do is to test which byte the NUL char is and
whether the searched character appears in one of the bytes whether the searched character appears in one of the bytes
@ -294,30 +294,30 @@ L21: addl $4, %esi
In this case a pointer to the terminating NUL char has to be In this case a pointer to the terminating NUL char has to be
returned. */ returned. */
L20: cmpb %cl, %dl /* is first byte == C? */ L(20): cmpb %cl, %dl /* is first byte == C? */
jne L24 /* no => skip */ jne L(24) /* no => skip */
movl %esi, %eax /* store address as result */ movl %esi, %eax /* store address as result */
L24: testb %dl, %dl /* is first byte == NUL? */ L(24): testb %dl, %dl /* is first byte == NUL? */
jz L2 /* yes => return */ jz L(2) /* yes => return */
cmpb %cl, %dh /* is second byte == C? */ cmpb %cl, %dh /* is second byte == C? */
jne L25 /* no => skip */ jne L(25) /* no => skip */
leal 1(%esi), %eax /* store address as result */ leal 1(%esi), %eax /* store address as result */
L25: testb %dh, %dh /* is second byte == NUL? */ L(25): testb %dh, %dh /* is second byte == NUL? */
jz L2 /* yes => return */ jz L(2) /* yes => return */
shrl $16,%edx /* make upper bytes accessible */ shrl $16,%edx /* make upper bytes accessible */
cmpb %cl, %dl /* is third byte == C */ cmpb %cl, %dl /* is third byte == C */
jne L26 /* no => skip */ jne L(26) /* no => skip */
leal 2(%esi), %eax /* store address as result */ leal 2(%esi), %eax /* store address as result */
L26: testb %dl, %dl /* is third byte == NUL */ L(26): testb %dl, %dl /* is third byte == NUL */
jz L2 /* yes => return */ jz L(2) /* yes => return */
cmpb %cl, %dh /* is fourth byte == C */ cmpb %cl, %dh /* is fourth byte == C */
jne L2 /* no => skip */ jne L(2) /* no => skip */
leal 3(%esi), %eax /* store address as result */ leal 3(%esi), %eax /* store address as result */
L2: popl %esi /* restore saved register content */ L(2): popl %esi /* restore saved register content */
popl %edi popl %edi
ret ret

View File

@ -1,7 +1,7 @@
/* strcspn (str, ss) -- Return the length of the initial segment of STR /* strcspn (str, ss) -- Return the length of the initial segment of STR
which contains only characters from SS. which contains only characters from SS.
For Intel 80x86, x>=3. For Intel 80x86, x>=3.
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc. Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu> Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au> Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@ -114,28 +114,28 @@ ENTRY (strspn)
/* Don't change the "testb $0xff,%%cl" to "testb %%cl,%%cl". We want /* Don't change the "testb $0xff,%%cl" to "testb %%cl,%%cl". We want
longer instructions so that the next loop aligns without adding nops. */ longer instructions so that the next loop aligns without adding nops. */
L2: movb (%eax), %cl /* get byte from stopset */ L(2): movb (%eax), %cl /* get byte from stopset */
testb %cl, %cl /* is NUL char? */ testb %cl, %cl /* is NUL char? */
jz L1 /* yes => start compare loop */ jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 1(%eax), %cl /* get byte from stopset */ movb 1(%eax), %cl /* get byte from stopset */
testb $0xff, %cl /* is NUL char? */ testb $0xff, %cl /* is NUL char? */
jz L1 /* yes => start compare loop */ jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 2(%eax), %cl /* get byte from stopset */ movb 2(%eax), %cl /* get byte from stopset */
testb $0xff, %cl /* is NUL char? */ testb $0xff, %cl /* is NUL char? */
jz L1 /* yes => start compare loop */ jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 3(%eax), %cl /* get byte from stopset */ movb 3(%eax), %cl /* get byte from stopset */
addl $4, %eax /* increment stopset pointer */ addl $4, %eax /* increment stopset pointer */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
testb $0xff, %cl /* is NUL char? */ testb $0xff, %cl /* is NUL char? */
jnz L2 /* no => process next dword from stopset */ jnz L(2) /* no => process next dword from stopset */
L1: leal -4(%edx), %eax /* prepare loop */ L(1): leal -4(%edx), %eax /* prepare loop */
/* We use a neat trick for the following loop. Normally we would /* We use a neat trick for the following loop. Normally we would
have to test for two termination conditions have to test for two termination conditions
@ -146,29 +146,29 @@ L1: leal -4(%edx), %eax /* prepare loop */
value in the table. But the value of NUL is NUL so the loop value in the table. But the value of NUL is NUL so the loop
terminates for NUL in every case. */ terminates for NUL in every case. */
L3: addl $4, %eax /* adjust pointer for full loop round */ L(3): addl $4, %eax /* adjust pointer for full loop round */
movb (%eax), %cl /* get byte from string */ movb (%eax), %cl /* get byte from string */
testb %cl, (%esp,%ecx) /* is it contained in skipset? */ testb %cl, (%esp,%ecx) /* is it contained in skipset? */
jz L4 /* no => return */ jz L(4) /* no => return */
movb 1(%eax), %cl /* get byte from string */ movb 1(%eax), %cl /* get byte from string */
testb %cl, (%esp,%ecx) /* is it contained in skipset? */ testb %cl, (%esp,%ecx) /* is it contained in skipset? */
jz L5 /* no => return */ jz L(5) /* no => return */
movb 2(%eax), %cl /* get byte from string */ movb 2(%eax), %cl /* get byte from string */
testb %cl, (%esp,%ecx) /* is it contained in skipset? */ testb %cl, (%esp,%ecx) /* is it contained in skipset? */
jz L6 /* no => return */ jz L(6) /* no => return */
movb 3(%eax), %cl /* get byte from string */ movb 3(%eax), %cl /* get byte from string */
testb %cl, (%esp,%ecx) /* is it contained in skipset? */ testb %cl, (%esp,%ecx) /* is it contained in skipset? */
jnz L3 /* yes => start loop again */ jnz L(3) /* yes => start loop again */
incl %eax /* adjust pointer */ incl %eax /* adjust pointer */
L6: incl %eax L(6): incl %eax
L5: incl %eax L(5): incl %eax
L4: subl %edx, %eax /* we have to return the number of valid L(4): subl %edx, %eax /* we have to return the number of valid
characters, so compute distance to first characters, so compute distance to first
non-valid character */ non-valid character */
addl $256, %esp /* remove stopset */ addl $256, %esp /* remove stopset */

View File

@ -1,25 +1,26 @@
/* strtok (str, delim) -- Return next DELIM separated token from STR. /* strtok (str, delim) -- Return next DELIM separated token from STR.
For Intel 80x86, x>=3. For Intel 80x86, x>=3.
Copyright (C) 1996 Free Software Foundation, Inc. Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
The GNU C Library is free software; you can redistribute it and/or The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version. License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful, The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. Library General Public License for more details.
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If License along with the GNU C Library; see the file COPYING.LIB. If not,
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include <sysdep.h> #include <sysdep.h>
#include "asm-syntax.h"
/* This file can be used for three variants of the strtok function: /* This file can be used for three variants of the strtok function:
@ -56,15 +57,16 @@ ENTRY (FUNCTION)
#if !defined (USE_AS_STRTOK_R) && defined (PIC) #if !defined (USE_AS_STRTOK_R) && defined (PIC)
pushl %ebx /* Save PIC register. */ pushl %ebx /* Save PIC register. */
call Lhere call L(here)
Lhere: popl %ebx L(here):
addl $_GLOBAL_OFFSET_TABLE_+[.-Lhere], %ebx popl %ebx
addl $_GLOBAL_OFFSET_TABLE_+[.-L(here)], %ebx
#endif #endif
/* If the pointer is NULL we have to use the stored value of /* If the pointer is NULL we have to use the stored value of
the last run. */ the last run. */
cmpl $0, %edx cmpl $0, %edx
jne L0 jne L(0)
#ifdef USE_AS_STRTOK_R #ifdef USE_AS_STRTOK_R
/* The value is stored in the third argument. */ /* The value is stored in the third argument. */
@ -80,7 +82,7 @@ Lhere: popl %ebx
# endif # endif
#endif #endif
L0: L(0):
/* First we create a table with flags for all possible characters. /* First we create a table with flags for all possible characters.
For the ASCII (7bit/8bit) or ISO-8859-X character sets which are For the ASCII (7bit/8bit) or ISO-8859-X character sets which are
supported by the C string functions we have 256 characters. supported by the C string functions we have 256 characters.
@ -157,28 +159,28 @@ L0:
Although all the following instruction only modify %cl we always Although all the following instruction only modify %cl we always
have a correct zero-extended 32-bit value in %ecx. */ have a correct zero-extended 32-bit value in %ecx. */
L2: movb (%eax), %cl /* get byte from stopset */ L(2): movb (%eax), %cl /* get byte from stopset */
testb %cl, %cl /* is NUL char? */ testb %cl, %cl /* is NUL char? */
jz L1 /* yes => start compare loop */ jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 1(%eax), %cl /* get byte from stopset */ movb 1(%eax), %cl /* get byte from stopset */
testb $0xff, %cl /* is NUL char? */ testb $0xff, %cl /* is NUL char? */
jz L1 /* yes => start compare loop */ jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 2(%eax), %cl /* get byte from stopset */ movb 2(%eax), %cl /* get byte from stopset */
testb $0xff, %cl /* is NUL char? */ testb $0xff, %cl /* is NUL char? */
jz L1 /* yes => start compare loop */ jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 3(%eax), %cl /* get byte from stopset */ movb 3(%eax), %cl /* get byte from stopset */
addl $4, %eax /* increment stopset pointer */ addl $4, %eax /* increment stopset pointer */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */ movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
testb $0xff, %cl /* is NUL char? */ testb $0xff, %cl /* is NUL char? */
jnz L2 /* no => process next dword from stopset */ jnz L(2) /* no => process next dword from stopset */
L1: leal -4(%edx), %eax /* prepare loop */ L(1): leal -4(%edx), %eax /* prepare loop */
/* We use a neat trick for the following loop. Normally we would /* We use a neat trick for the following loop. Normally we would
have to test for two termination conditions have to test for two termination conditions
@ -189,68 +191,68 @@ L1: leal -4(%edx), %eax /* prepare loop */
value in the table. The value of NUL is NUL so the loop value in the table. The value of NUL is NUL so the loop
terminates for NUL in every case. */ terminates for NUL in every case. */
L3: addl $4, %eax /* adjust pointer for full loop round */ L(3): addl $4, %eax /* adjust pointer for full loop round */
movb (%eax), %cl /* get byte from string */ movb (%eax), %cl /* get byte from string */
testb %cl, (%esp,%ecx) /* is it contained in stopset? */ testb %cl, (%esp,%ecx) /* is it contained in stopset? */
jz L4 /* no => start of token */ jz L(4) /* no => start of token */
movb 1(%eax), %cl /* get byte from string */ movb 1(%eax), %cl /* get byte from string */
testb %cl, (%esp,%ecx) /* is it contained in stopset? */ testb %cl, (%esp,%ecx) /* is it contained in stopset? */
jz L5 /* no => start of token */ jz L(5) /* no => start of token */
movb 2(%eax), %cl /* get byte from string */ movb 2(%eax), %cl /* get byte from string */
testb %cl, (%esp,%ecx) /* is it contained in stopset? */ testb %cl, (%esp,%ecx) /* is it contained in stopset? */
jz L6 /* no => start of token */ jz L(6) /* no => start of token */
movb 3(%eax), %cl /* get byte from string */ movb 3(%eax), %cl /* get byte from string */
testb %cl, (%esp,%ecx) /* is it contained in stopset? */ testb %cl, (%esp,%ecx) /* is it contained in stopset? */
jnz L3 /* yes => start of loop */ jnz L(3) /* yes => start of loop */
incl %eax /* adjust pointer */ incl %eax /* adjust pointer */
L6: incl %eax L(6): incl %eax
L5: incl %eax L(5): incl %eax
/* Now we have to terminate the string. */ /* Now we have to terminate the string. */
L4: leal -4(%eax), %edx /* We use %EDX for the next run. */ L(4): leal -4(%eax), %edx /* We use %EDX for the next run. */
L7: addl $4, %edx /* adjust pointer for full loop round */ L(7): addl $4, %edx /* adjust pointer for full loop round */
movb (%edx), %cl /* get byte from string */ movb (%edx), %cl /* get byte from string */
cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */ cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */
je L8 /* yes => return */ je L(8) /* yes => return */
movb 1(%edx), %cl /* get byte from string */ movb 1(%edx), %cl /* get byte from string */
cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */ cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */
je L9 /* yes => return */ je L(9) /* yes => return */
movb 2(%edx), %cl /* get byte from string */ movb 2(%edx), %cl /* get byte from string */
cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */ cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */
je L10 /* yes => return */ je L(10) /* yes => return */
movb 3(%edx), %cl /* get byte from string */ movb 3(%edx), %cl /* get byte from string */
cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */ cmpb %cl, (%esp,%ecx) /* is it contained in skipset? */
jne L7 /* no => start loop again */ jne L(7) /* no => start loop again */
incl %edx /* adjust pointer */ incl %edx /* adjust pointer */
L10: incl %edx L(10): incl %edx
L9: incl %edx L(9): incl %edx
L8: /* Remove the stopset table. */ L(8): /* Remove the stopset table. */
addl $256, %esp addl $256, %esp
cmpl %eax, %edx cmpl %eax, %edx
je LreturnNULL /* There was no token anymore. */ je L(returnNULL) /* There was no token anymore. */
movb $0, (%edx) /* Terminate string. */ movb $0, (%edx) /* Terminate string. */
/* Are we at end of string? */ /* Are we at end of string? */
cmpb $0, %cl cmpb $0, %cl
je L11 je L(11)
incl %edx incl %edx
L11: L(11):
/* Store the pointer to the next character. */ /* Store the pointer to the next character. */
#ifdef USE_AS_STRTOK_R #ifdef USE_AS_STRTOK_R
@ -266,7 +268,7 @@ L11:
#endif #endif
ret ret
LreturnNULL: L(returnNULL):
xorl %eax, %eax xorl %eax, %eax
/* Store current pointer for next round. */ /* Store current pointer for next round. */

View File

@ -1,24 +1,22 @@
/* i80386 __mpn_sub_n -- Add two limb vectors of the same length > 0 and store /* i80386 __mpn_sub_n -- Add two limb vectors of the same length > 0 and store
sum in a third limb vector. sum in a third limb vector.
Copyright (C) 1992, 1994, 1995, 1997 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc. The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This file is part of the GNU MP Library. The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
The GNU MP Library is free software; you can redistribute it and/or modify You should have received a copy of the GNU Library General Public License
it under the terms of the GNU Library General Public License as published by along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation; either version 2 of the License, or (at your the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
option) any later version. MA 02111-1307, USA. */
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/* /*
INPUT PARAMETERS INPUT PARAMETERS
@ -47,7 +45,7 @@ C_SYMBOL_NAME(__mpn_sub_n:)
shrl $3,%ecx /* compute count for unrolled loop */ shrl $3,%ecx /* compute count for unrolled loop */
negl %eax negl %eax
andl $7,%eax /* get index where to start loop */ andl $7,%eax /* get index where to start loop */
jz Loop /* necessary special case for 0 */ jz L(oop) /* necessary special case for 0 */
incl %ecx /* adjust loop count */ incl %ecx /* adjust loop count */
shll $2,%eax /* adjustment for pointers... */ shll $2,%eax /* adjustment for pointers... */
subl %eax,%edi /* ... since they are offset ... */ subl %eax,%edi /* ... since they are offset ... */
@ -57,18 +55,18 @@ C_SYMBOL_NAME(__mpn_sub_n:)
#ifdef PIC #ifdef PIC
/* Calculate start address in loop for PIC. Due to limitations in some /* Calculate start address in loop for PIC. Due to limitations in some
assemblers, Loop-L0-3 cannot be put into the leal */ assemblers, Loop-L0-3 cannot be put into the leal */
call L0 call L(0)
L0: leal (%eax,%eax,8),%eax L(0): leal (%eax,%eax,8),%eax
addl (%esp),%eax addl (%esp),%eax
addl $(Loop-L0-3),%eax addl $(L(oop)-L(0)-3),%eax
addl $4,%esp addl $4,%esp
#else #else
/* Calculate start address in loop for non-PIC. */ /* Calculate start address in loop for non-PIC. */
leal (Loop - 3)(%eax,%eax,8),%eax leal (L(oop) - 3)(%eax,%eax,8),%eax
#endif #endif
jmp *%eax /* jump into loop */ jmp *%eax /* jump into loop */
ALIGN (3) ALIGN (3)
Loop: movl (%esi),%eax L(oop): movl (%esi),%eax
sbbl (%edx),%eax sbbl (%edx),%eax
movl %eax,(%edi) movl %eax,(%edi)
movl 4(%esi),%eax movl 4(%esi),%eax
@ -96,7 +94,7 @@ Loop: movl (%esi),%eax
leal 32(%esi),%esi leal 32(%esi),%esi
leal 32(%edx),%edx leal 32(%edx),%edx
decl %ecx decl %ecx
jnz Loop jnz L(oop)
sbbl %eax,%eax sbbl %eax,%eax
negl %eax negl %eax

View File

@ -1,24 +1,22 @@
/* i80386 __mpn_submul_1 -- Multiply a limb vector with a limb and subtract /* i80386 __mpn_submul_1 -- Multiply a limb vector with a limb and subtract
the result from a second limb vector. the result from a second limb vector.
Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
Copyright (C) 1992, 1994 Free Software Foundation, Inc. The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This file is part of the GNU MP Library. The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
The GNU MP Library is free software; you can redistribute it and/or modify You should have received a copy of the GNU Library General Public License
it under the terms of the GNU Library General Public License as published by along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation; either version 2 of the License, or (at your the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
option) any later version. MA 02111-1307, USA. */
The GNU MP Library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with the GNU MP Library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
/* /*
INPUT PARAMETERS INPUT PARAMETERS
@ -56,7 +54,7 @@ C_SYMBOL_NAME(__mpn_submul_1:)
INSN1(neg,l ,R(size)) INSN1(neg,l ,R(size))
INSN2(xor,l ,R(ebx),R(ebx)) INSN2(xor,l ,R(ebx),R(ebx))
ALIGN (3) ALIGN (3)
Loop: L(oop):
INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4)) INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4))
INSN1(mul,l ,R(s2_limb)) INSN1(mul,l ,R(s2_limb))
INSN2(add,l ,R(eax),R(ebx)) INSN2(add,l ,R(eax),R(ebx))
@ -66,7 +64,7 @@ Loop:
INSN2(mov,l ,R(ebx),R(edx)) INSN2(mov,l ,R(ebx),R(edx))
INSN1(inc,l ,R(size)) INSN1(inc,l ,R(size))
INSN1(jnz, ,Loop) INSN1(jnz, ,L(oop))
INSN2(mov,l ,R(eax),R(ebx)) INSN2(mov,l ,R(eax),R(ebx))
INSN1(pop,l ,R(ebp)) INSN1(pop,l ,R(ebp))

View File

@ -33,8 +33,16 @@ __cexp (__complex__ double x)
{ {
double exp_val = __exp (__real__ x); double exp_val = __exp (__real__ x);
__real__ retval = exp_val * __cos (__imag__ x); if (isfinite (exp_val))
__imag__ retval = exp_val * __sin (__imag__ x); {
__real__ retval = exp_val * __cos (__imag__ x);
__imag__ retval = exp_val * __sin (__imag__ x);
}
else
{
__real__ retval = __copysign (exp_val, __cos (__imag__ x));
__imag__ retval = __copysign (exp_val, __sin (__imag__ x));
}
} }
else else
{ {
@ -48,14 +56,17 @@ __cexp (__complex__ double x)
{ {
if (isfinite (__imag__ x)) if (isfinite (__imag__ x))
{ {
if (signbit (__real__ x) == 0 && __imag__ x == 0.0) double value = signbit (__real__ x) ? 0.0 : HUGE_VAL;
retval = HUGE_VAL;
if (__imag__ x == 0.0)
{
__real__ retval = value;
__imag__ retval = __imag__ x;
}
else else
{ {
double value = signbit (__real__ x) ? 0.0 : HUGE_VAL; __real__ retval = __copysign (value, __cos (__imag__ x));
__imag__ retval = __copysign (value, __sin (__imag__ x));
__real__ retval = value * __cos (__imag__ x);
__imag__ retval = value * __sin (__imag__ x);
} }
} }
else if (signbit (__real__ x) == 0) else if (signbit (__real__ x) == 0)
@ -64,7 +75,10 @@ __cexp (__complex__ double x)
__imag__ retval = __nan (""); __imag__ retval = __nan ("");
} }
else else
retval = 0.0; {
__real__ retval = 0.0;
__imag__ retval = __copysign (0.0, __imag__ x);
}
} }
else else
{ {

View File

@ -23,11 +23,14 @@
#include <sysdep.h> #include <sysdep.h>
ENTRY (setjmp) ENTRY (__setjmp)
li 4,1 /* Set second argument to 1. */ li 4,1 /* Set second argument to 1. */
#ifdef PIC #ifdef PIC
b __sigsetjmp@plt b __sigsetjmp@plt
#else #else
b __sigsetjmp b __sigsetjmp
#endif #endif
END (setjmp) END (__setjmp)
.globl setjmp
.set setjmp,__setjmp

View File

@ -188,14 +188,21 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
finaladdr = reloc->r_addend; finaladdr = reloc->r_addend;
} }
else else
finaladdr = (loadbase + (Elf32_Word) (char *) sym->st_value + finaladdr = (loadbase + (Elf32_Word) (char *) sym->st_value
reloc->r_addend); + reloc->r_addend);
} }
/* This is an if/else if chain because GCC 2.7.2.[012] turns case /* This is an if/else if chain because GCC 2.7.2.[012] turns case
statements into non-PIC table lookups. When a later version statements into non-PIC table lookups. When a later version
comes out that fixes this, this should be changed. */ comes out that fixes this, this should be changed. */
if (rinfo == R_PPC_ADDR16_LO) if (rinfo == R_PPC_UADDR32 ||
rinfo == R_PPC_GLOB_DAT ||
rinfo == R_PPC_ADDR32 ||
rinfo == R_PPC_RELATIVE)
{
*reloc_addr = finaladdr;
}
else if (rinfo == R_PPC_ADDR16_LO)
{ {
*(Elf32_Half*) reloc_addr = finaladdr; *(Elf32_Half*) reloc_addr = finaladdr;
} }
@ -205,32 +212,29 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
} }
else if (rinfo == R_PPC_ADDR16_HA) else if (rinfo == R_PPC_ADDR16_HA)
{ {
*(Elf32_Half*) reloc_addr = finaladdr + 0x8000 >> 16; *(Elf32_Half*) reloc_addr = (finaladdr + 0x8000) >> 16;
} }
#ifndef RTLD_BOOTSTRAP
else if (rinfo == R_PPC_REL24) else if (rinfo == R_PPC_REL24)
{ {
Elf32_Sword delta = finaladdr - (Elf32_Word) (char *) reloc_addr; Elf32_Sword delta = finaladdr - (Elf32_Word) (char *) reloc_addr;
assert (delta << 6 >> 6 == delta); if (delta << 6 >> 6 != delta)
_dl_signal_error (0, map->l_name,
"R_PPC_REL24 relocation out of range");
*reloc_addr = *reloc_addr & 0xfc000003 | delta & 0x3fffffc; *reloc_addr = *reloc_addr & 0xfc000003 | delta & 0x3fffffc;
} }
else if (rinfo == R_PPC_UADDR32 ||
rinfo == R_PPC_GLOB_DAT ||
rinfo == R_PPC_ADDR32 ||
rinfo == R_PPC_RELATIVE)
{
*reloc_addr = finaladdr;
}
else if (rinfo == R_PPC_ADDR24) else if (rinfo == R_PPC_ADDR24)
{ {
assert (finaladdr << 6 >> 6 == finaladdr); if (finaladdr << 6 >> 6 != finaladdr)
_dl_signal_error (0, map->l_name,
"R_PPC_ADDR24 relocation out of range");
*reloc_addr = *reloc_addr & 0xfc000003 | finaladdr & 0x3fffffc; *reloc_addr = *reloc_addr & 0xfc000003 | finaladdr & 0x3fffffc;
} }
else if (rinfo == R_PPC_COPY) else if (rinfo == R_PPC_COPY)
{ {
/* Memcpy is safe to use here, because ld.so doesn't have any
COPY relocs (it's self-contained). */
memcpy (reloc_addr, (char *) finaladdr, sym->st_size); memcpy (reloc_addr, (char *) finaladdr, sym->st_size);
} }
#endif
else if (rinfo == R_PPC_REL32) else if (rinfo == R_PPC_REL32)
{ {
*reloc_addr = finaladdr - (Elf32_Word) (char *) reloc_addr; *reloc_addr = finaladdr - (Elf32_Word) (char *) reloc_addr;
@ -239,41 +243,44 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
{ {
Elf32_Sword delta = finaladdr - (Elf32_Word) (char *) reloc_addr; Elf32_Sword delta = finaladdr - (Elf32_Word) (char *) reloc_addr;
if (delta << 6 >> 6 == delta) if (delta << 6 >> 6 == delta)
*reloc_addr = OPCODE_B(delta); *reloc_addr = OPCODE_B (delta);
else if (finaladdr <= 0x01fffffc || finaladdr >= 0xfe000000) else if (finaladdr <= 0x01fffffc || finaladdr >= 0xfe000000)
*reloc_addr = OPCODE_BA(finaladdr); *reloc_addr = OPCODE_BA (finaladdr);
else else
{ {
Elf32_Word *plt = (Elf32_Word *)((char *)map->l_addr + Elf32_Word *plt;
map->l_info[DT_PLTGOT]->d_un.d_val); Elf32_Word index;
Elf32_Word index = (reloc_addr - plt - PLT_INITIAL_ENTRY_WORDS)/2;
Elf32_Word offset = index * 2 + PLT_INITIAL_ENTRY_WORDS; plt = (Elf32_Word *)((char *)map->l_addr
+ map->l_info[DT_PLTGOT]->d_un.d_val);
index = (reloc_addr - plt - PLT_INITIAL_ENTRY_WORDS)/2;
if (index >= PLT_DOUBLE_SIZE) if (index >= PLT_DOUBLE_SIZE)
{ {
/* Slots greater than or equal to 2^13 have 4 words /* Slots greater than or equal to 2^13 have 4 words available
available instead of two. */ instead of two. */
plt[offset ] = OPCODE_LI (11,finaladdr); reloc_addr[0] = OPCODE_LI (11, finaladdr);
plt[offset+1] = OPCODE_ADDIS (11,11,finaladdr + 0x8000 >> 16); reloc_addr[1] = OPCODE_ADDIS (11, 11, finaladdr + 0x8000 >> 16);
plt[offset+2] = OPCODE_MTCTR (11); reloc_addr[2] = OPCODE_MTCTR (11);
plt[offset+3] = OPCODE_BCTR (); reloc_addr[3] = OPCODE_BCTR ();
} }
else else
{ {
Elf32_Word num_plt_entries; Elf32_Word num_plt_entries;
Elf32_Word rel_offset_words;
num_plt_entries = (map->l_info[DT_PLTRELSZ]->d_un.d_val num_plt_entries = (map->l_info[DT_PLTRELSZ]->d_un.d_val
/ sizeof(Elf32_Rela)); / sizeof(Elf32_Rela));
rel_offset_words = PLT_DATA_START_WORDS (num_plt_entries);
plt[offset ] = OPCODE_LI (11,index * 4); reloc_addr[0] = OPCODE_LI (11, index*4);
plt[offset+1] = OPCODE_B (-(4 * (offset + 1 reloc_addr[1] =
- PLT_LONGBRANCH_ENTRY_WORDS))); OPCODE_B (-(4*(index*2
plt[index + rel_offset_words] = finaladdr; + 1
- PLT_LONGBRANCH_ENTRY_WORDS
+ PLT_INITIAL_ENTRY_WORDS)));
plt[index+PLT_DATA_START_WORDS (num_plt_entries)] = finaladdr;
} }
} }
MODIFIED_CODE(reloc_addr); MODIFIED_CODE (reloc_addr);
} }
else else
assert (! "unexpected dynamic reloc type"); assert (! "unexpected dynamic reloc type");
@ -295,7 +302,28 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
#define elf_machine_pltrel_p(type) ((type) == R_PPC_JMP_SLOT) #define elf_machine_pltrel_p(type) ((type) == R_PPC_JMP_SLOT)
/* Set up the loaded object described by L so its unrelocated PLT /* Set up the loaded object described by L so its unrelocated PLT
entries will jump to the on-demand fixup code in dl-runtime.c. */ entries will jump to the on-demand fixup code in dl-runtime.c.
Also install a small trampoline to be used by entries that have
been relocated to an address too far away for a single branch. */
/* A PLT entry does one of three things:
(i) Jumps to the actual routine. Such entries are set up above, in
elf_machine_rela.
(ii) Jumps to the actual routine via glue at the start of the PLT.
We do this by putting the address of the routine in space
allocated at the end of the PLT, and when the PLT entry is
called we load the offset of that word (from the start of the
space) into r11, then call the glue, which loads the word and
branches to that address. These entries are set up in
elf_machine_rela, but the glue is set up here.
(iii) Loads the index of this PLT entry (we count the double-size
entries as one entry for this purpose) into r11, then
branches to code at the start of the PLT. This code then
calls `fixup', in dl-runtime.c, via the glue in the macro
ELF_MACHINE_RUNTIME_TRAMPOLINE, which resets the PLT entry to
be one of the above two types. These entries are set up here. */
static inline void static inline void
elf_machine_runtime_setup (struct link_map *map, int lazy) elf_machine_runtime_setup (struct link_map *map, int lazy)
{ {
@ -316,54 +344,78 @@ elf_machine_runtime_setup (struct link_map *map, int lazy)
if (lazy) if (lazy)
for (i = 0; i < num_plt_entries; i++) for (i = 0; i < num_plt_entries; i++)
{ {
Elf32_Word offset = PLT_ENTRY_START_WORDS(i); Elf32_Word offset = PLT_ENTRY_START_WORDS (i);
if (i >= PLT_DOUBLE_SIZE) if (i >= PLT_DOUBLE_SIZE)
{ {
plt[offset ] = OPCODE_LI (11, i * 4); plt[offset ] = OPCODE_LI (11, i * 4);
plt[offset+1] = OPCODE_ADDIS (11, 11, i * 4 + 0x8000 >> 16); plt[offset+1] = OPCODE_ADDIS (11, 11, (i * 4 + 0x8000) >> 16);
plt[offset+2] = OPCODE_B (-(4 * (offset + 2))); plt[offset+2] = OPCODE_B (-(4 * (offset + 2)));
} }
else else
{ {
plt[offset ] = OPCODE_LI (11, i * 4); plt[offset ] = OPCODE_LI (11, i * 4);
plt[offset+1] = OPCODE_B(-(4 * (offset + 1))); plt[offset+1] = OPCODE_B (-(4 * (offset + 1)));
} }
}
/* Multiply index of entry, by 0xC. */ /* Multiply index of entry by 3 (in r11). */
plt[0] = OPCODE_SLWI (12, 11, 1); plt[0] = OPCODE_SLWI (12, 11, 1);
plt[1] = OPCODE_ADD (11, 12, 11); plt[1] = OPCODE_ADD (11, 12, 11);
if ((Elf32_Word) (char *) _dl_runtime_resolve <= 0x01fffffc if ((Elf32_Word) (char *) _dl_runtime_resolve <= 0x01fffffc ||
|| (Elf32_Word) (char *) _dl_runtime_resolve >= 0xfe000000) (Elf32_Word) (char *) _dl_runtime_resolve >= 0xfe000000)
{ {
plt[2] = OPCODE_LI (12, (Elf32_Word) (char *) map); /* Load address of link map in r12. */
plt[3] = OPCODE_ADDIS (12, 12, plt[2] = OPCODE_LI (12, (Elf32_Word) (char *) map);
(Elf32_Word) (char *) map + 0x8000 >> 16); plt[3] = OPCODE_ADDIS (12, 12, (((Elf32_Word) (char *) map
plt[4] = OPCODE_BA ((Elf32_Word) (char *) _dl_runtime_resolve); + 0x8000) >> 16));
}
/* Call _dl_runtime_resolve. */
plt[4] = OPCODE_BA ((Elf32_Word) (char *) _dl_runtime_resolve);
} }
else else
{ {
/* Get address of _dl_runtime_resolve in CTR. */
plt[2] = OPCODE_LI (12, (Elf32_Word) (char *) _dl_runtime_resolve); plt[2] = OPCODE_LI (12, (Elf32_Word) (char *) _dl_runtime_resolve);
plt[3] = OPCODE_ADDIS(12, 12, 0x8000 + plt[3] = OPCODE_ADDIS (12, 12, ((((Elf32_Word) (char *)
((Elf32_Word) (char *) _dl_runtime_resolve _dl_runtime_resolve)
>> 16)); + 0x8000) >> 16));
plt[4] = OPCODE_MTCTR (12); plt[4] = OPCODE_MTCTR (12);
/* Load address of link map in r12. */
plt[5] = OPCODE_LI (12, (Elf32_Word) (char *) map); plt[5] = OPCODE_LI (12, (Elf32_Word) (char *) map);
plt[6] = OPCODE_ADDIS (12, 12, ((Elf32_Word) (char *) map plt[6] = OPCODE_ADDIS (12, 12, (((Elf32_Word) (char *) map
+ 0x8000 >> 16)); + 0x8000) >> 16));
/* Call _dl_runtime_resolve. */
plt[7] = OPCODE_BCTR (); plt[7] = OPCODE_BCTR ();
} }
/* Convert the index in r11 into an actual address, and get the
word at that address. */
plt[PLT_LONGBRANCH_ENTRY_WORDS] = plt[PLT_LONGBRANCH_ENTRY_WORDS] =
OPCODE_ADDIS (11, 11, (Elf32_Word) (char*) (plt + rel_offset_words) OPCODE_ADDIS (11, 11, (((Elf32_Word) (char*) (plt + rel_offset_words)
+ 0x8000 >> 16); + 0x8000) >> 16));
plt[PLT_LONGBRANCH_ENTRY_WORDS+1] = plt[PLT_LONGBRANCH_ENTRY_WORDS+1] =
OPCODE_LWZ(11,(Elf32_Word)(char*)(plt+rel_offset_words),11); OPCODE_LWZ (11, (Elf32_Word) (char*) (plt+rel_offset_words), 11);
/* Call the procedure at that address. */
plt[PLT_LONGBRANCH_ENTRY_WORDS+2] = OPCODE_MTCTR (11); plt[PLT_LONGBRANCH_ENTRY_WORDS+2] = OPCODE_MTCTR (11);
plt[PLT_LONGBRANCH_ENTRY_WORDS+3] = OPCODE_BCTR (); plt[PLT_LONGBRANCH_ENTRY_WORDS+3] = OPCODE_BCTR ();
/* Now, we've modified code (quite a lot of code, possibly). We
need to write the changes from the data cache to a
second-level unified cache, then make sure that stale data in
the instruction cache is removed. (In a multiprocessor
system, the effect is more complex.)
Assumes the cache line size is at least 32 bytes, or at least
that dcbst and icbi apply to 32-byte lines. At present, all
PowerPC processors have line sizes of exactly 32 bytes. */
size_modified = lazy ? rel_offset_words : PLT_INITIAL_ENTRY_WORDS; size_modified = lazy ? rel_offset_words : PLT_INITIAL_ENTRY_WORDS;
/* Now we need to keep the caches in sync. */
for (i = 0; i < size_modified; i+=8) for (i = 0; i < size_modified; i+=8)
PPC_DCBST (plt + i); PPC_DCBST (plt + i);
PPC_SYNC; PPC_SYNC;
@ -411,7 +463,7 @@ _dl_runtime_resolve:
# The code that calls this has put parameters for `fixup' in r12 and r11. # The code that calls this has put parameters for `fixup' in r12 and r11.
mr 3,12 mr 3,12
mr 4,11 mr 4,11
bl fixup bl fixup@local
# 'fixup' returns the address we want to branch to. # 'fixup' returns the address we want to branch to.
mtctr 3 mtctr 3
# Put the registers back... # Put the registers back...
@ -440,8 +492,9 @@ _dl_runtime_resolve:
The C function `_dl_start' is the real entry point; The C function `_dl_start' is the real entry point;
its return value is the user program's entry point. */ its return value is the user program's entry point. */
#define RTLD_START \ #define RTLD_START \
static ElfW(Addr) _dl_start (void *arg) __attribute__((unused)); \
asm ("\ asm ("\
.text .section \".text\"
.align 2 .align 2
.globl _start .globl _start
.type _start,@function .type _start,@function
@ -535,16 +588,34 @@ _start:
.previous .previous
"); ");
/* The idea here is that to conform to the ABI, we are supposed to try
to load dynamic objects between 0x10000 (we actually use 0x40000 as
the lower bound, to increase the chance of a memory reference from
a null pointer giving a segfault) and the program's load address.
Regrettably, in this code we can't find the program's load address,
so we punt and choose 0x01800000, which is below the ABI's
recommended default, and what GNU ld currently chooses. We only use
the address as a preference for mmap, so if we get it wrong the
worst that happens is that it gets mapped somewhere else.
FIXME: Unfortunately, 'somewhere else' is probably right after the
program's break, which causes malloc to fail. We really need more
information here about the way memory is mapped. */
#define ELF_PREFERRED_ADDRESS_DATA \ #define ELF_PREFERRED_ADDRESS_DATA \
static ElfW(Addr) _dl_preferred_address = 0; static ElfW(Addr) _dl_preferred_address = 1;
#define ELF_PREFERRED_ADDRESS(loader, maplength, mapstartpref) \ #define ELF_PREFERRED_ADDRESS(loader, maplength, mapstartpref) \
( { \ ( { \
ElfW(Addr) prefd; \ ElfW(Addr) prefd; \
if (mapstartpref != 0 && _dl_preferred_address == 0) \ if (mapstartpref != 0 && _dl_preferred_address == 1) \
_dl_preferred_address = mapstartpref; \ _dl_preferred_address = mapstartpref; \
if (mapstartpref != 0) \ if (mapstartpref != 0) \
prefd = mapstartpref; \ prefd = mapstartpref; \
else if (_dl_preferred_address == 1) \
prefd = _dl_preferred_address = \
(0x01800000 - maplength - 0x10000) & \
~(_dl_pagesize - 1); \
else if (_dl_preferred_address < maplength + 0x50000) \ else if (_dl_preferred_address < maplength + 0x50000) \
prefd = 0; \ prefd = 0; \
else \ else \
@ -556,7 +627,7 @@ static ElfW(Addr) _dl_preferred_address = 0;
#define ELF_FIXED_ADDRESS(loader, mapstart) \ #define ELF_FIXED_ADDRESS(loader, mapstart) \
( { \ ( { \
if (mapstart != 0 && _dl_preferred_address < mapstart) \ if (mapstart != 0 && _dl_preferred_address == 1) \
_dl_preferred_address = mapstart; \ _dl_preferred_address = mapstart; \
} ) } )

View File

@ -29,6 +29,7 @@ asm ("\
.section \".text\" .section \".text\"
.align 2 .align 2
.globl _start .globl _start
.type _start,@function
_start: _start:
# save the stack pointer, in case we're statically linked under Linux # save the stack pointer, in case we're statically linked under Linux
mr 8,1 mr 8,1

12
sysdeps/stub/s_exp2.c Normal file
View File

@ -0,0 +1,12 @@
#include <math.h>
#include <stdio.h>
double
__exp2 (double x)
{
fputs ("__exp2 not implemented\n", stderr);
return 0.0;
}
weak_alias (__exp2, exp2)
stub_warning (exp2)

12
sysdeps/stub/s_exp2f.c Normal file
View File

@ -0,0 +1,12 @@
#include <math.h>
#include <stdio.h>
float
__exp2f (float x)
{
fputs ("__exp2f not implemented\n", stderr);
return 0.0;
}
weak_alias (__exp2f, exp2f)
stub_warning (exp2)

12
sysdeps/stub/s_exp2l.c Normal file
View File

@ -0,0 +1,12 @@
#include <math.h>
#include <stdio.h>
long double
__exp2l (long double x)
{
fputs ("__exp2l not implemented\n", stderr);
return 0.0;
}
weak_alias (__exp2l, exp2l)
stub_warning (exp2l)

View File

@ -7,5 +7,6 @@ __log2l (long double x)
fputs ("__log2l not implemented\n", stderr); fputs ("__log2l not implemented\n", stderr);
return 0.0; return 0.0;
} }
weak_alias (__log2l, log2l)
stub_warning (__log2l) stub_warning (log2l)

View File

@ -24,6 +24,74 @@
__BEGIN_DECLS __BEGIN_DECLS
struct icmphdr
{
u_int8_t type; /* message type */
u_int8_t code; /* type sub-code */
u_int16_t checksum;
union
{
struct
{
u_int16_t id;
u_int16_t sequence;
} echo; /* echo datagram */
u_int32_t gateway; /* gateway address */
struct
{
u_int16_t __unused;
u_int16_t mtu;
} frag; /* path mtu discovery */
} un;
};
#define ICMP_ECHOREPLY 0 /* Echo Reply */
#define ICMP_DEST_UNREACH 3 /* Destination Unreachable */
#define ICMP_SOURCE_QUENCH 4 /* Source Quench */
#define ICMP_REDIRECT 5 /* Redirect (change route) */
#define ICMP_ECHO 8 /* Echo Request */
#define ICMP_TIME_EXCEEDED 11 /* Time Exceeded */
#define ICMP_PARAMETERPROB 12 /* Parameter Problem */
#define ICMP_TIMESTAMP 13 /* Timestamp Request */
#define ICMP_TIMESTAMPREPLY 14 /* Timestamp Reply */
#define ICMP_INFO_REQUEST 15 /* Information Request */
#define ICMP_INFO_REPLY 16 /* Information Reply */
#define ICMP_ADDRESS 17 /* Address Mask Request */
#define ICMP_ADDRESSREPLY 18 /* Address Mask Reply */
#define NR_ICMP_TYPES 18
/* Codes for UNREACH. */
#define ICMP_NET_UNREACH 0 /* Network Unreachable */
#define ICMP_HOST_UNREACH 1 /* Host Unreachable */
#define ICMP_PROT_UNREACH 2 /* Protocol Unreachable */
#define ICMP_PORT_UNREACH 3 /* Port Unreachable */
#define ICMP_FRAG_NEEDED 4 /* Fragmentation Needed/DF set */
#define ICMP_SR_FAILED 5 /* Source Route failed */
#define ICMP_NET_UNKNOWN 6
#define ICMP_HOST_UNKNOWN 7
#define ICMP_HOST_ISOLATED 8
#define ICMP_NET_ANO 9
#define ICMP_HOST_ANO 10
#define ICMP_NET_UNR_TOS 11
#define ICMP_HOST_UNR_TOS 12
#define ICMP_PKT_FILTERED 13 /* Packet filtered */
#define ICMP_PREC_VIOLATION 14 /* Precedence violation */
#define ICMP_PREC_CUTOFF 15 /* Precedence cut off */
#define NR_ICMP_UNREACH 15 /* instead of hardcoding immediate value */
/* Codes for REDIRECT. */
#define ICMP_REDIR_NET 0 /* Redirect Net */
#define ICMP_REDIR_HOST 1 /* Redirect Host */
#define ICMP_REDIR_NETTOS 2 /* Redirect Net for TOS */
#define ICMP_REDIR_HOSTTOS 3 /* Redirect Host for TOS */
/* Codes for TIME_EXCEEDED. */
#define ICMP_EXC_TTL 0 /* TTL count exceeded */
#define ICMP_EXC_FRAGTIME 1 /* Fragment Reass time exceeded */
#ifdef __USE_BSD
/* /*
* Copyright (c) 1982, 1986, 1993 * Copyright (c) 1982, 1986, 1993
* The Regents of the University of California. All rights reserved. * The Regents of the University of California. All rights reserved.
@ -65,31 +133,37 @@ __BEGIN_DECLS
/* /*
* Internal of an ICMP Router Advertisement * Internal of an ICMP Router Advertisement
*/ */
struct icmp_ra_addr { struct icmp_ra_addr
u_int32_t ira_addr; {
u_int32_t ira_preference; u_int32_t ira_addr;
u_int32_t ira_preference;
}; };
struct icmp { struct icmp
{
u_int8_t icmp_type; /* type of message, see below */ u_int8_t icmp_type; /* type of message, see below */
u_int8_t icmp_code; /* type sub code */ u_int8_t icmp_code; /* type sub code */
u_int16_t icmp_cksum; /* ones complement checksum of struct */ u_int16_t icmp_cksum; /* ones complement checksum of struct */
union { union
{
u_char ih_pptr; /* ICMP_PARAMPROB */ u_char ih_pptr; /* ICMP_PARAMPROB */
struct in_addr ih_gwaddr; /* gateway address */ struct in_addr ih_gwaddr; /* gateway address */
struct ih_idseq { /* echo datagram */ struct ih_idseq /* echo datagram */
{
u_int16_t icd_id; u_int16_t icd_id;
u_int16_t icd_seq; u_int16_t icd_seq;
} ih_idseq; } ih_idseq;
u_int32_t ih_void; u_int32_t ih_void;
/* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */ /* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
struct ih_pmtu { struct ih_pmtu
{
u_int16_t ipm_void; u_int16_t ipm_void;
u_int16_t ipm_nextmtu; u_int16_t ipm_nextmtu;
} ih_pmtu; } ih_pmtu;
struct ih_rtradv { struct ih_rtradv
{
u_int8_t irt_num_addrs; u_int8_t irt_num_addrs;
u_int8_t irt_wpa; u_int8_t irt_wpa;
u_int16_t irt_lifetime; u_int16_t irt_lifetime;
@ -105,13 +179,16 @@ struct icmp {
#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs #define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs
#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa #define icmp_wpa icmp_hun.ih_rtradv.irt_wpa
#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime #define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
union { union
struct { {
struct
{
u_int32_t its_otime; u_int32_t its_otime;
u_int32_t its_rtime; u_int32_t its_rtime;
u_int32_t its_ttime; u_int32_t its_ttime;
} id_ts; } id_ts;
struct { struct
{
struct ip idi_ip; struct ip idi_ip;
/* options and then 64 bits of data */ /* options and then 64 bits of data */
} id_ip; } id_ip;
@ -149,11 +226,9 @@ struct icmp {
#endif #endif
/* Definition of type and code fields. */ /* Definition of type and code fields. */
#define ICMP_ECHOREPLY 0 /* echo reply */ /* defined above: ICMP_ECHOREPLY, ICMP_REDIRECT, ICMP_ECHO */
#define ICMP_UNREACH 3 /* dest unreachable, codes: */ #define ICMP_UNREACH 3 /* dest unreachable, codes: */
#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */ #define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */
#define ICMP_REDIRECT 5 /* shorter route, codes: */
#define ICMP_ECHO 8 /* echo service */
#define ICMP_ROUTERADVERT 9 /* router advertisement */ #define ICMP_ROUTERADVERT 9 /* router advertisement */
#define ICMP_ROUTERSOLICIT 10 /* router solicitation */ #define ICMP_ROUTERSOLICIT 10 /* router solicitation */
#define ICMP_TIMXCEED 11 /* time exceeded, code: */ #define ICMP_TIMXCEED 11 /* time exceeded, code: */
@ -205,6 +280,8 @@ struct icmp {
(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \ (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY) (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
#endif /* __USE_BSD */
__END_DECLS __END_DECLS
#endif /* netinet/ip_icmp.h */ #endif /* netinet/ip_icmp.h */

View File

@ -2,3 +2,6 @@ clone.S
ioctl-types.h ioctl-types.h
termbits.h termbits.h
termios.h termios.h
kernel_stat.h
kernel_termios.h
sys/kernel_termios.h

View File

@ -27,22 +27,30 @@
/* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */ /* int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg); */
ENTRY(clone) ENTRY(__clone)
/* Set up stack frame, save registers. */ /* Set up stack frame, save registers. */
stwu 1,-20(1) stwu 1,-32(1)
stw 31,16(1) stw 31,16(1)
stw 30,20(1)
/* Check for child_stack == NULL, fn == NULL. */ /* Check for child_stack == NULL || fn == NULL. */
mr. 31,4 cmpwi 0,4,0
cmpwi 1,3,0 cmpwi 1,3,0
cror 2+0*4,2+0*4,2+1*4 cror 2+0*4,2+0*4,2+1*4
beq- 0,badargs beq- 0,badargs
/* Save 'fn' and its argument on the new stack. */ /* Set up stack frame for child. */
stw 3,0(4) addi 4,4,-16
stw 6,4(4) clrrwi 4,4,4
li 0,0
stw 0,0(4)
/* 'flags' argument is (only) parameter to clone syscall. */ /* Save new stack, fn, args across syscall. */
mr 30,3 /* Function in r30. */
mr 31,6 /* Arguments in r31. */
/* 'flags' argument is first parameter to clone syscall. (The other
argument is the stack pointer, already in r4.) */
mr 3,5 mr 3,5
/* Do the call. */ /* Do the call. */
@ -51,22 +59,22 @@ ENTRY(clone)
beq child beq child
/* Parent. Restore registers & return. */ /* Parent. Restore registers & return. */
lwz 31,20(1) lwz 31,16(1)
addi 1,1,20 lwz 30,20(1)
addi 1,1,32
blr blr
child: child:
/* Get address of procedure to call. */
lwz 0,0(31)
/* Set up argument register. */
lwz 3,4(31)
mtlr 0
/* Switch to new stack. */
mr 1,31
/* Call procedure. */ /* Call procedure. */
mtlr 30
mr 3,31
blrl blrl
/* Call _exit with result from procedure. */ /* Call _exit with result from procedure. */
DO_CALL (SYS_ify (exit)) #ifdef PIC
b _exit@plt
#else
b _exit
#endif
badargs: badargs:
li 3,-EINVAL li 3,-EINVAL
@ -76,3 +84,7 @@ error:
#else #else
b __syscall_error b __syscall_error
#endif #endif
PSEUDO_END (__clone)
weak_alias (__clone, clone)

View File

@ -1,4 +1,4 @@
/* Optimized strlen implementation for PowerPC. /* Definition of `struct stat' used in the kernel.
Copyright (C) 1997 Free Software Foundation, Inc. Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
@ -17,36 +17,29 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
.section ".text" struct kernel_stat
.align 2 {
.globl strlen unsigned int st_dev;
.type strlen,@function unsigned int st_ino;
strlen: unsigned int st_mode;
rlwinm 7,3,0,0,29 unsigned short st_nlink;
lis 8,0x7f7f unsigned int st_uid;
lwz 11,0(7) unsigned int st_gid;
ori 8,8,32639 unsigned int st_rdev;
rlwinm 4,3,3,27,28 unsigned long int st_size;
li 9,-1 unsigned long int st_blksize;
or 10,11,8 unsigned long int st_blocks;
and 0,11,8 unsigned long int st_atime;
srw 9,9,4 unsigned long int __unused1;
add 0,0,8 #define _HAVE___UNUSED1
nor 0,10,0 unsigned long int st_mtime;
and. 11,0,9 unsigned long int __unused2;
bc 4,2,.L2 #define _HAVE___UNUSED2
.L3: unsigned long int st_ctime;
lwzu 11,4(7) unsigned long int __unused3;
or 10,11,8 #define _HAVE___UNUSED3
and 0,11,8 unsigned long int __unused4;
add 0,0,8 #define _HAVE___UNUSED4
nor. 11,10,0 unsigned long int __unused5;
bc 12,2,.L3 #define _HAVE___UNUSED5
.L2: };
subf 0,3,7
cntlzw 3,11
srwi 3,3,3
add 3,0,3
blr
.Lfe1:
.size strlen,.Lfe1-strlen

View File

@ -1,79 +0,0 @@
/* Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _STATBUF_H
#define _STATBUF_H 1
/* Versions of the `struct stat' data structure. */
#define _STAT_VER_LINUX 1
#define _STAT_VER_SVR4 2
#define _STAT_VER _STAT_VER_LINUX /* The one defined below. */
/* Versions of the `xmknod' interface. */
#define _MKNOD_VER_LINUX 1
#define _MKNOD_VER_SVR4 2
#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
struct stat
{
unsigned int st_dev; /* Device. */
unsigned int st_ino; /* File serial number. */
unsigned int st_mode; /* File mode. */
unsigned short int st_nlink; /* Link count. */
unsigned int st_uid; /* User ID of the file's owner. */
unsigned int st_gid; /* Group ID of the file's group.*/
unsigned int st_rdev; /* Device number, if device. */
long int st_size; /* Size of file, in bytes. */
unsigned long int st_blksize; /* Optimal block size for I/O. */
#define _STATBUF_ST_BLKSIZE /* Tell code we have this member. */
unsigned long int st_blocks; /* Number of 512-byte blocks allocated. */
unsigned long int st_atime; /* Time of last access. */
unsigned long int __unused1;
unsigned long int st_mtime; /* Time of last modification. */
unsigned long int __unused2;
unsigned long int st_ctime; /* Time of last status change. */
unsigned long int __unused3;
unsigned long int __unused4;
unsigned long int __unused5;
};
/* Encoding of the file mode. */
#define __S_IFMT 0170000 /* These bits determine file type. */
/* File types. */
#define __S_IFDIR 0040000 /* Directory. */
#define __S_IFCHR 0020000 /* Character device. */
#define __S_IFBLK 0060000 /* Block device. */
#define __S_IFREG 0100000 /* Regular file. */
#define __S_IFIFO 0010000 /* FIFO. */
#define __S_IFLNK 0120000 /* Symbolic link. */
#define __S_IFSOCK 0140000 /* Socket. */
/* Protection bits. */
#define __S_ISUID 04000 /* Set user ID on execution. */
#define __S_ISGID 02000 /* Set group ID on execution. */
#define __S_ISVTX 01000 /* Save swapped text after use (sticky). */
#define __S_IREAD 0400 /* Read by owner. */
#define __S_IWRITE 0200 /* Write by owner. */
#define __S_IEXEC 0100 /* Execute by owner. */
#endif /* statbuf.h */

View File

@ -0,0 +1,43 @@
/* Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _SYS_KERNEL_TERMIOS_H
#define _SYS_KERNEL_TERMIOS_H 1
/* The following corresponds to the values from the Linux 2.0.28 kernel. */
/* We need the definition of tcflag_t, cc_t, and speed_t. */
#include <termbits.h>
#define __KERNEL_NCCS 19
struct __kernel_termios
{
tcflag_t c_iflag; /* input mode flags */
tcflag_t c_oflag; /* output mode flags */
tcflag_t c_cflag; /* control mode flags */
tcflag_t c_lflag; /* local mode flags */
cc_t c_cc[__KERNEL_NCCS]; /* control characters */
cc_t c_line; /* line discipline */
int c_ispeed; /* input speed */
int c_ospeed; /* output speed */
};
#define _HAVE_C_ISPEED 1
#define _HAVE_C_OSPEED 1
#endif /* sys/kernel_termios.h */

View File

@ -43,7 +43,7 @@
#ifdef PIC #ifdef PIC
#define PSEUDO(name, syscall_name, args) \ #define PSEUDO(name, syscall_name, args) \
.text; \ .section ".text"; \
ENTRY (name) \ ENTRY (name) \
DO_CALL (SYS_ify (syscall_name)); \ DO_CALL (SYS_ify (syscall_name)); \
bnslr; \ bnslr; \
@ -56,6 +56,7 @@
bnslr; \ bnslr; \
b __syscall_error b __syscall_error
#endif #endif
#define ret /* Nothing (should be 'blr', but never reached). */ #define ret /* Nothing (should be 'blr', but never reached). */
#endif /* ASSEMBLER */ #endif /* ASSEMBLER */

View File

@ -1,4 +1,4 @@
# @(#)africa 7.16 # @(#)africa 7.17
# This data is by no means authoritative; if you think you know better, # This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to # go ahead and edit the file (and please send any changes to
@ -403,8 +403,10 @@ Rule Libya 1986 only - Oct 3 0:00 0 -
Rule Libya 1987 1989 - Apr 1 0:00 1:00 S Rule Libya 1987 1989 - Apr 1 0:00 1:00 S
Rule Libya 1987 1990 - Oct 1 0:00 0 - Rule Libya 1987 1990 - Oct 1 0:00 0 -
Rule Libya 1990 only - May 4 0:00 1:00 S Rule Libya 1990 only - May 4 0:00 1:00 S
Rule Libya 1996 max - Mar 30 2:00s 1:00 S Rule Libya 1996 only - Mar 30 2:00s 1:00 S
Rule Libya 1996 max - Sep 30 2:00s 0 - Rule Libya 1996 only - Sep 30 2:00s 0 -
Rule Libya 1997 max - Mar lastThu 2:00s 1:00 S
Rule Libya 1997 max - Oct Thu>=1 2:00s 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Africa/Tripoli 0:52:44 - LMT 1920 Zone Africa/Tripoli 0:52:44 - LMT 1920
1:00 Libya CE%sT 1959 1:00 Libya CE%sT 1959
@ -525,9 +527,10 @@ Zone Atlantic/St_Helena -0:22:48 - LMT 1890 # Jamestown
-0:06 - SHT 1951 # St Helena Time (?) -0:06 - SHT 1951 # St Helena Time (?)
0:00 - GMT 0:00 - GMT
# The other parts of the St Helena territory are similar: # The other parts of the St Helena territory are similar:
# Tristan da Cunha: on GMT, says Whitman # Tristan da Cunha: on GMT, say Whitman and the CIA
# Ascension: on GMT, says usno1995 # Ascension: on GMT, says usno1995 and the CIA
# Gough, Inaccessible, Nightingale: no information, but probably GMT # Gough (scientific station since 1955): on GMT, says the CIA
# Inaccessible, Nightingale: no information, but probably GMT
# Sao Tome and Principe # Sao Tome and Principe
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
@ -577,7 +580,8 @@ Rule SA 1943 1944 - Mar Sun>=15 2:00 0 -
Zone Africa/Johannesburg 1:52:00 - LMT 1892 Feb 8 Zone Africa/Johannesburg 1:52:00 - LMT 1892 Feb 8
1:30 - SAT 1903 Mar 1:30 - SAT 1903 Mar
2:00 SA SA%sT 2:00 SA SA%sT
# Prince Edward Is # Marion and Prince Edward Is
# weather station since 1947
# no information # no information
# Sudan # Sudan

View File

@ -1,8 +1,9 @@
# @(#)antarctica 7.7 # @(#)antarctica 7.8
# From Paul Eggert (1997-01-20): # From Paul Eggert (1997-03-28):
# To keep things manageable, we list only locations occupied year-round; # To keep things manageable, we list only locations occupied year-round;
# see <URL:http://earth.agu.org/amen/nations.html> (1996-05-24). # see <URL:http://earth.agu.org/amen/nations.html> (1996-05-24)
# and <URL:http://www.spri.cam.ac.uk/bob/periant.htm> (1996-09-05).
# Unless otherwise specified, we have no time zone information. # Unless otherwise specified, we have no time zone information.
# #
# Except for the French entries, # Except for the French entries,
@ -29,7 +30,7 @@ Rule ChileAQ 1970 max - Mar Sun>=9 0:00 0 -
# 5 others # 5 others
# Australia - territories # Australia - territories
# Heard Island, McDonald Islands # Heard Island, McDonald Islands (uninhabited)
# #
# year-round bases # year-round bases
# Casey, Bailey Peninsula, since 1969 # Casey, Bailey Peninsula, since 1969
@ -70,9 +71,10 @@ Zone Antarctica/Mawson 0 - ___ 1954 Feb 13
# #
# Martin-de-Vivies Base, Amsterdam Island, -374105+0773155, since 1950 # Martin-de-Vivies Base, Amsterdam Island, -374105+0773155, since 1950
# Alfred-Faure Base, Crozet Islands, -462551+0515152, since 1964 # Alfred-Faure Base, Crozet Islands, -462551+0515152, since 1964
# Port-aux-Francais, Kerguelen Islands, -492110+0701303, since 1951 # Port-aux-Francais, Kerguelen Islands, -492110+0701303, since 1951;
# a whaling and sealing station operated 1908-14, 1920-29, and 1951-56
# #
# St Paul Island - near Amsterdam, uninhabited since 1927 # St Paul Island - near Amsterdam, uninhabited since 1931
# #
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Indian/Kerguelen 0 - ___ 1950 # Port-aux-Francais Zone Indian/Kerguelen 0 - ___ 1950 # Port-aux-Francais
@ -107,8 +109,8 @@ Zone Antarctica/DumontDUrville 0 - ___ 1947
# King Sejong, King George Island, since 1988 # King Sejong, King George Island, since 1988
# New Zealand - claims # New Zealand - claims
# Balleny Islands # Balleny Islands (never inhabited)
# Scott Island # Scott Island (never inhabited)
# #
# year-round base # year-round base
# Scott, Ross Island, since 1957-01, is like Antarctica/McMurdo. # Scott, Ross Island, since 1957-01, is like Antarctica/McMurdo.
@ -124,10 +126,10 @@ Rule NZAQ 1976 1989 - Mar Sun>=1 2:00s 0 S
Rule NZAQ 1990 max - Mar Sun>=15 2:00s 0 S Rule NZAQ 1990 max - Mar Sun>=15 2:00s 0 S
# Norway - territories # Norway - territories
# Bouvet (uninhabited) # Bouvet (never inhabited)
# #
# claims # claims
# Peter I Island (uninhabited) # Peter I Island (never inhabited)
# Poland - year-round base # Poland - year-round base
# Arctowski, King George Island, since 1977 # Arctowski, King George Island, since 1977
@ -147,7 +149,11 @@ Rule NZAQ 1990 max - Mar Sun>=15 2:00s 0 S
# #
# British Antarctic Territories (BAT) claims # British Antarctic Territories (BAT) claims
# South Orkney Islands # South Orkney Islands
# scientific station from 1903
# whaling station at Signy I 1920-1926
# South Shetland Islands # South Shetland Islands
# whaling station at Deception I 1912-1931
# scientific station from 1943
# #
# year-round bases # year-round bases
# Halley, Coates Land, -7535-2619, since 1956-01-06 # Halley, Coates Land, -7535-2619, since 1956-01-06

View File

@ -1,4 +1,4 @@
# @(#)asia 7.28 # @(#)asia 7.29
# This data is by no means authoritative; if you think you know better, # This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to # go ahead and edit the file (and please send any changes to
@ -508,8 +508,6 @@ Rule Zion 1988 only - Sep 3 0:00 0 S
# From Ephraim Silverberg (ephraim@cs.huji.ac.il), 1997-03-04: # From Ephraim Silverberg (ephraim@cs.huji.ac.il), 1997-03-04:
# Zone Information Compiler (ZIC) File for the State of Israel (1989-2009)
# According to the Office of the Secretary General of the Ministry of # According to the Office of the Secretary General of the Ministry of
# Interior, there is NO set rule for Daylight-Savings/Standard time changes. # Interior, there is NO set rule for Daylight-Savings/Standard time changes.
# Each year they decide anew what havoc to wreak on the country. However, # Each year they decide anew what havoc to wreak on the country. However,
@ -525,27 +523,27 @@ Rule Zion 1988 only - Sep 3 0:00 0 S
# change back to standard time took place on Sunday night instead of Saturday # change back to standard time took place on Sunday night instead of Saturday
# night to avoid conflicts with the Jewish New Year. # night to avoid conflicts with the Jewish New Year.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Zion 1989 only - Apr 30 0:00 1:00 D Rule Zion 1989 only - Apr 30 0:00 1:00 D
Rule Zion 1989 only - Sep 3 0:00 0:00 S Rule Zion 1989 only - Sep 3 0:00 0 S
Rule Zion 1990 only - Mar 25 0:00 1:00 D Rule Zion 1990 only - Mar 25 0:00 1:00 D
Rule Zion 1990 only - Aug 26 0:00 0:00 S Rule Zion 1990 only - Aug 26 0:00 0 S
Rule Zion 1991 only - Mar 24 0:00 1:00 D Rule Zion 1991 only - Mar 24 0:00 1:00 D
Rule Zion 1991 only - Sep 1 0:00 0:00 S Rule Zion 1991 only - Sep 1 0:00 0 S
Rule Zion 1992 only - Mar 29 0:00 1:00 D Rule Zion 1992 only - Mar 29 0:00 1:00 D
Rule Zion 1992 only - Sep 6 0:00 0:00 S Rule Zion 1992 only - Sep 6 0:00 0 S
Rule Zion 1993 only - Apr 2 0:00 1:00 D Rule Zion 1993 only - Apr 2 0:00 1:00 D
Rule Zion 1993 only - Sep 5 0:00 0:00 S Rule Zion 1993 only - Sep 5 0:00 0 S
# The dates for 1994-1995 were obtained from Office of the Spokeswoman for the # The dates for 1994-1995 were obtained from Office of the Spokeswoman for the
# Ministry of Interior, Jerusalem, Israel. The spokeswoman can be reached by # Ministry of Interior, Jerusalem, Israel. The spokeswoman can be reached by
# calling the office directly at 972-2-6701447 or 972-2-6701448. # calling the office directly at 972-2-6701447 or 972-2-6701448.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Zion 1994 only - Apr 1 0:00 1:00 D Rule Zion 1994 only - Apr 1 0:00 1:00 D
Rule Zion 1994 only - Aug 28 0:00 0:00 S Rule Zion 1994 only - Aug 28 0:00 0 S
Rule Zion 1995 only - Mar 31 0:00 1:00 D Rule Zion 1995 only - Mar 31 0:00 1:00 D
Rule Zion 1995 only - Sep 3 0:00 0:00 S Rule Zion 1995 only - Sep 3 0:00 0 S
# The dates for 1996 were determined by the Minister of Interior of the # The dates for 1996 were determined by the Minister of Interior of the
# time, Haim Ramon. The official announcement regarding 1996-1998 # time, Haim Ramon. The official announcement regarding 1996-1998
@ -560,40 +558,20 @@ Rule Zion 1995 only - Sep 3 0:00 0:00 S
# #
# ftp://ftp.huji.ac.il/pub/tz/announcements/1997.ps.gz # ftp://ftp.huji.ac.il/pub/tz/announcements/1997.ps.gz
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Zion 1996 only - Mar 15 0:00 1:00 D Rule Zion 1996 only - Mar 15 0:00 1:00 D
Rule Zion 1996 only - Sep 16 0:00 0:00 S Rule Zion 1996 only - Sep 16 0:00 0 S
Rule Zion 1997 only - Mar 21 0:00 1:00 D Rule Zion 1997 only - Mar 21 0:00 1:00 D
Rule Zion 1997 only - Sep 14 0:00 0:00 S Rule Zion 1997 only - Sep 14 0:00 0 S
Rule Zion 1998 only - Mar 20 0:00 1:00 D Rule Zion 1998 only - Mar 20 0:00 1:00 D
Rule Zion 1998 only - Oct 18 0:00 0:00 S Rule Zion 1998 only - Oct 18 0:00 0 S
# These rules are probably wrong, but they are close approximations (usually
# within a few weeks):
# From Paul Eggert (1997-03-15):
# Here are guesses for rules after 1998.
# They are probably wrong, but they are more likely than no DST at all.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Zion 1999 only - Apr 11 0:00 1:00 D Rule Zion 1999 max - Mar Fri>=15 0:00 1:00 D
Rule Zion 1999 only - Sep 5 0:00 0:00 S Rule Zion 1999 max - Sep Sun>=15 0:00 0 S
Rule Zion 2000 only - Apr 30 0:00 1:00 D
Rule Zion 2000 only - Sep 24 0:00 0:00 S
Rule Zion 2001 only - Apr 15 0:00 1:00 D
Rule Zion 2001 only - Sep 9 0:00 0:00 S
Rule Zion 2002 only - Apr 7 0:00 1:00 D
Rule Zion 2002 only - Sep 1 0:00 0:00 S
Rule Zion 2003 only - Apr 27 0:00 1:00 D
Rule Zion 2003 only - Sep 21 0:00 0:00 S
Rule Zion 2004 only - Apr 18 0:00 1:00 D
Rule Zion 2004 only - Sep 12 0:00 0:00 S
Rule Zion 2005 only - May 1 0:00 1:00 D
Rule Zion 2005 only - Sep 25 0:00 0:00 S
Rule Zion 2006 only - Apr 23 0:00 1:00 D
Rule Zion 2006 only - Sep 17 0:00 0:00 S
Rule Zion 2007 only - Apr 15 0:00 1:00 D
Rule Zion 2007 only - Sep 9 0:00 0:00 S
Rule Zion 2008 only - Apr 27 0:00 1:00 D
Rule Zion 2008 only - Sep 21 0:00 0:00 S
Rule Zion 2009 only - Apr 19 0:00 1:00 D
Rule Zion 2009 only - Sep 13 0:00 0:00 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Jerusalem 2:20:56 - LMT 1880 Zone Asia/Jerusalem 2:20:56 - LMT 1880
@ -810,7 +788,8 @@ Rule Mongol 1985 1990 - Mar lastSun 2:00 1:00 S
Rule Mongol 1985 1990 - Sep lastSun 3:00 0 - Rule Mongol 1985 1990 - Sep lastSun 3:00 0 -
Rule Mongol 1991 max - Mar lastSun 0:00 1:00 S Rule Mongol 1991 max - Mar lastSun 0:00 1:00 S
Rule Mongol 1991 1995 - Sep lastSun 0:00 0 - Rule Mongol 1991 1995 - Sep lastSun 0:00 0 -
Rule Mongol 1996 max - Oct Fri>=22 0:00 0 - Rule Mongol 1996 only - Oct Fri>=22 0:00 0 -
Rule Mongol 1997 max - Sep lastSun 0:00 0 -
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
#Zone Asia/Dariv 6:14:32 - LMT 1905 Aug #Zone Asia/Dariv 6:14:32 - LMT 1905 Aug
# 6:00 - DART 1978 # Dariv Time # 6:00 - DART 1978 # Dariv Time
@ -909,6 +888,11 @@ Zone Asia/Singapore 6:55:24 - LMT 1880
# reported ``the country's standard time will be put forward by one hour at # reported ``the country's standard time will be put forward by one hour at
# midnight Friday (1830 GMT) `in the light of the present power crisis'.'' # midnight Friday (1830 GMT) `in the light of the present power crisis'.''
# Transitions before 1996 are from Shanks (1991). # Transitions before 1996 are from Shanks (1991).
#
# From Dharmasiri Senanayake, Sri Lanka Media Minister (1996-10-24), as quoted
# in <URL:news:54rka5$m5h@mtinsc01-mgt.ops.worldnet.att.net> (1996-10-26):
# With effect from 12.30 a.m. on 26th October 1996
# Sri Lanka will be six (06) hours ahead of GMT.
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Asia/Colombo 5:19:24 - LMT 1880 Zone Asia/Colombo 5:19:24 - LMT 1880
@ -917,7 +901,8 @@ Zone Asia/Colombo 5:19:24 - LMT 1880
5:30 0:30 IHST 1942 Sep 5:30 0:30 IHST 1942 Sep
5:30 1:00 IST 1945 Oct 16 2:00 5:30 1:00 IST 1945 Oct 16 2:00
5:30 - IST 1996 May 25 0:00 5:30 - IST 1996 May 25 0:00
6:30 - LKT # Sri Lanka Time 6:30 - LKT 1996 Oct 26 0:30
6:00 - LKT
# Syria # Syria
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S

View File

@ -1,4 +1,4 @@
# @(#)australasia 7.32 # @(#)australasia 7.33
# This file also includes Pacific islands. # This file also includes Pacific islands.
# Notes are at the end of this file # Notes are at the end of this file
@ -170,7 +170,12 @@ Zone Indian/Christmas 7:02:52 - LMT 1895 Feb
# no indigenous inhabitants; only meteorologists # no indigenous inhabitants; only meteorologists
# no information # no information
# #
# Macquarie, Manihiki, Penrhyn, Rakehanga # Macquarie
# permanent occupation (scientific station) since 1948;
# sealing and penguin oil station operated 1888-1917
# no information
#
# Manihiki, Penrhyn, Rakehanga
# no information # no information
@ -277,6 +282,9 @@ Zone Pacific/Nauru 11:07:40 - LMT 1921 Jan 15 # Uaobe
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule NC 1977 1978 - Dec Sun>=1 0:00 1:00 S Rule NC 1977 1978 - Dec Sun>=1 0:00 1:00 S
Rule NC 1978 1979 - Feb 27 0:00 0 - Rule NC 1978 1979 - Feb 27 0:00 0 -
Rule NC 1996 only - Dec 1 2:00s 1:00 S
Rule NC 1997 max - Mar Sun>=1 2:00s 0 -
Rule NC 1997 max - Nov lastSun 2:00s 1:00 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone Pacific/Noumea 11:05:48 - LMT 1912 Jan 13 Zone Pacific/Noumea 11:05:48 - LMT 1912 Jan 13
11:00 NC NC%sT 11:00 NC NC%sT
@ -315,8 +323,13 @@ Zone Pacific/Auckland 11:39:04 - LMT 1868
Zone Pacific/Chatham 12:45 Chatham CHA%sT Zone Pacific/Chatham 12:45 Chatham CHA%sT
# Antipodes Is, Kermadec Is # Auckland Is
# uninhabited except by research personnel; probably like Pacific/Auckland # uninhabited
# Campbell I
# minor whaling stations operated 1909-14
# scientific station operated 1941-1995
# was probably like Pacific/Auckland
############################################################################### ###############################################################################

View File

@ -1,4 +1,4 @@
# @(#)europe 7.42 # @(#)europe 7.43
# This data is by no means authoritative; if you think you know better, # This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to # go ahead and edit the file (and please send any changes to
@ -630,10 +630,18 @@
# came into force on 16 November. It restates the dates from the EC # came into force on 16 November. It restates the dates from the EC
# seventh Summer Time Directive.... # seventh Summer Time Directive....
# #
# From Peter Ilieve <peter@aldie.co.uk> (1996-04-20): # From Peter Ilieve <peter@aldie.co.uk> (1997-03-28):
# Proposals for the eighth directive were supposed to have been produced # The [European] Transport Council discussed the proposed Eighth Directive
# by the Commission by 1 Jan 96. They have not yet appeared (I asked just # on 11 March and agreed [to] it, so it moves forward to the next stage,
# before Easter). # from a Commission proposal to a Common Position.... What this means is:
#
# - The eighth directive proposal rules have been accepted.
# These are the same as the current rules (last Sunday in March and last
# Sunday in October). The rules will run until 2001.
#
# - The French have had their request to abandon summer time turned down.
# They have been promised some sort of review in 1999 which might change
# the rules for 2000 and 2001.
# From Peter Ilieve <peter@memex.co.uk> (1994-03-28): # From Peter Ilieve <peter@memex.co.uk> (1994-03-28):
# The [GB-Eire] end date of 22 October [1995] conflicts with your current rule # The [GB-Eire] end date of 22 October [1995] conflicts with your current rule

View File

@ -1,4 +1,4 @@
# @(#)northamerica 7.30 # @(#)northamerica 7.31
# also includes Central America and the Caribbean # also includes Central America and the Caribbean
# This data is by no means authoritative; if you think you know better, # This data is by no means authoritative; if you think you know better,
@ -1141,14 +1141,14 @@ Rule Cuba 1969 1971 - Oct lastSun 0:00 0 S
Rule Cuba 1972 1974 - Oct 8 0:00 0 S Rule Cuba 1972 1974 - Oct 8 0:00 0 S
Rule Cuba 1975 1977 - Oct lastSun 0:00 0 S Rule Cuba 1975 1977 - Oct lastSun 0:00 0 S
Rule Cuba 1978 only - May 7 0:00 1:00 D Rule Cuba 1978 only - May 7 0:00 1:00 D
Rule Cuba 1978 1980 - Oct Sun>=8 0:00 0 S Rule Cuba 1978 1990 - Oct Sun>=8 0:00 0 S
Rule Cuba 1979 1980 - Mar Sun>=15 0:00 1:00 D Rule Cuba 1979 1980 - Mar Sun>=15 0:00 1:00 D
Rule Cuba 1981 1985 - May Sun>=5 0:00 1:00 D Rule Cuba 1981 1985 - May Sun>=5 0:00 1:00 D
Rule Cuba 1981 1990 - Oct Sun>=8 0:00 0 S
Rule Cuba 1986 1989 - Mar Sun>=14 0:00 1:00 D Rule Cuba 1986 1989 - Mar Sun>=14 0:00 1:00 D
Rule Cuba 1990 max - Apr Sun>=1 0:00 1:00 D Rule Cuba 1990 max - Apr Sun>=1 0:00 1:00 D
Rule Cuba 1991 1995 - Oct Sun>=8 0:00s 0 S Rule Cuba 1991 1995 - Oct Sun>=8 0:00s 0 S
Rule Cuba 1996 max - Oct Sun>=1 0:00s 0 S Rule Cuba 1996 only - Oct Sun>=1 0:00s 0 S
Rule Cuba 1997 max - Oct Sun>=8 0:00s 0 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Havana -5:29:28 - LMT 1890 Zone America/Havana -5:29:28 - LMT 1890

View File

@ -176,13 +176,14 @@ extern int errno;
** Private function declarations. ** Private function declarations.
*/ */
char * icalloc P((int nelem, int elsize)); char * icalloc P((int nelem, int elsize));
char * icatalloc P((char * old, const char * const new)); char * icatalloc P((char * old, const char * new));
char * icpyalloc P((const char * const string)); char * icpyalloc P((const char * string));
char * imalloc P((const int n)); char * imalloc P((int n));
void * irealloc P((void * const pointer, const int size)); void * irealloc P((void * pointer, int size));
void icfree P((char * const pointer)); void icfree P((char * pointer));
void ifree P((char * const pointer)); void ifree P((char * pointer));
char * scheck P((const char * const string, const char * const format)); char * scheck P((const char *string, char *format));
/* /*
** Finally, some convenience items. ** Finally, some convenience items.

View File

@ -11,7 +11,7 @@ static char elsieid[] = "@(#)scheck.c 8.14";
char * char *
scheck(string, format) scheck(string, format)
const char * const string; const char * const string;
const char * const format; char * const format;
{ {
register char * fbuf; register char * fbuf;
register const char * fp; register const char * fp;

View File

@ -1,4 +1,4 @@
# @(#)southamerica 7.16 # @(#)southamerica 7.17
# This data is by no means authoritative; if you think you know better, # This data is by no means authoritative; if you think you know better,
# go ahead and edit the file (and please send any changes to # go ahead and edit the file (and please send any changes to
@ -267,10 +267,11 @@ Rule Brazil 1988 1989 - Oct Sun>=10 0:00 1:00 D
Rule Brazil 1990 1991 - Feb Sun>=11 0:00 0 S Rule Brazil 1990 1991 - Feb Sun>=11 0:00 0 S
Rule Brazil 1990 1992 - Oct Sun>=20 0:00 1:00 D Rule Brazil 1990 1992 - Oct Sun>=20 0:00 1:00 D
Rule Brazil 1992 only - Feb 9 0:00 0 S Rule Brazil 1992 only - Feb 9 0:00 0 S
Rule Brazil 1993 max - Oct Sun>=11 0:00 1:00 D Rule Brazil 1993 1995 - Oct Sun>=11 0:00 1:00 D
Rule Brazil 1993 only - Jan 31 0:00 0 S Rule Brazil 1993 only - Jan 31 0:00 0 S
Rule Brazil 1994 1995 - Feb Sun>=15 0:00 0 S Rule Brazil 1994 1995 - Feb Sun>=15 0:00 0 S
Rule Brazil 1996 max - Feb Sun>=11 0:00 0 S Rule Brazil 1996 max - Feb Sun>=11 0:00 0 S
Rule Brazil 1996 max - Oct Sun>=1 0:00 1:00 D
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
# #
@ -434,9 +435,11 @@ Rule Para 1991 only - Oct 6 0:00 1:00 S
Rule Para 1992 only - Mar 1 0:00 0 - Rule Para 1992 only - Mar 1 0:00 0 -
Rule Para 1992 only - Oct 5 0:00 1:00 S Rule Para 1992 only - Oct 5 0:00 1:00 S
Rule Para 1993 only - Mar 31 0:00 0 - Rule Para 1993 only - Mar 31 0:00 0 -
Rule Para 1993 max - Oct 1 0:00 1:00 S Rule Para 1993 1995 - Oct 1 0:00 1:00 S
Rule Para 1994 1995 - Feb lastSun 0:00 0 - Rule Para 1994 1995 - Feb lastSun 0:00 0 -
Rule Para 1996 max - Mar 1 0:00 0 - Rule Para 1996 max - Mar 1 0:00 0 -
Rule Para 1996 only - Oct 6 0:00 1:00 S
Rule Para 1997 max - Oct 1 0:00 1:00 S
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Asuncion -3:50:40 - LMT 1890 Zone America/Asuncion -3:50:40 - LMT 1890
-3:50:40 - AMT 1931 Oct 10 # Asuncion Mean Time -3:50:40 - AMT 1931 Oct 10 # Asuncion Mean Time