1
0
mirror of https://sourceware.org/git/glibc.git synced 2026-01-06 11:51:29 +03:00
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

View File

@@ -1,24 +1,22 @@
/* i80386 __mpn_add_n -- Add two limb vectors of the same length > 0 and store
sum in a third limb vector.
/* Add two limb vectors of the same length > 0 and store 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
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 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. */
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
@@ -47,7 +45,7 @@ C_SYMBOL_NAME(__mpn_add_n:)
shrl $3,%ecx /* compute count for unrolled loop */
negl %eax
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 */
shll $2,%eax /* adjustment for pointers... */
subl %eax,%edi /* ... since they are offset ... */
@@ -57,18 +55,18 @@ C_SYMBOL_NAME(__mpn_add_n:)
#ifdef PIC
/* Calculate start address in loop for PIC. Due to limitations in some
assemblers, Loop-L0-3 cannot be put into the leal */
call L0
L0: leal (%eax,%eax,8),%eax
call L(0)
L(0): leal (%eax,%eax,8),%eax
addl (%esp),%eax
addl $(Loop-L0-3),%eax
addl $(L(oop)-L(0)-3),%eax
addl $4,%esp
#else
/* Calculate start address in loop for non-PIC. */
leal (Loop - 3)(%eax,%eax,8),%eax
leal (L(oop) - 3)(%eax,%eax,8),%eax
#endif
jmp *%eax /* jump into loop */
ALIGN (3)
Loop: movl (%esi),%eax
L(oop): movl (%esi),%eax
adcl (%edx),%eax
movl %eax,(%edi)
movl 4(%esi),%eax
@@ -96,7 +94,7 @@ Loop: movl (%esi),%eax
leal 32(%esi),%esi
leal 32(%edx),%edx
decl %ecx
jnz Loop
jnz L(oop)
sbbl %eax,%eax
negl %eax

View File

@@ -1,24 +1,22 @@
/* i80386 __mpn_addmul_1 -- Multiply a limb vector with a limb and add
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
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 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. */
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
@@ -56,7 +54,7 @@ C_SYMBOL_NAME(__mpn_addmul_1:)
INSN1(neg,l ,R(size))
INSN2(xor,l ,R(ebx),R(ebx))
ALIGN (3)
Loop:
L(oop):
INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4))
INSN1(mul,l ,R(s2_limb))
INSN2(add,l ,R(eax),R(ebx))
@@ -66,7 +64,7 @@ Loop:
INSN2(mov,l ,R(ebx),R(edx))
INSN1(inc,l ,R(size))
INSN1(jnz, ,Loop)
INSN1(jnz, ,L(oop))
INSN2(mov,l ,R(eax),R(ebx))
INSN1(pop,l ,R(ebp))

View File

@@ -63,3 +63,18 @@
#undef ALIGN
#define ALIGN(log) .align 1<<log
#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.
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.
Contributed by Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>.
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 */
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. */
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? */
jz L2 /* yes => start appending */
jz L(2) /* yes => start appending */
incl %edx /* increment source pointer */
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? */
jz L2 /* yes => start appending */
jz L(2) /* yes => start appending */
incl %edx /* increment source pointer */
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? */
jz L2 /* yes => start appending */
jz L(2) /* yes => start appending */
incl %edx /* increment source pointer */
/* Now we are aligned. Begin scan loop. */
jmp L1
jmp L(1)
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 */
/* 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
overflow, we can now test this condition. If no carry is signaled
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
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. */
/* 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 $0xfefefeff, %edi /* magic value */
addl %eax, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 $0xfefefeff, %edi /* magic value */
addl %eax, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 $0xfefefeff, %edi /* magic value */
addl %eax, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 */
L6: addl $4, %edx
L5: addl $4, %edx
L(7): addl $4, %edx /* adjust source pointer */
L(6): addl $4, %edx
L(5): addl $4, %edx
L3: testb %al, %al /* is first byte NUL? */
jz L2 /* yes => start copying */
L(3): testb %al, %al /* is first byte NUL? */
jz L(2) /* yes => start copying */
incl %edx /* increment source pointer */
testb %ah, %ah /* is second byte NUL? */
jz L2 /* yes => start copying */
jz L(2) /* yes => start copying */
incl %edx /* increment source pointer */
testl $0xff0000, %eax /* is third byte NUL? */
jz L2 /* yes => start copying */
jz L(2) /* yes => start copying */
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. */
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 %al, (%ecx,%edx) /* and store it */
andb %al, %al /* is byte NUL? */
jz L8 /* yes => return */
jz L(8) /* yes => return */
incl %ecx /* increment pointer */
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 %al, (%ecx,%edx) /* and store it */
andb %al, %al /* is byte NUL? */
jz L8 /* yes => return */
jz L(8) /* yes => return */
incl %ecx /* increment pointer */
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 %al, (%ecx,%edx) /* and store it */
andb %al, %al /* is byte NUL? */
jz L8 /* yes => return */
jz L(8) /* yes => return */
incl %ecx /* increment pointer */
/* Now we are aligned. */
jmp L29 /* start copy loop */
jmp L(29) /* start copy loop */
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 */
L29: movl (%ecx), %eax /* get word from source */
L(29): movl (%ecx), %eax /* get word from source */
movl $0xfefefeff, %edi /* magic value */
addl %eax, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 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
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 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
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 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
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 */
L92: addl $4, %ecx
L91: addl $4, %ecx
L(93): addl $4, %ecx /* adjust pointer */
L(92): 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? */
jz L8 /* yes => return */
jz L(8) /* yes => return */
movb %ah, 1(%ecx,%edx) /* store second byte of last word */
orb %ah, %ah /* is it NUL? */
jz L8 /* yes => return */
jz L(8) /* yes => return */
shrl $16, %eax /* make upper bytes accessible */
movb %al, 2(%ecx,%edx) /* store third byte of last word */
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 */
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 */
ret

View File

@@ -1,23 +1,23 @@
/* strlen(str) -- determine the length of the string STR.
Optimized for Intel 80x86, x>=4.
Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>.
This file is part of the GNU C Library.
Optimized for Intel 80x86, x>=4.
Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>.
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 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.
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. */
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. */
#include <sysdep.h>
#include "asm-syntax.h"
@@ -33,21 +33,21 @@ ENTRY (strlen)
movl %ecx, %eax /* duplicate it */
andl $3, %ecx /* mask alignment bits */
jz L1 /* aligned => start loop */
jz L(1) /* aligned => start loop */
cmpb %ch, (%eax) /* is byte NUL? */
je L2 /* yes => return */
je L(2) /* yes => return */
incl %eax /* increment pointer */
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? */
je L2 /* yes => return */
je L(2) /* yes => return */
addl $1, %eax /* increment pointer */
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? */
je L2 /* yes => return */
je L(2) /* yes => return */
/* 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
@@ -61,73 +61,73 @@ ENTRY (strlen)
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 */
addl %ecx, %edx /* add the magic value to the word. We get
carry bits reported for each byte which
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 */
orl $0xfefefeff, %edx /* set all non-carry bits */
incl %edx /* add 1: if one carry bit was *not* set
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 $0xfefefeff, %edx /* magic value */
addl %ecx, %edx /* add the magic value to the word. We get
carry bits reported for each byte which
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 */
orl $0xfefefeff, %edx /* set all non-carry bits */
incl %edx /* add 1: if one carry bit was *not* set
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 $0xfefefeff, %edx /* magic value */
addl %ecx, %edx /* add the magic value to the word. We get
carry bits reported for each byte which
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 */
orl $0xfefefeff, %edx /* set all non-carry bits */
incl %edx /* add 1: if one carry bit was *not* set
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 $0xfefefeff, %edx /* magic value */
addl %ecx, %edx /* add the magic value to the word. We get
carry bits reported for each byte which
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 */
orl $0xfefefeff, %edx /* set all non-carry bits */
incl %edx /* add 1: if one carry bit was *not* set
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 */
L6: addl $4, %eax
L5: addl $4, %eax
L(7): addl $4, %eax /* adjust pointer */
L(6): addl $4, %eax
L(5): addl $4, %eax
L3: testb %cl, %cl /* is first byte NUL? */
jz L2 /* yes => return */
L(3): testb %cl, %cl /* is first byte NUL? */
jz L(2) /* yes => return */
incl %eax /* increment pointer */
testb %ch, %ch /* is second byte NUL? */
jz L2 /* yes => return */
jz L(2) /* yes => return */
incl %eax /* increment pointer */
testl $0xff0000, %ecx /* is third byte NUL? */
jz L2 /* yes => return pointer */
jz L(2) /* yes => return 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
END (strlen)

View File

@@ -1,24 +1,22 @@
/* Pentium __mpn_add_n -- Add two limb vectors of the same length > 0 and store
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
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 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. */
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
@@ -52,14 +50,14 @@ C_SYMBOL_NAME(__mpn_add_n:)
shrl $3,%ecx
andl $7,%edx
testl %ecx,%ecx /* zero carry flag */
jz Lend
jz L(end)
pushl %edx
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
L1: movl (%esi),%eax
L(1): movl (%esi),%eax
movl 4(%esi),%edx
adcl %ebx,%eax
movl 4(%ebp),%ebx
@@ -68,7 +66,7 @@ L1: movl (%esi),%eax
movl %eax,-32(%edi)
movl %edx,-28(%edi)
L2: movl 8(%esi),%eax
L(2): movl 8(%esi),%eax
movl 12(%esi),%edx
adcl %ebx,%eax
movl 12(%ebp),%ebx
@@ -77,7 +75,7 @@ L2: movl 8(%esi),%eax
movl %eax,-24(%edi)
movl %edx,-20(%edi)
L3: movl 16(%esi),%eax
L(3): movl 16(%esi),%eax
movl 20(%esi),%edx
adcl %ebx,%eax
movl 20(%ebp),%ebx
@@ -86,7 +84,7 @@ L3: movl 16(%esi),%eax
movl %eax,-16(%edi)
movl %edx,-12(%edi)
L4: movl 24(%esi),%eax
L(4): movl 24(%esi),%eax
movl 28(%esi),%edx
adcl %ebx,%eax
movl 28(%ebp),%ebx
@@ -98,14 +96,14 @@ L4: movl 24(%esi),%eax
leal 32(%esi),%esi
leal 32(%ebp),%ebp
decl %ecx
jnz Loop
jnz L(oop)
popl %edx
Lend:
L(end):
decl %edx /* test %edx w/o clobbering carry */
js Lend2
js L(end2)
incl %edx
Loop2:
L(oop2):
leal 4(%edi),%edi
movl (%esi),%eax
adcl %ebx,%eax
@@ -114,8 +112,8 @@ Loop2:
leal 4(%esi),%esi
leal 4(%ebp),%ebp
decl %edx
jnz Loop2
Lend2:
jnz L(oop2)
L(end2):
movl (%esi),%eax
adcl %ebx,%eax
movl %eax,(%edi)

View File

@@ -1,24 +1,22 @@
/* Pentium __mpn_addmul_1 -- Multiply a limb vector with a limb and add
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
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 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. */
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
@@ -57,7 +55,7 @@ C_SYMBOL_NAME(__mpn_addmul_1:)
INSN2(xor,l ,R(ebx),R(ebx))
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))
INSN1(mul,l ,R(s2_limb))
@@ -72,7 +70,7 @@ Loop: INSN2(adc,l ,R(ebx),$0)
INSN1(inc,l ,R(size))
INSN2(mov,l ,R(ebx),R(edx))
INSN1(jnz, ,Loop)
INSN1(jnz, ,L(oop))
INSN2(adc,l ,R(ebx),$0)
INSN2(mov,l ,R(eax),R(ebx))

View File

@@ -1,5 +1,5 @@
/* 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.
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. */
cmp $1,%ecx
jne Lnormal
jne L(normal)
leal 4(%esi),%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
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(%esi,%ebp,4),%esi
@@ -65,12 +65,12 @@ Lnormal:
decl %ebp
pushl %ebp
shrl $3,%ebp
jz Lend
jz L(end)
movl (%edi),%eax /* fetch destination cache line */
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 (%esi),%eax
@@ -104,21 +104,23 @@ Loop: movl -28(%edi),%eax /* fetch destination cache line */
subl $32,%esi
subl $32,%edi
decl %ebp
jnz Loop
jnz L(oop)
Lend: popl %ebp
L(end): popl %ebp
andl $7,%ebp
jz Lend2
Loop2: movl (%esi),%eax
jz L(end2)
L(oop2):
movl (%esi),%eax
shldl %cl,%eax,%edx
movl %edx,(%edi)
movl %eax,%edx
subl $4,%esi
subl $4,%edi
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 */
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.
*/
Lspecial:
L(special):
movl (%esi),%edx
addl $4,%esi
@@ -145,12 +147,13 @@ Lspecial:
addl %edx,%edx
incl %ebp
decl %ebp
jz LLend
jz L(Lend)
movl (%edi),%eax /* fetch destination cache line */
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 (%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(%edi),%edi
decl %ebp
jnz LLoop
jnz L(Loop)
LLend: popl %ebp
L(Lend):
popl %ebp
sbbl %eax,%eax /* save carry in %eax */
andl $7,%ebp
jz LLend2
jz L(Lend2)
addl %eax,%eax /* restore carry from eax */
LLoop2: movl %edx,%ebx
L(Loop2):
movl %edx,%ebx
movl (%esi),%edx
adcl %edx,%edx
movl %ebx,(%edi)
@@ -199,11 +204,12 @@ LLoop2: movl %edx,%ebx
leal 4(%esi),%esi /* use leal not to clobber carry */
leal 4(%edi),%edi
decl %ebp
jnz LLoop2
jnz L(Loop2)
jmp LL1
LLend2: addl %eax,%eax /* restore carry from eax */
LL1: movl %edx,(%edi) /* store last limb */
jmp L(L1)
L(Lend2):
addl %eax,%eax /* restore carry from eax */
L(L1): movl %edx,(%edi) /* store last limb */
sbbl %eax,%eax
negl %eax

View File

@@ -1,25 +1,26 @@
/* memset/bzero -- set memory area to CH/0
Highly optimized version for ix85, x>=5.
Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Torbjorn Granlund, <tege@matematik.su.se>
Highly optimized version for ix85, x>=5.
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Torbjorn Granlund, <tege@matematik.su.se>
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 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.
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. */
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. */
#include <sysdep.h>
#include "asm-syntax.h"
/*
INPUT PARAMETERS:
@@ -52,7 +53,7 @@ ENTRY (memset)
/* If less than 36 bytes to write, skip tricky code (it wouldn't work). */
cmpl $36, %edx
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. */
movl %edi, %ecx /* Copy ptr to ecx... */
@@ -66,7 +67,7 @@ ENTRY (memset)
movl (%edi), %ecx /* Fetch destination cache line */
.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 */
movl %eax, 0(%edi) /* store words pairwise */
movl %eax, 4(%edi)
@@ -77,12 +78,12 @@ L1: movl 28(%edi), %ecx /* allocate cache line for destination */
movl %eax, 24(%edi)
movl %eax, 28(%edi)
leal 32(%edi), %edi /* update destination pointer */
jge L1
jge L(1)
leal 32(%edx), %ecx /* reset offset count */
/* 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
stosl

View File

@@ -1,24 +1,22 @@
/* Pentium __mpn_mul_1 -- Multiply a limb vector with a limb and store
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
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 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. */
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
@@ -57,7 +55,7 @@ C_SYMBOL_NAME(__mpn_mul_1:)
INSN2(xor,l ,R(ebx),R(ebx))
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))
INSN1(mul,l ,R(s2_limb))
@@ -68,7 +66,7 @@ Loop: INSN2(adc,l ,R(ebx),$0)
INSN1(inc,l ,R(size))
INSN2(mov,l ,R(ebx),R(edx))
INSN1(jnz, ,Loop)
INSN1(jnz, ,L(oop))
INSN2(adc,l ,R(ebx),$0)
INSN2(mov,l ,R(eax),R(ebx))

View File

@@ -1,23 +1,21 @@
/* 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
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 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. */
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
@@ -46,15 +44,15 @@ C_SYMBOL_NAME(__mpn_rshift:)
/* We can use faster code for shift-by-1 under certain conditions. */
cmp $1,%ecx
jne Lnormal
jne L(normal)
leal 4(%edi),%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
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
addl $4,%esi
xorl %eax,%eax
@@ -64,12 +62,12 @@ Lnormal:
decl %ebp
pushl %ebp
shrl $3,%ebp
jz Lend
jz L(end)
movl (%edi),%eax /* fetch destination cache line */
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 (%esi),%eax
@@ -103,21 +101,23 @@ Loop: movl 28(%edi),%eax /* fetch destination cache line */
addl $32,%esi
addl $32,%edi
decl %ebp
jnz Loop
jnz L(oop)
Lend: popl %ebp
L(end): popl %ebp
andl $7,%ebp
jz Lend2
Loop2: movl (%esi),%eax
jz L(end2)
L(oop2):
movl (%esi),%eax
shrdl %cl,%eax,%edx /* compute result limb */
movl %edx,(%edi)
movl %eax,%edx
addl $4,%esi
addl $4,%edi
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 */
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.
*/
Lspecial:
L(special):
leal -4(%edi,%ebp,4),%edi
leal -4(%esi,%ebp,4),%esi
@@ -147,12 +147,13 @@ Lspecial:
shrl $1,%edx
incl %ebp
decl %ebp
jz LLend
jz L(Lend)
movl (%edi),%eax /* fetch destination cache line */
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 (%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(%edi),%edi
decl %ebp
jnz LLoop
jnz L(Loop)
LLend: popl %ebp
L(Lend):
popl %ebp
sbbl %eax,%eax /* save carry in %eax */
andl $7,%ebp
jz LLend2
jz L(Lend2)
addl %eax,%eax /* restore carry from eax */
LLoop2: movl %edx,%ebx
L(Loop2):
movl %edx,%ebx
movl (%esi),%edx
rcrl $1,%edx
movl %ebx,(%edi)
@@ -201,11 +204,12 @@ LLoop2: movl %edx,%ebx
leal -4(%esi),%esi /* use leal not to clobber carry */
leal -4(%edi),%edi
decl %ebp
jnz LLoop2
jnz L(Loop2)
jmp LL1
LLend2: addl %eax,%eax /* restore carry from eax */
LL1: movl %edx,(%edi) /* store last limb */
jmp L(L1)
L(Lend2):
addl %eax,%eax /* restore carry from eax */
L(L1): movl %edx,(%edi) /* store last limb */
movl $0,%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.
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.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
@@ -20,6 +20,7 @@
Boston, MA 02111-1307, USA. */
#include <sysdep.h>
#include "asm-syntax.h"
/* This version is especially optimized for the i586 (and following?)
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 */
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 */
jp L0 /* exactly two bits set */
jp L(0) /* exactly two bits set */
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 */
je L3 /* yes => return NULL */
je L(3) /* yes => return NULL */
movb 1(%eax), %cl /* load single byte */
incl %eax
cmpb %cl, %dl /* is byte == C? */
je L2 /* aligned => return pointer */
je L(2) /* aligned => return pointer */
cmpb $0, %cl /* is byte NUL? */
je L3 /* yes => return NULL */
je L(3) /* yes => return NULL */
incl %eax
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? */
je L2 /* aligned => return pointer */
je L(2) /* aligned => return pointer */
cmpb $0, %cl /* is byte NUL? */
je L3 /* yes => return NULL */
je L(3) /* yes => return NULL */
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
because the same code is found at the end of the loop, but
there it is executed in parallel with other instructions. */
L11: movl (%eax), %ecx
L(11): movl (%eax), %ecx
movl $magic, %ebp
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
the test for C. */
L1: xorl %ecx, %ebp /* (word^magic) */
L(1): xorl %ecx, %ebp /* (word^magic) */
addl %ecx, %edi /* add magic word */
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 */
orl $magic, %ebp /* (word^magic)|magic */
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 */
xorl %edx, %ebx /* clear words which are C */
@@ -154,7 +155,7 @@ L1: xorl %ecx, %ebp /* (word^magic) */
addl %ebx, %esi /* (word+magic) */
movl $magic, %edi
jnc L5 /* previous addl caused overflow? */
jnc L(5) /* previous addl caused overflow? */
movl %edi, %ebp
xorl %ebx, %esi /* (word+magic)^word */
@@ -163,19 +164,19 @@ L1: xorl %ecx, %ebp /* (word^magic) */
orl $magic, %esi /* ((word+magic)^word)|magic */
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
addl %ecx, %edi
leal 4(%eax), %eax
jnc L4
jnc L(4)
movl %ecx, %ebx
orl $magic, %ebp
addl $1, %ebp
jne L4
jne L(4)
movl $magic, %esi
xorl %edx, %ebx
@@ -184,7 +185,7 @@ L1: xorl %ecx, %ebp /* (word^magic) */
addl %ebx, %esi
movl $magic, %edi
jnc L5
jnc L(5)
movl %edi, %ebp
xorl %ebx, %esi
@@ -193,19 +194,19 @@ L1: xorl %ecx, %ebp /* (word^magic) */
orl $magic, %esi
addl $1, %esi
jne L5
jne L(5)
xorl %ecx, %ebp
addl %ecx, %edi
leal 4(%eax), %eax
jnc L4
jnc L(4)
movl %ecx, %ebx
orl $magic, %ebp
addl $1, %ebp
jne L4
jne L(4)
movl $magic, %esi
xorl %edx, %ebx
@@ -214,7 +215,7 @@ L1: xorl %ecx, %ebp /* (word^magic) */
addl %ebx, %esi
movl $magic, %edi
jnc L5
jnc L(5)
movl %edi, %ebp
xorl %ebx, %esi
@@ -223,19 +224,19 @@ L1: xorl %ecx, %ebp /* (word^magic) */
orl $magic, %esi
addl $1, %esi
jne L5
jne L(5)
xorl %ecx, %ebp
addl %ecx, %edi
leal 4(%eax), %eax
jnc L4
jnc L(4)
movl %ecx, %ebx
orl $magic, %ebp
addl $1, %ebp
jne L4
jne L(4)
movl $magic, %esi
xorl %edx, %ebx
@@ -244,7 +245,7 @@ L1: xorl %ecx, %ebp /* (word^magic) */
addl %ebx, %esi
movl $magic, %edi
jnc L5
jnc L(5)
movl %edi, %ebp
xorl %ebx, %esi
@@ -254,29 +255,29 @@ L1: xorl %ecx, %ebp /* (word^magic) */
addl $1, %esi
je L1
je L(1)
/* We know there is no NUL byte but a C byte in the word.
%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? */
jz L2 /* yes => return pointer */
jz L(2) /* yes => return pointer */
incl %eax /* increment pointer */
testb %bh, %bh /* second byte == C? */
jz L2 /* yes => return pointer */
jz L(2) /* yes => return pointer */
shrl $16, %ebx /* make upper bytes accessible */
incl %eax /* increment pointer */
cmp $0, %bl /* third byte == C */
je L2 /* yes => return pointer */
je L(2) /* yes => return pointer */
incl %eax /* increment pointer */
L2: popl %ebp /* restore saved registers */
L(2): popl %ebp /* restore saved registers */
popl %ebx
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
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? */
je L2 /* yes => return pointer */
je L(2) /* yes => return pointer */
cmpb $0, %cl /* first byte == NUL? */
je L3 /* yes => return NULL */
je L(3) /* yes => return NULL */
incl %eax /* increment pointer */
cmpb %dl, %ch /* second byte == C? */
je L2 /* yes => return pointer */
je L(2) /* yes => return pointer */
cmpb $0, %ch /* second byte == NUL? */
je L3 /* yes => return NULL */
je L(3) /* yes => return NULL */
shrl $16, %ecx /* make upper bytes accessible */
incl %eax /* increment pointer */
cmpb %dl, %cl /* third byte == C? */
je L2 /* yes => return pointer */
je L(2) /* yes => return pointer */
cmpb $0, %cl /* third byte == NUL? */
je L3 /* yes => return NULL */
je L(3) /* yes => return NULL */
incl %eax /* increment pointer */
/* The test four the fourth byte is necessary! */
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 %ebx

View File

@@ -1,6 +1,6 @@
/* strlen -- Compute length og NUL terminated string.
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.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
@@ -20,6 +20,7 @@
Boston, MA 02111-1307, USA. */
#include <sysdep.h>
#include "asm-syntax.h"
/* This version is especially optimized for the i586 (and following?)
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 */
jz L1 /* aligned => start loop */
jp L0 /* exactly two bits set */
jz L(1) /* aligned => start loop */
jp L(0) /* exactly two bits set */
cmpb %dh, (%eax) /* is byte NUL? */
je L2 /* yes => return */
je L(2) /* yes => return */
incl %eax /* increment pointer */
cmpb %dh, (%eax) /* is byte NUL? */
je L2 /* yes => return */
je L(2) /* yes => return */
incl %eax /* increment pointer */
xorl $2, %edx
jz L1
jz L(1)
L0: cmpb %dh, (%eax) /* is byte NUL? */
je L2 /* yes => return */
L(0): cmpb %dh, (%eax) /* is byte NUL? */
je L(2) /* yes => return */
incl %eax /* increment pointer */
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. */
L1:
L(1):
movl (%eax), %ecx /* get word (= 4 bytes) in question */
addl $4, %eax /* adjust pointer for *next* word */
@@ -99,13 +100,13 @@ L1:
addl $magic, %ecx /* add magic 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 */
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 */
@@ -115,13 +116,13 @@ L1:
addl $magic, %ecx /* add magic 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 */
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 */
@@ -131,13 +132,13 @@ L1:
addl $magic, %ecx /* add magic 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 */
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 */
@@ -147,35 +148,35 @@ L1:
addl $magic, %ecx /* add magic 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 */
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
cmpb $0, %cl /* lowest byte NUL? */
jz L2 /* yes => return */
jz L(2) /* yes => return */
inc %eax /* increment pointer */
testb %ch, %ch /* second byte NUL? */
jz L2 /* yes => return */
jz L(2) /* yes => return */
shrl $16, %ecx /* make upper bytes accessible */
incl %eax /* increment pointer */
cmpb $0, %cl /* is third byte NUL? */
jz L2 /* yes => return */
jz L(2) /* yes => return */
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
character */

View File

@@ -1,24 +1,22 @@
/* Pentium __mpn_sub_n -- Subtract two limb vectors of the same length > 0
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
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 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. */
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
@@ -52,14 +50,14 @@ C_SYMBOL_NAME(__mpn_sub_n:)
shrl $3,%ecx
andl $7,%edx
testl %ecx,%ecx /* zero carry flag */
jz Lend
jz L(end)
pushl %edx
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
L1: movl (%esi),%eax
L(1): movl (%esi),%eax
movl 4(%esi),%edx
sbbl %ebx,%eax
movl 4(%ebp),%ebx
@@ -68,7 +66,7 @@ L1: movl (%esi),%eax
movl %eax,-32(%edi)
movl %edx,-28(%edi)
L2: movl 8(%esi),%eax
L(2): movl 8(%esi),%eax
movl 12(%esi),%edx
sbbl %ebx,%eax
movl 12(%ebp),%ebx
@@ -77,7 +75,7 @@ L2: movl 8(%esi),%eax
movl %eax,-24(%edi)
movl %edx,-20(%edi)
L3: movl 16(%esi),%eax
L(3): movl 16(%esi),%eax
movl 20(%esi),%edx
sbbl %ebx,%eax
movl 20(%ebp),%ebx
@@ -86,7 +84,7 @@ L3: movl 16(%esi),%eax
movl %eax,-16(%edi)
movl %edx,-12(%edi)
L4: movl 24(%esi),%eax
L(4): movl 24(%esi),%eax
movl 28(%esi),%edx
sbbl %ebx,%eax
movl 28(%ebp),%ebx
@@ -98,14 +96,14 @@ L4: movl 24(%esi),%eax
leal 32(%esi),%esi
leal 32(%ebp),%ebp
decl %ecx
jnz Loop
jnz L(oop)
popl %edx
Lend:
L(end):
decl %edx /* test %edx w/o clobbering carry */
js Lend2
js L(end2)
incl %edx
Loop2:
L(oop2):
leal 4(%edi),%edi
movl (%esi),%eax
sbbl %ebx,%eax
@@ -114,8 +112,8 @@ Loop2:
leal 4(%esi),%esi
leal 4(%ebp),%ebp
decl %edx
jnz Loop2
Lend2:
jnz L(oop2)
L(end2):
movl (%esi),%eax
sbbl %ebx,%eax
movl %eax,(%edi)

View File

@@ -1,24 +1,22 @@
/* Pentium __mpn_submul_1 -- Multiply a limb vector with a limb and subtract
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
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 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. */
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
@@ -57,7 +55,7 @@ C_SYMBOL_NAME(__mpn_submul_1:)
INSN2(xor,l ,R(ebx),R(ebx))
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))
INSN1(mul,l ,R(s2_limb))
@@ -72,7 +70,7 @@ Loop: INSN2(adc,l ,R(ebx),$0)
INSN1(inc,l ,R(size))
INSN2(mov,l ,R(ebx),R(edx))
INSN1(jnz, ,Loop)
INSN1(jnz, ,L(oop))
INSN2(adc,l ,R(ebx),$0)
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
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 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. */
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
@@ -49,22 +47,22 @@ C_SYMBOL_NAME(__mpn_lshift:)
xorl %eax,%eax
shldl %cl,%ebx,%eax /* compute carry limb */
decl %edx
jz Lend
jz L(end)
pushl %eax /* push carry limb onto stack */
testb $1,%edx
jnz L1 /* enter loop in the middle */
jnz L(1) /* enter loop in the middle */
movl %ebx,%eax
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 */
movl %eax,(%edi,%edx,4) /* store it */
decl %edx
L1: movl (%esi,%edx,4),%eax
L(1): movl (%esi,%edx,4),%eax
shldl %cl,%eax,%ebx
movl %ebx,(%edi,%edx,4)
decl %edx
jnz Loop
jnz L(oop)
shll %cl,%eax /* compute least significant limb */
movl %eax,(%edi) /* store it */
@@ -76,7 +74,7 @@ L1: movl (%esi,%edx,4),%eax
popl %edi
ret
Lend: shll %cl,%ebx /* compute least significant limb */
L(end): shll %cl,%ebx /* compute least significant limb */
movl %ebx,(%edi) /* store it */
popl %ebx

View File

@@ -1,7 +1,7 @@
/* memchr (str, ch, n) -- Return pointer to first occurrence of CH in STR less
than N.
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.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
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
them one by one. This is especially true for 0. */
cmpl $4, %esi
jb L3
jb L(3)
/* At the moment %edx contains C. What we need for the
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. */
testb $3, %eax /* correctly aligned ? */
je L2 /* yes => begin loop */
je L(2) /* yes => begin loop */
cmpb %dl, (%eax) /* compare byte */
je L9 /* target found => return */
je L(9) /* target found => return */
incl %eax /* increment source pointer */
decl %esi /* decrement length counter */
je L4 /* len==0 => return NULL */
je L(4) /* len==0 => return NULL */
testb $3, %eax /* correctly aligned ? */
je L2 /* yes => begin loop */
je L(2) /* yes => begin loop */
cmpb %dl, (%eax) /* compare byte */
je L9 /* target found => return */
je L(9) /* target found => return */
incl %eax /* increment source pointer */
decl %esi /* decrement length counter */
je L4 /* len==0 => return NULL */
je L(4) /* len==0 => return NULL */
testb $3, %eax /* correctly aligned ? */
je L2 /* yes => begin loop */
je L(2) /* yes => begin loop */
cmpb %dl, (%eax) /* compare byte */
je L9 /* target found => return */
je L(9) /* target found => return */
incl %eax /* increment source pointer */
decl %esi /* decrement length counter */
/* no test for len==0 here, because this is done in the
loop head */
jmp L2
jmp L(2)
/* We exit the loop if adding MAGIC_BITS to LONGWORD fails to
change any of the hole bits of LONGWORD.
@@ -127,7 +127,7 @@ ENTRY (memchr)
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 */
xorl %edx, %ecx /* XOR with word c|c|c|c => bytes of str == c
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
overflow, we can now test this condition. If no carry is signaled
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
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. */
/* 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.
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
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 $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
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 $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
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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. */
addl $16, %eax
L2: subl $16, %esi
jae L1 /* Still more than 16 bytes remaining */
L(2): subl $16, %esi
jae L(1) /* Still more than 16 bytes remaining */
/* Process remaining bytes separately. */
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 $0xfefefeff, %edi /* magic value */
@@ -220,16 +220,16 @@ L2: subl $16, %esi
addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 */
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 $0xfefefeff, %edi /* magic value */
@@ -238,16 +238,16 @@ L2: subl $16, %esi
addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 */
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 $0xfefefeff, %edi /* magic value */
@@ -256,60 +256,60 @@ L2: subl $16, %esi
addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 */
/* Check the remaining bytes one by one. */
L3: andl $3, %esi /* mask out uninteresting bytes */
jz L4 /* no remaining bytes => return NULL */
L(3): andl $3, %esi /* mask out uninteresting bytes */
jz L(4) /* no remaining bytes => return NULL */
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 */
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 */
je L9 /* equal, than return pointer */
je L(9) /* equal, than return pointer */
incl %eax /* increment source pointer */
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 */
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
jmp L9
jmp L(9)
/* add missing source pointer increments */
L5: addl $4, %eax
L6: addl $4, %eax
L7: addl $4, %eax
L(5): addl $4, %eax
L(6): addl $4, %eax
L(7): addl $4, %eax
/* Test for the matching byte in the word. %ecx contains a NUL
char in the byte which originally was the byte we are looking
at. */
L8: testb %cl, %cl /* test first byte in dword */
jz L9 /* if zero => return pointer */
L(8): testb %cl, %cl /* test first byte in dword */
jz L(9) /* if zero => return pointer */
incl %eax /* increment source pointer */
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 */
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 */
/* 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
ret

View File

@@ -1,22 +1,21 @@
/* memcmp -- compare two memory blocks for differences in the first COUNT
bytes.
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
/* Compare two memory blocks for differences in the first COUNT bytes.
Copyright (C) 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 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.
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. */
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. */
#include <sysdep.h>
#include "asm-syntax.h"
@@ -44,7 +43,7 @@ ENTRY (memcmp)
repe /* Compare at most %ecx bytes. */
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
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. */
orb $1, %al /* Change 0 to 1. */
L1: popl %esi /* Restore registers. */
L(1): popl %esi /* Restore registers. */
movl %edx, %edi
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.
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).
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 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.
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., 675 Mass Ave,
Cambridge, MA 02139, USA. */
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. */
#include <ansidecl.h>
#include <string.h>
#include <memcopy.h>
#ifdef __GNUC__
PTR
DEFUN(memset, (dstpp, c, len),
PTR dstpp AND int c AND size_t len)
vod *
memset (void *dstpp, int c, size_t len)
{
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
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
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 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. */
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
@@ -56,7 +54,7 @@ C_SYMBOL_NAME(__mpn_mul_1:)
INSN1(neg,l ,R(size))
INSN2(xor,l ,R(ebx),R(ebx))
ALIGN (3)
Loop:
L(oop):
INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4))
INSN1(mul,l ,R(s2_limb))
INSN2(add,l ,R(eax),R(ebx))
@@ -65,7 +63,7 @@ Loop:
INSN2(mov,l ,R(ebx),R(edx))
INSN1(inc,l ,R(size))
INSN1(jnz, ,Loop)
INSN1(jnz, ,L(oop))
INSN2(mov,l ,R(eax),R(ebx))
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
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 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. */
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
@@ -51,22 +49,22 @@ C_SYMBOL_NAME(__mpn_rshift:)
xorl %eax,%eax
shrdl %cl,%ebx,%eax /* compute carry limb */
incl %edx
jz Lend
jz L(end)
pushl %eax /* push carry limb onto stack */
testb $1,%edx
jnz L1 /* enter loop in the middle */
jnz L(1) /* enter loop in the middle */
movl %ebx,%eax
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 */
movl %eax,(%edi,%edx,4) /* store it */
incl %edx
L1: movl (%esi,%edx,4),%eax
L(1): movl (%esi,%edx,4),%eax
shrdl %cl,%eax,%ebx
movl %ebx,(%edi,%edx,4)
incl %edx
jnz Loop
jnz L(oop)
shrl %cl,%eax /* compute most significant limb */
movl %eax,(%edi) /* store it */
@@ -78,7 +76,7 @@ L1: movl (%esi,%edx,4),%eax
popl %edi
ret
Lend: shrl %cl,%ebx /* compute most significant limb */
L(end): shrl %cl,%ebx /* compute most significant limb */
movl %ebx,(%edi) /* store it */
popl %ebx

View File

@@ -1,7 +1,6 @@
/* stpcpy -- copy SRC to DEST returning the address of the terminating '\0'
in DEST.
/* Copy SRC to DEST returning the address of the terminating '\0' in DEST.
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.
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
loop counter we use the destination address because this is
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 %dl, (%eax) /* and store it */
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 %dl, 1(%eax) /* and store it */
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 %dl, 2(%eax) /* and store it */
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 %dl, 3(%eax) /* and store it */
testb %dl, %dl /* was it NUL? */
jnz L1 /* no, then continue loop */
jnz L(1) /* no, then continue loop */
incl %eax /* correct loop counter */
L4: incl %eax
L3: incl %eax
L2:
L(4): incl %eax
L(3): incl %eax
L(2):
ret
END (__stpcpy)

View File

@@ -1,7 +1,7 @@
/* stpncpy -- copy no more then N bytes from SRC to DEST, returning the
address of the terminating '\0' in DEST.
/* copy no more then N bytes from SRC to DEST, returning the address of
the terminating '\0' in DEST.
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.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
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
to one using addressing mode */
jmp L1 /* jump to loop "head" */
jmp L(1) /* jump to loop "head" */
ALIGN(4)
/* Four times unfolded loop with two loop counters. We get the
the third value (the source address) by using the index+base
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 */
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 %dl, 1(%eax) /* and store it */
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 %dl, 2(%eax) /* and store it */
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 %dl, 3(%eax) /* and store it */
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 */
L1: subl $4, %ecx /* still more than 4 bytes allowed? */
jae L2 /* yes, then go to start of loop */
L(1): subl $4, %ecx /* still more than 4 bytes allowed? */
jae L(2) /* yes, then go to start of loop */
/* The maximal remaining 15 bytes are not processed in a loop. */
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 %dl, (%eax) /* and store it */
testb %dl, %dl /* was it NUL? */
jz L3 /* yes, then exit */
jz L(3) /* yes, then exit */
incl %eax /* increment pointer */
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 %dl, (%eax) /* and store it */
testb %dl, %dl /* was it NUL? */
jz L3 /* yes, then exit */
jz L(3) /* yes, then exit */
incl %eax /* increment pointer */
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 %dl, (%eax) /* and store it */
testb %dl, %dl /* was it NUL? */
jz L3 /* yes, then exit */
jz L(3) /* yes, then exit */
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
remaining => exit */
/* 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 */
L5: decl %ecx /* increment pointer */
L(5): decl %ecx /* increment pointer */
incl %eax /* increment pointer */
L6: decl %ecx /* increment pointer */
L(6): decl %ecx /* increment pointer */
incl %eax /* increment pointer */
L7:
L(7):
addl $3, %ecx /* correct pre-decrementation of counter
at the beginning of the loop; but why 3
and not 4? Very simple, we have to count
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
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
%ecx register. */
L8:
L(8):
movb $0, (%ecx,%eax) /* store NUL char */
L3: decl %ecx /* all bytes written? */
jnz L8 /* no, then again */
L(3): decl %ecx /* all bytes written? */
jnz L(8) /* no, then again */
L9: popl %esi /* restore saved register content */
L(9): popl %esi /* restore saved register content */
ret
END (__stpncpy)

View File

@@ -1,6 +1,6 @@
/* strchr (str, ch) -- Return pointer to first occurrence of CH in STR.
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.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
Some optimisations by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@@ -57,34 +57,34 @@ ENTRY (strchr)
boundaries are multiples of 4. */
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) */
cmpb %cl, %dl /* compare byte */
je L6 /* target found => return */
je L(6) /* target found => return */
testb %cl, %cl /* is NUL? */
jz L2 /* yes => return NULL */
jz L(2) /* yes => return NULL */
incl %eax /* increment pointer */
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) */
cmpb %cl, %dl /* compare byte */
je L6 /* target found => return */
je L(6) /* target found => return */
testb %cl, %cl /* is NUL? */
jz L2 /* yes => return NULL */
jz L(2) /* yes => return NULL */
incl %eax /* increment pointer */
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) */
cmpb %cl, %dl /* compare byte */
je L6 /* target found => return */
je L(6) /* target found => return */
testb %cl, %cl /* is NUL? */
jz L2 /* yes => return NULL */
jz L(2) /* yes => return NULL */
incl %eax /* increment pointer */
/* 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
change any of the hole bits of LONGWORD.
@@ -116,9 +116,9 @@ ENTRY (strchr)
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
are now 0 */
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
overflow, we can now test this condition. If no carry is signaled
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
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. */
/* 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
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
carry bits reported for each byte which
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 */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 */
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
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 */
movl $0xfefefeff, %edi /* magic value */
addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
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 */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 */
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
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 */
movl $0xfefefeff, %edi /* magic value */
addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
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 */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 */
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
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 */
movl $0xfefefeff, %edi /* magic value */
addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
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 */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 */
popl %edi /* restore saved register content */
ret
L73: addl $4, %eax /* adjust pointer */
L72: addl $4, %eax
L71: addl $4, %eax
L(73): addl $4, %eax /* adjust pointer */
L(72): addl $4, %eax
L(71): addl $4, %eax
/* 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
found before this in the dword. */
L7: testb %cl, %cl /* is first byte C? */
jz L6 /* yes => return pointer */
L(7): testb %cl, %cl /* is first byte C? */
jz L(6) /* yes => return pointer */
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 */
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? */
je L2 /* yes => return NULL? */
je L(2) /* yes => return NULL? */
incl %eax /* it's not in the second byte */
shrl $16, %ecx /* make upper byte accessible */
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? */
je L2 /* yes => return NULL */
je L(2) /* yes => return NULL */
/* It must be in the fourth byte and it cannot be NUL. */
incl %eax
L6: popl %edi /* restore saved register content */
L(6): popl %edi /* restore saved register content */
ret
END (strchr)

View File

@@ -1,7 +1,7 @@
/* strcspn (str, ss) -- Return the length of the initial segment of STR
which contains no characters from SS.
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.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
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
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? */
jz L1 /* yes => start compare loop */
jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 1(%eax), %cl /* get byte from stopset */
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 2(%eax), %cl /* get byte from stopset */
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 3(%eax), %cl /* get byte from stopset */
addl $4, %eax /* increment stopset pointer */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
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
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
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 */
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 */
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 */
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 */
cmpb %cl, (%esp,%ecx) /* is it contained in stopset? */
jne L3 /* yes => return */
jne L(3) /* yes => return */
incl %eax /* adjust pointer */
L6: incl %eax
L5: incl %eax
L(6): 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
non-valid character */
addl $256, %esp /* remove stopset */

View File

@@ -1,22 +1,21 @@
/* strlen -- determine the length of a string.
For Intel 80x86, x>=3.
Copyright (C) 1991, 1992, 1993, 1996 Free Software Foundation, Inc.
/* Determine the length of a string. For Intel 80x86, x>=3.
Copyright (C) 1991, 1992, 1993, 1996, 1997 Free Software Foundation, Inc.
Contributed by Torbjorn Granlund (tege@sics.se).
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 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.
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., 675 Mass Ave,
Cambridge, MA 02139, USA. */
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. */
#include <string.h>

View File

@@ -1,25 +1,25 @@
/* strcspn (str, ss) -- Return the length of the initial segement of STR
which contains no characters from SS.
For Intel 80x86, x>=3.
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
This file is part of the GNU C Library.
For Intel 80x86, x>=3.
Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
Bug fixes by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
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 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.
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. */
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. */
#include <sysdep.h>
#include "asm-syntax.h"
@@ -114,28 +114,28 @@ ENTRY (strpbrk)
/* Don't change the "testb $0xff,%%cl" to "testb %%cl,%%cl". We want
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? */
jz L1 /* yes => start compare loop */
jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 1(%eax), %cl /* get byte from stopset */
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 2(%eax), %cl /* get byte from stopset */
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 3(%eax), %cl /* get byte from stopset */
addl $4, %eax /* increment stopset pointer */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
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
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
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 */
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 */
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 */
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 */
cmpb %cl, (%esp,%ecx) /* is it contained in stopset? */
jne L3 /* yes => return */
jne L(3) /* yes => return */
incl %eax /* adjust pointer */
L6: incl %eax
L5: incl %eax
L(6): 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? */
jnz L7 /* no => return pointer */
jnz L(7) /* no => return pointer */
xorl %eax, %eax /* return NULL */
L7: ret
L(7): ret
END (strpbrk)

View File

@@ -1,6 +1,6 @@
/* strrchr (str, ch) -- Return pointer to last occurrence of CH in STR.
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.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
Some optimisations by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
@@ -59,37 +59,37 @@ ENTRY (strrchr)
boundaries are multiples of 4. */
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) */
cmpb %dl, %cl /* compare byte */
jne L11 /* target found => return */
jne L(11) /* target found => return */
movl %esi, %eax /* remember pointer as possible result */
L11: orb %dl, %dl /* is NUL? */
jz L2 /* yes => return NULL */
L(11): orb %dl, %dl /* is NUL? */
jz L(2) /* yes => return NULL */
incl %esi /* increment pointer */
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) */
cmpb %dl, %cl /* compare byte */
jne L12 /* target found => return */
jne L(12) /* target found => return */
movl %esi, %eax /* remember pointer as result */
L12: orb %dl, %dl /* is NUL? */
jz L2 /* yes => return NULL */
L(12): orb %dl, %dl /* is NUL? */
jz L(2) /* yes => return NULL */
incl %esi /* increment pointer */
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) */
cmpb %dl, %cl /* compare byte */
jne L13 /* target found => return */
jne L(13) /* target found => return */
movl %esi, %eax /* remember pointer as result */
L13: orb %dl, %dl /* is NUL? */
jz L2 /* yes => return NULL */
L(13): orb %dl, %dl /* is NUL? */
jz L(2) /* yes => return NULL */
incl %esi /* increment pointer */
/* 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
change any of the hole bits of LONGWORD.
@@ -140,34 +140,34 @@ L13: orb %dl, %dl /* is NUL? */
.byte 0
#endif
L4: subl $4, %esi /* adjust pointer */
L41: subl $4, %esi
L42: subl $4, %esi
L43: testl $0xff000000, %edx /* is highest byte == C? */
jnz L33 /* no => try other bytes */
L(4): subl $4, %esi /* adjust pointer */
L(41): subl $4, %esi
L(42): subl $4, %esi
L(43): testl $0xff000000, %edx /* is highest byte == C? */
jnz L(33) /* no => try other bytes */
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 */
L31: subl $4, %esi
L32: subl $4, %esi
L33: testl $0xff0000, %edx /* is C in third byte? */
jnz L51 /* no => try other bytes */
L(3): subl $4, %esi /* adjust pointer */
L(31): subl $4, %esi
L(32): subl $4, %esi
L(33): testl $0xff0000, %edx /* is C in third byte? */
jnz L(51) /* no => try other bytes */
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.
We make a guess and correct it if necessary. This reduces the
number of necessary jumps. */
leal 12(%esi), %eax /* guess address of lowest byte as result */
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 */
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 */
addl %edx, %edi /* add the magic value to the word. We get
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
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
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. */
/* 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
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
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 $0xfefefeff, %edi /* magic value */
addl %edx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
is *not* 0 */
jnc L21 /* found NUL => check last word */
jnc L(21) /* found NUL => check last word */
xorl %edx, %edi /* (word+magic)^word */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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
are now 0 */
movl $0xfefefeff, %edi /* magic value */
addl %edx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 $0xfefefeff, %edi /* magic value */
addl %edx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
is *not* 0 */
jnc L22 /* found NUL => check last word */
jnc L(22) /* found NUL => check last word */
xorl %edx, %edi /* (word+magic)^word */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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
are now 0 */
movl $0xfefefeff, %edi /* magic value */
addl %edx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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 $0xfefefeff, %edi /* magic value */
addl %edx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
is *not* 0 */
jnc L23 /* found NUL => check last word */
jnc L(23) /* found NUL => check last word */
xorl %edx, %edi /* (word+magic)^word */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
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
are now 0 */
movl $0xfefefeff, %edi /* magic value */
addl %edx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
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) */
orl $0xfefefeff, %edi /* set all non-carry bits */
incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */
jz L1 /* C is not detected => restart loop */
jmp L33 /* examine word */
jz L(1) /* C is not detected => restart loop */
jmp L(33) /* examine word */
L23: addl $4, %esi /* adjust pointer */
L22: addl $4, %esi
L21: addl $4, %esi
L(23): addl $4, %esi /* adjust pointer */
L(22): addl $4, %esi
L(21): addl $4, %esi
/* What remains to do is to test which byte the NUL char is and
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
returned. */
L20: cmpb %cl, %dl /* is first byte == C? */
jne L24 /* no => skip */
L(20): cmpb %cl, %dl /* is first byte == C? */
jne L(24) /* no => skip */
movl %esi, %eax /* store address as result */
L24: testb %dl, %dl /* is first byte == NUL? */
jz L2 /* yes => return */
L(24): testb %dl, %dl /* is first byte == NUL? */
jz L(2) /* yes => return */
cmpb %cl, %dh /* is second byte == C? */
jne L25 /* no => skip */
jne L(25) /* no => skip */
leal 1(%esi), %eax /* store address as result */
L25: testb %dh, %dh /* is second byte == NUL? */
jz L2 /* yes => return */
L(25): testb %dh, %dh /* is second byte == NUL? */
jz L(2) /* yes => return */
shrl $16,%edx /* make upper bytes accessible */
cmpb %cl, %dl /* is third byte == C */
jne L26 /* no => skip */
jne L(26) /* no => skip */
leal 2(%esi), %eax /* store address as result */
L26: testb %dl, %dl /* is third byte == NUL */
jz L2 /* yes => return */
L(26): testb %dl, %dl /* is third byte == NUL */
jz L(2) /* yes => return */
cmpb %cl, %dh /* is fourth byte == C */
jne L2 /* no => skip */
jne L(2) /* no => skip */
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
ret

View File

@@ -1,7 +1,7 @@
/* strcspn (str, ss) -- Return the length of the initial segment of STR
which contains only characters from SS.
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.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
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
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? */
jz L1 /* yes => start compare loop */
jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 1(%eax), %cl /* get byte from stopset */
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 2(%eax), %cl /* get byte from stopset */
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 3(%eax), %cl /* get byte from stopset */
addl $4, %eax /* increment stopset pointer */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
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
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
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 */
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 */
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 */
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 */
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 */
L6: incl %eax
L5: incl %eax
L(6): 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
non-valid character */
addl $256, %esp /* remove stopset */

View File

@@ -1,25 +1,26 @@
/* strtok (str, delim) -- Return next DELIM separated token from STR.
For Intel 80x86, x>=3.
Copyright (C) 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
For Intel 80x86, x>=3.
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
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 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.
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. */
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. */
#include <sysdep.h>
#include "asm-syntax.h"
/* 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)
pushl %ebx /* Save PIC register. */
call Lhere
Lhere: popl %ebx
addl $_GLOBAL_OFFSET_TABLE_+[.-Lhere], %ebx
call L(here)
L(here):
popl %ebx
addl $_GLOBAL_OFFSET_TABLE_+[.-L(here)], %ebx
#endif
/* If the pointer is NULL we have to use the stored value of
the last run. */
cmpl $0, %edx
jne L0
jne L(0)
#ifdef USE_AS_STRTOK_R
/* The value is stored in the third argument. */
@@ -80,7 +82,7 @@ Lhere: popl %ebx
# endif
#endif
L0:
L(0):
/* First we create a table with flags for all possible characters.
For the ASCII (7bit/8bit) or ISO-8859-X character sets which are
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
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? */
jz L1 /* yes => start compare loop */
jz L(1) /* yes => start compare loop */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
movb 1(%eax), %cl /* get byte from stopset */
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 2(%eax), %cl /* get byte from stopset */
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 3(%eax), %cl /* get byte from stopset */
addl $4, %eax /* increment stopset pointer */
movb %cl, (%esp,%ecx) /* set corresponding byte in stopset table */
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
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
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 */
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 */
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 */
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 */
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 */
L6: incl %eax
L5: incl %eax
L(6): incl %eax
L(5): incl %eax
/* 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 */
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 */
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 */
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 */
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 */
L10: incl %edx
L9: incl %edx
L(10): incl %edx
L(9): incl %edx
L8: /* Remove the stopset table. */
L(8): /* Remove the stopset table. */
addl $256, %esp
cmpl %eax, %edx
je LreturnNULL /* There was no token anymore. */
je L(returnNULL) /* There was no token anymore. */
movb $0, (%edx) /* Terminate string. */
/* Are we at end of string? */
cmpb $0, %cl
je L11
je L(11)
incl %edx
L11:
L(11):
/* Store the pointer to the next character. */
#ifdef USE_AS_STRTOK_R
@@ -266,7 +268,7 @@ L11:
#endif
ret
LreturnNULL:
L(returnNULL):
xorl %eax, %eax
/* 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
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
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 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. */
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
@@ -47,7 +45,7 @@ C_SYMBOL_NAME(__mpn_sub_n:)
shrl $3,%ecx /* compute count for unrolled loop */
negl %eax
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 */
shll $2,%eax /* adjustment for pointers... */
subl %eax,%edi /* ... since they are offset ... */
@@ -57,18 +55,18 @@ C_SYMBOL_NAME(__mpn_sub_n:)
#ifdef PIC
/* Calculate start address in loop for PIC. Due to limitations in some
assemblers, Loop-L0-3 cannot be put into the leal */
call L0
L0: leal (%eax,%eax,8),%eax
call L(0)
L(0): leal (%eax,%eax,8),%eax
addl (%esp),%eax
addl $(Loop-L0-3),%eax
addl $(L(oop)-L(0)-3),%eax
addl $4,%esp
#else
/* Calculate start address in loop for non-PIC. */
leal (Loop - 3)(%eax,%eax,8),%eax
leal (L(oop) - 3)(%eax,%eax,8),%eax
#endif
jmp *%eax /* jump into loop */
ALIGN (3)
Loop: movl (%esi),%eax
L(oop): movl (%esi),%eax
sbbl (%edx),%eax
movl %eax,(%edi)
movl 4(%esi),%eax
@@ -96,7 +94,7 @@ Loop: movl (%esi),%eax
leal 32(%esi),%esi
leal 32(%edx),%edx
decl %ecx
jnz Loop
jnz L(oop)
sbbl %eax,%eax
negl %eax

View File

@@ -1,24 +1,22 @@
/* i80386 __mpn_submul_1 -- Multiply a limb vector with a limb and subtract
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
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 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. */
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
@@ -56,7 +54,7 @@ C_SYMBOL_NAME(__mpn_submul_1:)
INSN1(neg,l ,R(size))
INSN2(xor,l ,R(ebx),R(ebx))
ALIGN (3)
Loop:
L(oop):
INSN2(mov,l ,R(eax),MEM_INDEX(s1_ptr,size,4))
INSN1(mul,l ,R(s2_limb))
INSN2(add,l ,R(eax),R(ebx))
@@ -66,7 +64,7 @@ Loop:
INSN2(mov,l ,R(ebx),R(edx))
INSN1(inc,l ,R(size))
INSN1(jnz, ,Loop)
INSN1(jnz, ,L(oop))
INSN2(mov,l ,R(eax),R(ebx))
INSN1(pop,l ,R(ebp))

View File

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

View File

@@ -23,11 +23,14 @@
#include <sysdep.h>
ENTRY (setjmp)
ENTRY (__setjmp)
li 4,1 /* Set second argument to 1. */
#ifdef PIC
b __sigsetjmp@plt
#else
b __sigsetjmp
#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;
}
else
finaladdr = (loadbase + (Elf32_Word) (char *) sym->st_value +
reloc->r_addend);
finaladdr = (loadbase + (Elf32_Word) (char *) sym->st_value
+ reloc->r_addend);
}
/* 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
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;
}
@@ -205,32 +212,29 @@ elf_machine_rela (struct link_map *map, const Elf32_Rela *reloc,
}
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)
{
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;
}
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)
{
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;
}
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);
}
#endif
else if (rinfo == R_PPC_REL32)
{
*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;
if (delta << 6 >> 6 == delta)
*reloc_addr = OPCODE_B(delta);
*reloc_addr = OPCODE_B (delta);
else if (finaladdr <= 0x01fffffc || finaladdr >= 0xfe000000)
*reloc_addr = OPCODE_BA(finaladdr);
*reloc_addr = OPCODE_BA (finaladdr);
else
{
Elf32_Word *plt = (Elf32_Word *)((char *)map->l_addr +
map->l_info[DT_PLTGOT]->d_un.d_val);
Elf32_Word index = (reloc_addr - plt - PLT_INITIAL_ENTRY_WORDS)/2;
Elf32_Word offset = index * 2 + PLT_INITIAL_ENTRY_WORDS;
Elf32_Word *plt;
Elf32_Word index;
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)
{
/* Slots greater than or equal to 2^13 have 4 words
available instead of two. */
plt[offset ] = OPCODE_LI (11,finaladdr);
plt[offset+1] = OPCODE_ADDIS (11,11,finaladdr + 0x8000 >> 16);
plt[offset+2] = OPCODE_MTCTR (11);
plt[offset+3] = OPCODE_BCTR ();
/* Slots greater than or equal to 2^13 have 4 words available
instead of two. */
reloc_addr[0] = OPCODE_LI (11, finaladdr);
reloc_addr[1] = OPCODE_ADDIS (11, 11, finaladdr + 0x8000 >> 16);
reloc_addr[2] = OPCODE_MTCTR (11);
reloc_addr[3] = OPCODE_BCTR ();
}
else
{
Elf32_Word num_plt_entries;
Elf32_Word rel_offset_words;
num_plt_entries = (map->l_info[DT_PLTRELSZ]->d_un.d_val
/ sizeof(Elf32_Rela));
rel_offset_words = PLT_DATA_START_WORDS (num_plt_entries);
plt[offset ] = OPCODE_LI (11,index * 4);
plt[offset+1] = OPCODE_B (-(4 * (offset + 1
- PLT_LONGBRANCH_ENTRY_WORDS)));
plt[index + rel_offset_words] = finaladdr;
reloc_addr[0] = OPCODE_LI (11, index*4);
reloc_addr[1] =
OPCODE_B (-(4*(index*2
+ 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
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)
/* 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
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)
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)
{
plt[offset ] = OPCODE_LI (11, i * 4);
plt[offset+1] = OPCODE_ADDIS (11, 11, i * 4 + 0x8000 >> 16);
plt[offset ] = OPCODE_LI (11, i * 4);
plt[offset+1] = OPCODE_ADDIS (11, 11, (i * 4 + 0x8000) >> 16);
plt[offset+2] = OPCODE_B (-(4 * (offset + 2)));
}
else
{
plt[offset ] = OPCODE_LI (11, i * 4);
plt[offset+1] = OPCODE_B(-(4 * (offset + 1)));
plt[offset ] = OPCODE_LI (11, i * 4);
plt[offset+1] = OPCODE_B (-(4 * (offset + 1)));
}
}
/* Multiply index of entry, by 0xC. */
plt[0] = OPCODE_SLWI (12, 11, 1);
plt[1] = OPCODE_ADD (11, 12, 11);
if ((Elf32_Word) (char *) _dl_runtime_resolve <= 0x01fffffc
|| (Elf32_Word) (char *) _dl_runtime_resolve >= 0xfe000000)
{
plt[2] = OPCODE_LI (12, (Elf32_Word) (char *) map);
plt[3] = OPCODE_ADDIS (12, 12,
(Elf32_Word) (char *) map + 0x8000 >> 16);
plt[4] = OPCODE_BA ((Elf32_Word) (char *) _dl_runtime_resolve);
}
/* Multiply index of entry by 3 (in r11). */
plt[0] = OPCODE_SLWI (12, 11, 1);
plt[1] = OPCODE_ADD (11, 12, 11);
if ((Elf32_Word) (char *) _dl_runtime_resolve <= 0x01fffffc ||
(Elf32_Word) (char *) _dl_runtime_resolve >= 0xfe000000)
{
/* Load address of link map in r12. */
plt[2] = OPCODE_LI (12, (Elf32_Word) (char *) map);
plt[3] = OPCODE_ADDIS (12, 12, (((Elf32_Word) (char *) map
+ 0x8000) >> 16));
/* Call _dl_runtime_resolve. */
plt[4] = OPCODE_BA ((Elf32_Word) (char *) _dl_runtime_resolve);
}
else
{
/* Get address of _dl_runtime_resolve in CTR. */
plt[2] = OPCODE_LI (12, (Elf32_Word) (char *) _dl_runtime_resolve);
plt[3] = OPCODE_ADDIS(12, 12, 0x8000 +
((Elf32_Word) (char *) _dl_runtime_resolve
>> 16));
plt[3] = OPCODE_ADDIS (12, 12, ((((Elf32_Word) (char *)
_dl_runtime_resolve)
+ 0x8000) >> 16));
plt[4] = OPCODE_MTCTR (12);
/* Load address of link map in r12. */
plt[5] = OPCODE_LI (12, (Elf32_Word) (char *) map);
plt[6] = OPCODE_ADDIS (12, 12, ((Elf32_Word) (char *) map
+ 0x8000 >> 16));
plt[6] = OPCODE_ADDIS (12, 12, (((Elf32_Word) (char *) map
+ 0x8000) >> 16));
/* Call _dl_runtime_resolve. */
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] =
OPCODE_ADDIS (11, 11, (Elf32_Word) (char*) (plt + rel_offset_words)
+ 0x8000 >> 16);
OPCODE_ADDIS (11, 11, (((Elf32_Word) (char*) (plt + rel_offset_words)
+ 0x8000) >> 16));
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+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;
/* Now we need to keep the caches in sync. */
for (i = 0; i < size_modified; i+=8)
PPC_DCBST (plt + i);
PPC_SYNC;
@@ -411,7 +463,7 @@ _dl_runtime_resolve:
# The code that calls this has put parameters for `fixup' in r12 and r11.
mr 3,12
mr 4,11
bl fixup
bl fixup@local
# 'fixup' returns the address we want to branch to.
mtctr 3
# Put the registers back...
@@ -440,8 +492,9 @@ _dl_runtime_resolve:
The C function `_dl_start' is the real entry point;
its return value is the user program's entry point. */
#define RTLD_START \
static ElfW(Addr) _dl_start (void *arg) __attribute__((unused)); \
asm ("\
.text
.section \".text\"
.align 2
.globl _start
.type _start,@function
@@ -535,16 +588,34 @@ _start:
.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 \
static ElfW(Addr) _dl_preferred_address = 0;
static ElfW(Addr) _dl_preferred_address = 1;
#define ELF_PREFERRED_ADDRESS(loader, maplength, mapstartpref) \
( { \
ElfW(Addr) prefd; \
if (mapstartpref != 0 && _dl_preferred_address == 0) \
if (mapstartpref != 0 && _dl_preferred_address == 1) \
_dl_preferred_address = mapstartpref; \
if (mapstartpref != 0) \
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) \
prefd = 0; \
else \
@@ -556,7 +627,7 @@ static ElfW(Addr) _dl_preferred_address = 0;
#define ELF_FIXED_ADDRESS(loader, mapstart) \
( { \
if (mapstart != 0 && _dl_preferred_address < mapstart) \
if (mapstart != 0 && _dl_preferred_address == 1) \
_dl_preferred_address = mapstart; \
} )

View File

@@ -29,6 +29,7 @@ asm ("\
.section \".text\"
.align 2
.globl _start
.type _start,@function
_start:
# save the stack pointer, in case we're statically linked under Linux
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);
return 0.0;
}
weak_alias (__log2l, log2l)
stub_warning (__log2l)
stub_warning (log2l)

View File

@@ -24,6 +24,74 @@
__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
* The Regents of the University of California. All rights reserved.
@@ -65,31 +133,37 @@ __BEGIN_DECLS
/*
* Internal of an ICMP Router Advertisement
*/
struct icmp_ra_addr {
u_int32_t ira_addr;
u_int32_t ira_preference;
struct icmp_ra_addr
{
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_code; /* type sub code */
u_int16_t icmp_cksum; /* ones complement checksum of struct */
union {
union
{
u_char ih_pptr; /* ICMP_PARAMPROB */
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_seq;
} ih_idseq;
u_int32_t ih_void;
/* ICMP_UNREACH_NEEDFRAG -- Path MTU Discovery (RFC1191) */
struct ih_pmtu {
struct ih_pmtu
{
u_int16_t ipm_void;
u_int16_t ipm_nextmtu;
} ih_pmtu;
struct ih_rtradv {
struct ih_rtradv
{
u_int8_t irt_num_addrs;
u_int8_t irt_wpa;
u_int16_t irt_lifetime;
@@ -105,13 +179,16 @@ struct icmp {
#define icmp_num_addrs icmp_hun.ih_rtradv.irt_num_addrs
#define icmp_wpa icmp_hun.ih_rtradv.irt_wpa
#define icmp_lifetime icmp_hun.ih_rtradv.irt_lifetime
union {
struct {
union
{
struct
{
u_int32_t its_otime;
u_int32_t its_rtime;
u_int32_t its_ttime;
} id_ts;
struct {
struct
{
struct ip idi_ip;
/* options and then 64 bits of data */
} id_ip;
@@ -149,11 +226,9 @@ struct icmp {
#endif
/* 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_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_ROUTERSOLICIT 10 /* router solicitation */
#define ICMP_TIMXCEED 11 /* time exceeded, code: */
@@ -205,6 +280,8 @@ struct icmp {
(type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
(type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
#endif /* __USE_BSD */
__END_DECLS
#endif /* netinet/ip_icmp.h */

View File

@@ -2,3 +2,6 @@ clone.S
ioctl-types.h
termbits.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); */
ENTRY(clone)
ENTRY(__clone)
/* Set up stack frame, save registers. */
stwu 1,-20(1)
stwu 1,-32(1)
stw 31,16(1)
stw 30,20(1)
/* Check for child_stack == NULL, fn == NULL. */
mr. 31,4
/* Check for child_stack == NULL || fn == NULL. */
cmpwi 0,4,0
cmpwi 1,3,0
cror 2+0*4,2+0*4,2+1*4
beq- 0,badargs
/* Save 'fn' and its argument on the new stack. */
stw 3,0(4)
stw 6,4(4)
/* Set up stack frame for child. */
addi 4,4,-16
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
/* Do the call. */
@@ -51,22 +59,22 @@ ENTRY(clone)
beq child
/* Parent. Restore registers & return. */
lwz 31,20(1)
addi 1,1,20
lwz 31,16(1)
lwz 30,20(1)
addi 1,1,32
blr
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. */
mtlr 30
mr 3,31
blrl
/* Call _exit with result from procedure. */
DO_CALL (SYS_ify (exit))
#ifdef PIC
b _exit@plt
#else
b _exit
#endif
badargs:
li 3,-EINVAL
@@ -76,3 +84,7 @@ error:
#else
b __syscall_error
#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.
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,
Boston, MA 02111-1307, USA. */
.section ".text"
.align 2
.globl strlen
.type strlen,@function
strlen:
rlwinm 7,3,0,0,29
lis 8,0x7f7f
lwz 11,0(7)
ori 8,8,32639
rlwinm 4,3,3,27,28
li 9,-1
or 10,11,8
and 0,11,8
srw 9,9,4
add 0,0,8
nor 0,10,0
and. 11,0,9
bc 4,2,.L2
.L3:
lwzu 11,4(7)
or 10,11,8
and 0,11,8
add 0,0,8
nor. 11,10,0
bc 12,2,.L3
.L2:
subf 0,3,7
cntlzw 3,11
srwi 3,3,3
add 3,0,3
blr
.Lfe1:
.size strlen,.Lfe1-strlen
struct kernel_stat
{
unsigned int st_dev;
unsigned int st_ino;
unsigned int st_mode;
unsigned short st_nlink;
unsigned int st_uid;
unsigned int st_gid;
unsigned int st_rdev;
unsigned long int st_size;
unsigned long int st_blksize;
unsigned long int st_blocks;
unsigned long int st_atime;
unsigned long int __unused1;
#define _HAVE___UNUSED1
unsigned long int st_mtime;
unsigned long int __unused2;
#define _HAVE___UNUSED2
unsigned long int st_ctime;
unsigned long int __unused3;
#define _HAVE___UNUSED3
unsigned long int __unused4;
#define _HAVE___UNUSED4
unsigned long int __unused5;
#define _HAVE___UNUSED5
};

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