+2000-06-08 Greg McGary <greg@mcgary.org>
+
+ * sysdeps/i386/bp-asm.h: New file.
+ * sysdeps/i386/__longjmp.S: Define & use symbolic argument stack
+ offsets. Add ENTER/LEAVE macros for optionally maintaining
+ frame-pointer chain when debugging.
+ * sysdeps/i386/add_n.S: Likewise.
+ * sysdeps/i386/addmul_1.S: Likewise.
+ * sysdeps/i386/lshift.S: Likewise.
+ * sysdeps/i386/memchr.S: Likewise.
+ * sysdeps/i386/memcmp.S: Likewise.
+ * sysdeps/i386/mul_1.S: Likewise.
+ * sysdeps/i386/rawmemchr.S: Likewise.
+ * sysdeps/i386/rshift.S: Likewise.
+ * sysdeps/i386/stpcpy.S: Likewise.
+ * sysdeps/i386/stpncpy.S: Likewise.
+ * sysdeps/i386/strchr.S: Likewise.
+ * sysdeps/i386/strchrnul.S: Likewise.
+ * sysdeps/i386/strcspn.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/elf/setjmp.S: Likewise.
+ * sysdeps/i386/i486/strcat.S: Likewise.
+ * sysdeps/i386/i486/strlen.S: Likewise.
+ * sysdeps/i386/i586/add_n.S: Likewise.
+ * sysdeps/i386/i586/lshift.S: Likewise.
+ * sysdeps/i386/i586/memcpy.S: Likewise.
+ * sysdeps/i386/i586/memset.S: Likewise.
+ * sysdeps/i386/i586/rshift.S: Likewise.
+ * sysdeps/i386/i586/strchr.S: Likewise.
+ * sysdeps/i386/i586/strcpy.S: Likewise.
+ * sysdeps/i386/i586/strlen.S: Likewise.
+ * sysdeps/i386/i586/sub_n.S: Likewise.
+ * sysdeps/i386/i686/add_n.S: Likewise.
+ * sysdeps/i386/i686/memcpy.S: Likewise.
+ * sysdeps/i386/i686/mempcpy.S: Likewise.
+ * sysdeps/i386/i686/memset.S: Likewise.
+ * sysdeps/i386/i686/strcmp.S: Likewise.
+
2000-06-08 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/getdtsz.c: New file.
/* longjmp for i386.
- Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 1998, 2000 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
#define _ASM
#define _SETJMP_H
#include <bits/setjmp.h>
+#include <bp-asm.h>
+
+#define PARMS LINKAGE /* no space for saved regs */
+#define JBUF PARMS
+#define VAL JBUF+PTR_SIZE
ENTRY (__longjmp)
- movl 4(%esp), %ecx /* User's jmp_buf in %ecx. */
- movl 8(%esp), %eax /* Second argument is return value. */
+ ENTER
+
+ movl JBUF(%esp), %ecx /* User's jmp_buf in %ecx. */
+ LEAVE
+
+ movl VAL(%esp), %eax /* Second argument is return value. */
/* Save the return address now. */
movl (JB_PC*4)(%ecx), %edx
/* Restore registers. */
/* Add two limb vectors of the same length > 0 and store sum in a third
limb vector.
- Copyright (C) 1992, 94, 95, 97, 98 Free Software Foundation, Inc.
+ Copyright (C) 1992, 94, 95, 97, 98, 2000 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-/*
- INPUT PARAMETERS
- res_ptr (sp + 4)
- s1_ptr (sp + 8)
- s2_ptr (sp + 12)
- size (sp + 16)
-*/
-
#include "sysdep.h"
#include "asm-syntax.h"
+#include "bp-asm.h"
+
+#define PARMS LINKAGE+8 /* space for 2 saved regs */
+#define RES PARMS
+#define S1 RES+PTR_SIZE
+#define S2 S1+PTR_SIZE
+#define SIZE S2+PTR_SIZE
.text
ENTRY(__mpn_add_n)
+ ENTER
+
pushl %edi
pushl %esi
- movl 12(%esp),%edi /* res_ptr */
- movl 16(%esp),%esi /* s1_ptr */
- movl 20(%esp),%edx /* s2_ptr */
- movl 24(%esp),%ecx /* size */
+ movl RES(%esp),%edi
+ movl S1(%esp),%esi
+ movl S2(%esp),%edx
+ movl SIZE(%esp),%ecx
movl %ecx,%eax
shrl $3,%ecx /* compute count for unrolled loop */
popl %esi
popl %edi
+
+ LEAVE
ret
END(__mpn_add_n)
/* 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, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-/*
- INPUT PARAMETERS
- res_ptr (sp + 4)
- s1_ptr (sp + 8)
- sizeP (sp + 12)
- s2_limb (sp + 16)
-*/
-
#include "sysdep.h"
#include "asm-syntax.h"
+#include "bp-asm.h"
+
+#define PARMS LINKAGE+16 /* space for 4 saved regs */
+#define RES PARMS
+#define S1 RES+PTR_SIZE
+#define SIZE S1+PTR_SIZE
+#define S2LIMB SIZE+4
#define res_ptr edi
#define s1_ptr esi
INSN1(push,l ,R(ebx))
INSN1(push,l ,R(ebp))
- INSN2(mov,l ,R(res_ptr),MEM_DISP(esp,20))
- INSN2(mov,l ,R(s1_ptr),MEM_DISP(esp,24))
- INSN2(mov,l ,R(sizeP),MEM_DISP(esp,28))
- INSN2(mov,l ,R(s2_limb),MEM_DISP(esp,32))
+ INSN2(mov,l ,R(res_ptr),MEM_DISP(esp,RES))
+ INSN2(mov,l ,R(s1_ptr),MEM_DISP(esp,S1))
+ INSN2(mov,l ,R(sizeP),MEM_DISP(esp,SIZE))
+ INSN2(mov,l ,R(s2_limb),MEM_DISP(esp,S2LIMB))
INSN2(lea,l ,R(res_ptr),MEM_INDEX(res_ptr,sizeP,4))
INSN2(lea,l ,R(s1_ptr),MEM_INDEX(s1_ptr,sizeP,4))
--- /dev/null
+/* Bounded-pointer definitions for x86 assembler.
+ Copyright (C) 2000 Free Software Foundation, Inc.
+ Contributed by Greg McGary <greg@mcgary.org>
+
+ This file is part of the GNU C Library. Its master source is NOT part of
+ the C library, however. The master source lives in the GNU MP 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 _bp_asm_h_
+# define _bp_asm_h_ 1
+
+# if __ASSEMBLER__
+
+# if __BOUNDED_POINTERS__
+
+/* Bounded pointers occupy three words. */
+# define PTR_SIZE 12
+/* Bounded pointer return values are passed back through a hidden
+ argument that points to caller-allocate space. The hidden arg
+ occupies one word on the stack. */
+# define RTN_SIZE 4
+/* Although the caller pushes the hidden arg, the callee is
+ responsible for popping it. */
+# define RET_PTR ret $RTN_SIZE
+/* Maintain frame pointer chain in leaf assembler functions for the benefit
+ of debugging stack traces when bounds violations occur. */
+# define ENTER pushl %ebp; movl %esp, %ebp
+# define LEAVE movl %ebp, %esp; popl %ebp
+/* Stack space overhead of procedure-call linkage: return address and
+ frame pointer. */
+# define LINKAGE 8
+
+/* Int 5 is the "bound range" exception also raised by the "bound"
+ instruction. */
+# define BOUNDS_VIOLATED int $5
+
+# define CHECK_BOUNDS_LOW(VAL_REG, BP_MEM) \
+ cmpl 4+BP_MEM, VAL_REG; \
+ jae 0f; /* continue if value >= low */ \
+ BOUNDS_VIOLATED; \
+ 0:
+
+# define CHECK_BOUNDS_HIGH(VAL_REG, BP_MEM, Jcc) \
+ cmpl 8+BP_MEM, VAL_REG; \
+ Jcc 0f; /* continue if value < high */ \
+ BOUNDS_VIOLATED; \
+ 0:
+
+# define CHECK_BOUNDS_BOTH(VAL_REG, BP_MEM) \
+ cmpl 4+BP_MEM, VAL_REG; \
+ jb 1f; /* die if value < low */ \
+ cmpl 8+BP_MEM, VAL_REG; \
+ jb 0f; /* continue if value < high */ \
+ 1: BOUNDS_VIOLATED; \
+ 0:
+
+# define CHECK_BOUNDS_BOTH_WIDE(VAL_REG, BP_MEM, LENGTH) \
+ CHECK_BOUNDS_LOW(VAL_REG, BP_MEM); \
+ addl LENGTH, VAL_REG; \
+ cmpl 8+BP_MEM, VAL_REG; \
+ jbe 0f; /* continue if value <= high */ \
+ BOUNDS_VIOLATED; \
+ 0: subl LENGTH, VAL_REG /* restore value */
+
+/* Take bounds from BP_MEM and affix them to the pointer
+ value in %eax, stuffing all into memory at RTN(%esp).
+ Use %ecx as a scratch register. */
+
+# define RETURN_BOUNDED_POINTER(BP_MEM) \
+ movl RTN(%esp), %ecx; \
+ movl %eax, 0(%ecx); \
+ movl 4+BP_MEM, %eax; \
+ movl %eax, 4(%ecx); \
+ movl 8+BP_MEM, %eax; \
+ movl %eax, 8(%ecx)
+
+# define RETURN_NULL_BOUNDED_POINTER \
+ movl RTN(%esp), %ecx; \
+ movl %eax, 0(%ecx); \
+ movl %eax, 4(%ecx); \
+ movl %eax, 8(%ecx)
+
+/* The caller of __errno_location is responsible for allocating space
+ for the three-word BP return-value and passing pushing its address
+ as an implicit first argument. */
+# define PUSH_ERRNO_LOCATION_RETURN \
+ subl $8, %esp; \
+ subl $4, %esp; \
+ pushl %esp
+
+/* __errno_location is responsible for popping the implicit first
+ argument, but we must pop the space for the BP itself. We also
+ dereference the return value in order to dig out the pointer value. */
+# define POP_ERRNO_LOCATION_RETURN \
+ movl (%esp), %eax; \
+ addl $4, %esp; \
+ addl $8, %esp
+
+# else /* !__BOUNDED_POINTERS__ */
+
+/* Unbounded pointers occupy one word. */
+# define PTR_SIZE 4
+/* Unbounded pointer return values are passed back in the register %eax. */
+# define RTN_SIZE 0
+/* Use simple return instruction for unbounded pointer values. */
+# define RET_PTR ret
+/* Don't maintain frame pointer chain for leaf assembler functions. */
+# define ENTER
+# define LEAVE
+/* Stack space overhead of procedure-call linkage: return address only. */
+# define LINKAGE 4
+
+# define CHECK_BOUNDS_LOW(VAL_REG, BP_MEM)
+# define CHECK_BOUNDS_HIGH(VAL_REG, BP_MEM, Jcc)
+# define CHECK_BOUNDS_BOTH(VAL_REG, BP_MEM)
+# define CHECK_BOUNDS_BOTH_WIDE(VAL_REG, BP_MEM, LENGTH)
+# define RETURN_BOUNDED_POINTER(BP_MEM)
+
+# define RETURN_NULL_BOUNDED_POINTER
+
+# define PUSH_ERRNO_LOCATION_RETURN
+# define POP_ERRNO_LOCATION_RETURN
+
+# endif /* !__BOUNDED_POINTERS__ */
+
+# endif /* __ASSEMBLER__ */
+
+#endif /* _bp_asm_h_ */
#define _ASM
#define _SETJMP_H
#include <bits/setjmp.h>
+#include "bp-asm.h"
+
+#define PARMS LINKAGE /* no space for saved regs */
+#define JBUF PARMS
+#define SGMSK JBUF+PRT_SIZE
/* We include the BSD entry points here as well but we make
them weak. */
movl %esi, (JB_SI*4)(%eax)
movl %edi, (JB_DI*4)(%eax)
movl %ebp, (JB_BP*4)(%eax)
- leal 4(%esp), %ecx /* Save SP as it will be after we return. */
+ leal JBUF(%esp), %ecx /* Save SP as it will be after we return. */
movl %ecx, (JB_SP*4)(%eax)
movl 0(%esp), %ecx /* Save PC we are returning to now. */
movl %ecx, (JB_PC*4)(%eax)
/* strcat(dest, src) -- Append SRC on the end of DEST.
For Intel 80x86, x>=4.
- Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1996, 1997, 2000 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>
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/*
- INPUT PARAMETERS:
- dest (sp + 4)
- src (sp + 8)
-*/
+#define PARMS LINKAGE+4 /* space for 1 saved reg */
+#define RTN PARMS
+#define DEST RTN+RTN_SIZE
+#define SRC DEST+PTR_SIZE
.text
ENTRY (strcat)
+ ENTER
+
pushl %edi /* Save callee-safe register. */
- movl 12(%esp), %ecx /* load source pointer */
- movl 8(%esp), %edx /* load destination pointer */
+ movl DEST(%esp), %edx
+ movl SRC(%esp), %ecx
testb $0xff, (%ecx) /* Is source string empty? */
jz L(8) /* yes => return */
movb %ah, 3(%ecx,%edx) /* store fourth byte of last word */
-L(8): movl 8(%esp), %eax /* start address of destination is result */
+L(8): movl DEST(%esp), %eax /* start address of destination is result */
popl %edi /* restore saved register */
- ret
+ LEAVE
+ RET_PTR
END (strcat)
/* strlen(str) -- determine the length of the string STR.
Optimized for Intel 80x86, x>=4.
- Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+ Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 2000 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>.
This file is part of the GNU C Library.
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/*
- INPUT PARAMETERS:
- str (sp + 4)
-*/
+#define PARMS LINKAGE /* no space for saved regs */
+#define STR PARMS
.text
ENTRY (strlen)
- movl 4(%esp), %ecx /* get string pointer */
+ ENTER
+
+ movl STR(%esp), %ecx
movl %ecx, %eax /* duplicate it */
andl $3, %ecx /* mask alignment bits */
jz L(2) /* yes => return pointer */
incl %eax /* increment pointer */
-L(2): subl 4(%esp), %eax /* compute difference to string start */
+L(2): subl STR(%esp), %eax /* compute difference to string start */
+ LEAVE
ret
END (strlen)
/* Pentium __mpn_add_n -- Add two limb vectors of the same length > 0 and store
sum in a third limb vector.
- Copyright (C) 1992, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+ Copyright (C) 1992, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-/*
- INPUT PARAMETERS
- res_ptr (sp + 4)
- s1_ptr (sp + 8)
- s2_ptr (sp + 12)
- size (sp + 16)
-*/
-
#include "sysdep.h"
#include "asm-syntax.h"
+#include "bp-asm.h"
+
+#define PARMS LINKAGE+16 /* space for 4 saved regs */
+#define RES PARMS
+#define S1 RES+PTR_SIZE
+#define S2 S1+PTR_SIZE
+#define SIZE S2+PTR_SIZE
.text
ENTRY(__mpn_add_n)
+ ENTER
+
pushl %edi
pushl %esi
pushl %ebx
pushl %ebp
- movl 20(%esp),%edi /* res_ptr */
- movl 24(%esp),%esi /* s1_ptr */
- movl 28(%esp),%ebp /* s2_ptr */
- movl 32(%esp),%ecx /* size */
+ movl RES(%esp),%edi
+ movl S1(%esp),%esi
+ movl S2(%esp),%ebp
+ movl SIZE(%esp),%ecx
movl (%ebp),%ebx
popl %ebx
popl %esi
popl %edi
+
+ LEAVE
ret
END(__mpn_add_n)
/* Pentium optimized __mpn_lshift --
- Copyright (C) 1992, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+ Copyright (C) 1992, 94, 95, 96, 97, 98, 2000 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
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-/*
- INPUT PARAMETERS
- res_ptr (sp + 4)
- s_ptr (sp + 8)
- size (sp + 12)
- cnt (sp + 16)
-*/
-
#include "sysdep.h"
#include "asm-syntax.h"
+#include "bp-asm.h"
+
+#define PARMS LINKAGE+16 /* space for 4 saved regs */
+#define RES PARMS
+#define S RES+PTR_SIZE
+#define SIZE S+PTR_SIZE
+#define CNT SIZE+4
-.text
+ .text
ENTRY(__mpn_lshift)
+ ENTER
+
pushl %edi
pushl %esi
pushl %ebx
pushl %ebp
- movl 20(%esp),%edi /* res_ptr */
- movl 24(%esp),%esi /* s_ptr */
- movl 28(%esp),%ebp /* size */
- movl 32(%esp),%ecx /* cnt */
+ movl RES(%esp),%edi
+ movl S(%esp),%esi
+ movl SIZE(%esp),%ebp
+ movl CNT(%esp),%ecx
/* We can use faster code for shift-by-1 under certain conditions. */
cmp $1,%ecx
popl %ebx
popl %esi
popl %edi
+
+ LEAVE
ret
/* We loop from least significant end of the arrays, which is only
popl %ebx
popl %esi
popl %edi
+
+ LEAVE
ret
END(__mpn_lshift)
/* Highly optimized version for i586.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/*
- INPUT PARAMETERS:
- dst (sp + 4)
- src (sp + 8)
- len (sp + 12)
-*/
+/* BEWARE: `#ifdef memset' means that memset is redefined as `bzero' */
+#define BCOPY_P (defined memcpy)
+#define PARMS LINKAGE+8 /* space for 2 saved regs */
+#if BCOPY_P
+# define DEST PARMS
+#else
+# define RTN PARMS
+# define DEST RTN+RTN_SIZE
+#endif
+#define SRC DEST+PTR_SIZE
+#define LEN SRC+PTR_SIZE
.text
ENTRY (memcpy)
+ ENTER
+
pushl %edi
pushl %esi
- movl 12(%esp), %edi /* dst */
- movl 16(%esp), %esi /* src */
- movl 20(%esp), %ecx /* len */
+ movl DEST(%esp), %edi
+ movl SRC(%esp), %esi
+ movl LEN(%esp), %ecx
movl %edi, %eax
/* We need this in any case. */
/* Correct extra loop counter modification. */
L(2): addl $32, %ecx
-#ifndef memcpy
- movl 12(%esp), %eax /* dst */
+#if !BCOPY_P
+ movl DEST(%esp), %eax
#endif
L(1): rep; movsb
-#ifdef memcpy
+#if BCOPY_P
movl %edi, %eax
#endif
popl %esi
popl %edi
+ LEAVE
+#if BCOPY_P
ret
+#else
+ RET_PTR
+#endif
END (memcpy)
/* memset/bzero -- set memory area to CH/0
Highly optimized version for ix86, x>=5.
- Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Torbjorn Granlund, <tege@matematik.su.se>
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/*
- INPUT PARAMETERS:
- (memset) (bzero)
- dst (sp + 4) dst (sp + 4)
- ch (sp + 8) len (sp + 8)
- len (sp + 12)
-*/
+/* BEWARE: `#ifdef memset' means that memset is redefined as `bzero' */
+#define BZERO_P (defined memset)
+#define PARMS LINKAGE+4 /* space for 1 saved reg */
+#define RTN PARMS
+#define DEST RTN+RTN_SIZE
+#if BZERO_P
+# define LEN DEST+PTR_SIZE
+#else
+# define CHR DEST+PTR_SIZE
+# define LEN CHR+4
+#endif
.text
ENTRY (memset)
+ ENTER
+
pushl %edi
- movl 8(%esp), %edi /* destination pointer */
-#ifdef memset
+ movl DEST(%esp), %edi
+ movl LEN(%esp), %edx
+#if BZERO_P
xorl %eax, %eax /* we fill with 0 */
- movl 12(%esp), %edx /* size (in 8-bit words) */
#else
- movb 12(%esp), %al /* use CH to fill */
- movl 16(%esp), %edx /* size (in 8-bit words) */
+ movb CHR(%esp), %al
movb %al, %ah
movl %eax, %ecx
rep
stosb
+#if !BZERO_P
/* Load result (only if used as memset). */
-#ifndef memset
- movl 8(%esp), %eax
+ movl DEST(%esp), %eax
#endif
popl %edi
+ LEAVE
+#if BZERO_P
ret
+#else
+ RET_PTR
+#endif
END (memset)
/* Pentium optimized __mpn_rshift --
- Copyright (C) 1992, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+ Copyright (C) 1992, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-/*
- INPUT PARAMETERS
- res_ptr (sp + 4)
- s_ptr (sp + 8)
- size (sp + 12)
- cnt (sp + 16)
-*/
-
#include "sysdep.h"
#include "asm-syntax.h"
+#include "bp-asm.h"
+
+#define PARMS LINKAGE+16 /* space for 4 saved regs */
+#define RES PARMS
+#define S RES+PTR_SIZE
+#define SIZE S+PTR_SIZE
+#define CNT SIZE+4
-.text
+ .text
ENTRY(__mpn_rshift)
+ ENTER
+
pushl %edi
pushl %esi
pushl %ebx
pushl %ebp
- movl 20(%esp),%edi /* res_ptr */
- movl 24(%esp),%esi /* s_ptr */
- movl 28(%esp),%ebp /* size */
- movl 32(%esp),%ecx /* cnt */
+ movl RES(%esp),%edi
+ movl S(%esp),%esi
+ movl SIZE(%esp),%ebp
+ movl CNT(%esp),%ecx
/* We can use faster code for shift-by-1 under certain conditions. */
cmp $1,%ecx
popl %ebx
popl %esi
popl %edi
+
+ LEAVE
ret
/* We loop from least significant end of the arrays, which is only
popl %ebx
popl %esi
popl %edi
+
+ LEAVE
ret
END(__mpn_rshift)
/* Find character CH in a NUL terminated string.
Highly optimized version for ix85, x>=5.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
/* This version is especially optimized for the i586 (and following?)
processors. This is mainly done by using the two pipelines. The
/* The magic value which is used throughout in the whole code. */
#define magic 0xfefefeff
-/*
- INPUT PARAMETERS:
- str (sp + 4)
- ch (sp + 8)
-*/
+#define PARMS LINKAGE+16 /* space for 4 saved regs */
+#define RTN PARMS
+#define STR RTN+RTN_SIZE
+#define CHR STR+PTR_SIZE
.text
ENTRY (strchr)
+ ENTER
+
pushl %edi /* Save callee-safe registers. */
pushl %esi
pushl %ebx
pushl %ebp
- movl 20(%esp), %eax /* get string pointer */
- movl 24(%esp), %edx /* get character we are looking for */
+ movl STR(%esp), %eax
+ movl CHR(%esp), %edx
movl %eax, %edi /* duplicate string pointer for later */
xorl %ecx, %ecx /* clear %ecx */
popl %esi
popl %edi
- ret
+ LEAVE
+ RET_PTR
/* 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. */
popl %esi
popl %edi
- ret
+ LEAVE
+ RET_PTR
END (strchr)
#undef index
/* strcpy/stpcpy implementation for i586.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
+
+#define PARMS LINKAGE+12 /* space for 3 saved regs */
+#define RTN PARMS
+#define DEST RTN+RTN_SIZE
+#define SRC DEST+PTR_SIZE
#ifndef USE_AS_STPCPY
# define STRCPY strcpy
.text
ENTRY(STRCPY)
+ ENTER
+
pushl %edi
pushl %esi
pushl %ebx
- movl 16(%esp), %edi
- movl 20(%esp), %esi
+ movl DEST(%esp), %edi
+ movl SRC(%esp), %esi
xorl %eax, %eax
leal -1(%esi), %ecx
L(end2):
#ifdef USE_AS_STPCPY
movl %edi, %eax
+#else
+ movl DEST(%esp), %eax
#endif
popl %ebx
popl %esi
popl %edi
-#ifndef USE_AS_STPCPY
- movl 4(%esp), %eax
-#endif
- ret
+
+ LEAVE
+ RET_PTR
END(STRCPY)
/* strlen -- Compute length og NUL terminated string.
Highly optimized version for ix86, x>=5.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper, <drepper@gnu.ai.mit.edu>.
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
/* This version is especially optimized for the i586 (and following?)
processors. This is mainly done by using the two pipelines. The
/* The magic value which is used throughout in the whole code. */
#define magic 0xfefefeff
-/*
- INPUT PARAMETERS:
- str (sp + 4)
-*/
+#define PARMS LINKAGE /* no space for saved regs */
+#define STR PARMS
.text
ENTRY(strlen)
- movl 4(%esp), %eax /* get string pointer */
+ ENTER
+
+ movl STR(%esp), %eax
movl $3, %edx /* load mask (= 3) */
andl %eax, %edx /* separate last two bits of address */
incl %eax /* increment pointer */
-L(2): subl 4(%esp), %eax /* now compute the length as difference
+L(2): subl STR(%esp), %eax /* now compute the length as difference
between start and terminating NUL
character */
-
+ LEAVE
ret
END (strlen)
/* Pentium __mpn_sub_n -- Subtract two limb vectors of the same length > 0
and store difference in a third limb vector.
- Copyright (C) 1992, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
+ Copyright (C) 1992, 94, 95, 96, 97, 98, 2000 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-/*
- INPUT PARAMETERS
- res_ptr (sp + 4)
- s1_ptr (sp + 8)
- s2_ptr (sp + 12)
- size (sp + 16)
-*/
-
#include "sysdep.h"
#include "asm-syntax.h"
+#include "bp-asm.h"
+
+#define PARMS LINKAGE+16 /* space for 4 saved regs */
+#define RES PARMS
+#define S1 RES+PTR_SIZE
+#define S2 S1+PTR_SIZE
+#define SIZE S2+PTR_SIZE
.text
ENTRY(__mpn_sub_n)
+ ENTER
+
pushl %edi
pushl %esi
pushl %ebx
pushl %ebp
- movl 20(%esp),%edi /* res_ptr */
- movl 24(%esp),%esi /* s1_ptr */
- movl 28(%esp),%ebp /* s2_ptr */
- movl 32(%esp),%ecx /* size */
+ movl RES(%esp),%edi
+ movl S1(%esp),%esi
+ movl S2(%esp),%ebp
+ movl SIZE(%esp),%ecx
movl (%ebp),%ebx
popl %ebx
popl %esi
popl %edi
+
+ LEAVE
ret
END(__mpn_sub_n)
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-/*
- INPUT PARAMETERS
- res_ptr (sp + 4)
- s1_ptr (sp + 8)
- s2_ptr (sp + 12)
- size (sp + 16)
-*/
-
#include "sysdep.h"
#include "asm-syntax.h"
+#include "bp-asm.h"
+
+#define PARMS LINKAGE+8 /* space for 2 saved regs */
+#define RES PARMS
+#define S1 RES+PTR_SIZE
+#define S2 S1+PTR_SIZE
+#define SIZE S2+PTR_SIZE
.text
#ifdef PIC
ret
#endif
ENTRY(__mpn_add_n)
+ ENTER
+
pushl %edi
pushl %esi
- movl 12(%esp),%edi /* res_ptr */
- movl 16(%esp),%esi /* s1_ptr */
- movl 20(%esp),%edx /* s2_ptr */
- movl 24(%esp),%ecx /* size */
+ movl RES(%esp),%edi
+ movl S1(%esp),%esi
+ movl S2(%esp),%edx
+ movl SIZE(%esp),%ecx
movl %ecx,%eax
shrl $3,%ecx /* compute count for unrolled loop */
popl %esi
popl %edi
+
+ LEAVE
ret
END(__mpn_add_n)
/* Copy memory block and return pointer to beginning of destination block
For Intel 80x86, x>=6.
This file is part of the GNU C Library.
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
The GNU C Library is free software; you can redistribute it and/or
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/* memcpy:
- INPUT PARAMETER:
- dest (sp + 4)
- src (sp + 8)
- len (sp + 12)
-*/
+#define PARMS LINKAGE /* no space for saved regs */
+#define RTN PARMS
+#define DEST RTN+RTN_SIZE
+#define SRC DEST+PTR_SIZE
+#define LEN SRC+PTR_SIZE
+ .text
ENTRY(memcpy)
- movl 12(%esp), %ecx
+ ENTER
+
+ movl LEN(%esp), %ecx
movl %edi, %eax
- movl 4(%esp), %edi
+ movl DEST(%esp), %edi
movl %esi, %edx
- movl 8(%esp), %esi
+ movl SRC(%esp), %esi
cld
shrl $1, %ecx
jnc 1f
movsl
movl %eax, %edi
movl %edx, %esi
- movl 4(%esp), %eax
- ret
+ movl DEST(%esp), %eax
+
+ LEAVE
+ RET_PTR
END(memcpy)
/* Copy memory block and return pointer to following byte.
For Intel 80x86, x>=6.
This file is part of the GNU C Library.
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
The GNU C Library is free software; you can redistribute it and/or
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/* mempcpy:
- INPUT PARAMETER:
- dest (sp + 4)
- src (sp + 8)
- len (sp + 12)
-*/
+#define PARMS LINKAGE /* no space for saved regs */
+#define RTN PARMS
+#define DEST RTN+RTN_SIZE
+#define SRC DEST+PTR_SIZE
+#define LEN SRC+PTR_SIZE
+ .text
ENTRY(__mempcpy)
- movl 12(%esp), %ecx
+ ENTER
+
+ movl LEN(%esp), %ecx
movl %edi, %eax
- movl 4(%esp), %edi
+ movl DEST(%esp), %edi
movl %esi, %edx
- movl 8(%esp), %esi
+ movl SRC(%esp), %esi
cld
shrl $1, %ecx
jnc 1f
movsl
xchgl %edi, %eax
movl %edx, %esi
- ret
+
+ LEAVE
+ RET_PTR
END(__mempcpy)
weak_alias (__mempcpy, mempcpy)
/* memset/bzero -- set memory area to CH/0
Highly optimized version for ix86, x>=6.
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/*
- INPUT PARAMETERS:
- (memset) (bzero)
- dst (sp + 4) dst (sp + 4)
- ch (sp + 8) len (sp + 8)
- len (sp + 12)
-*/
+/* BEWARE: `#ifdef memset' means that memset is redefined as `bzero' */
+#define BZERO_P (defined memset)
+#define PARMS LINKAGE+4 /* space for 1 saved reg */
+#if BZERO_P
+# define DEST PARMS
+# define LEN DEST+PTR_SIZE
+#else
+# define RTN PARMS
+# define DEST RTN+RTN_SIZE
+# define CHR DEST+PTR_SIZE
+# define LEN CHR+4
+#endif
.text
ENTRY (memset)
+ ENTER
+
cld
pushl %edi
- movl 8(%esp), %edx
-#ifdef memset
- movl 12(%esp), %ecx
- xorl %eax, %eax
+ movl DEST(%esp), %edx
+ movl LEN(%esp), %ecx
+#if BZERO_P
+ xorl %eax, %eax /* fill with 0 */
#else
- movzbl 12(%esp), %eax
- movl 16(%esp), %ecx
+ movzbl CHR(%esp), %eax
#endif
jecxz 1f
movl %edx, %edi
2: movl %ecx, %edx
shrl $2, %ecx
andl $3, %edx
-#ifndef memset
+#if !BZERO_P
imul $0x01010101, %eax
#endif
rep
stosb
1:
-#ifndef memset
- movl 8(%esp), %eax
+#if !BZERO_P
+ movl DEST(%esp), %eax
#endif
popl %edi
+
+ LEAVE
+#if BZERO_P
ret
+#else
+ RET_PTR
+#endif
END (memset)
/* Highly optimized version for ix86, x>=6.
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1999.
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/*
- INPUT PARAMETERS:
- s1 (sp + 4)
- s2 (sp + 8)
-*/
-
+#define PARMS LINKAGE /* no space for saved regs */
+#define STR1 PARMS
+#define STR2 STR1+PTR_SIZE
.text
ENTRY (strcmp)
- movl 4(%esp), %ecx
- movl 8(%esp), %edx
-1: movb (%ecx), %al
+ ENTER
+
+ movl STR1(%esp), %ecx
+ movl STR2(%esp), %edx
+
+L(oop): movb (%ecx), %al
incl %ecx
cmpb (%edx), %al
- jne 2f
+ jne L(neq)
incl %edx
testb %al, %al
- jnz 1b
+ jnz L(oop)
+
xorl %eax, %eax
- jmp 3f
-2: movl $1, %eax
- ja 3f
+ jmp L(out)
+
+L(neq): movl $1, %eax
+ ja L(out)
negl %eax
-3: ret
+
+L(out): LEAVE
+ ret
END (strcmp)
/* i80386 __mpn_lshift --
- Copyright (C) 1992, 1994, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1994, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-/*
- INPUT PARAMETERS
- res_ptr (sp + 4)
- s_ptr (sp + 8)
- size (sp + 12)
- cnt (sp + 16)
-*/
-
#include "sysdep.h"
#include "asm-syntax.h"
+#include "bp-asm.h"
+
+#define PARMS LINKAGE+12 /* space for 3 saved regs */
+#define RES PARMS
+#define S RES+PTR_SIZE
+#define SIZE S+PTR_SIZE
+#define CNT SIZE+4
.text
ENTRY(__mpn_lshift)
+ ENTER
+
pushl %edi
pushl %esi
pushl %ebx
- movl 16(%esp),%edi /* res_ptr */
- movl 20(%esp),%esi /* s_ptr */
- movl 24(%esp),%edx /* size */
- movl 28(%esp),%ecx /* cnt */
+ movl RES(%esp),%edi
+ movl S(%esp),%esi
+ movl SIZE(%esp),%edx
+ movl CNT(%esp),%ecx
subl $4,%esi /* adjust s_ptr */
popl %ebx
popl %esi
popl %edi
+
+ LEAVE
ret
L(end): shll %cl,%ebx /* compute least significant limb */
popl %ebx
popl %esi
popl %edi
+
+ LEAVE
ret
END(__mpn_lshift)
-/* memchr (str, ch, n) -- Return pointer to first occurrence of CH in STR less
- than N.
+/* memchr (str, chr, len) -- Return pointer to first occurrence of CHR in STR less
+ than LEN.
For Intel 80x86, x>=3.
- Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000 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>
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/*
- INPUT PARAMETERS:
- str (sp + 4)
- c (sp + 8)
- len (sp + 12)
-*/
+#define PARMS LINKAGE+8 /* space for 2 saved regs */
+#define RTN PARMS
+#define STR RTN+RTN_SIZE
+#define CHR STR+PTR_SIZE
+#define LEN CHR+4
.text
ENTRY (memchr)
+ ENTER
+
/* Save callee-safe registers used in this function. */
pushl %esi
pushl %edi
/* Load parameters into registers. */
- movl 12(%esp), %eax /* str: pointer to memory block. */
- movl 16(%esp), %edx /* c: byte we are looking for. */
- movl 20(%esp), %esi /* len: length of memory block. */
+ movl STR(%esp), %eax /* str: pointer to memory block. */
+ movl CHR(%esp), %edx /* c: byte we are looking for. */
+ movl LEN(%esp), %esi /* len: length of memory block. */
/* If my must not test more than three characters test
them one by one. This is especially true for 0. */
cmpl $4, %esi
jb L(3)
- /* At the moment %edx contains C. What we need for the
- algorithm is C in all bytes of the dword. Avoid
+ /* At the moment %edx contains CHR. What we need for the
+ algorithm is CHR in all bytes of the dword. Avoid
operations on 16 bit words because these require an
prefix byte (and one more cycle). */
movb %dl, %dh /* Now it is 0|0|c|c */
into bit 32 (=carry flag), so all of the hole bits will
be changed.
- 3) But wait! Aren't we looking for C, not zero?
+ 3) But wait! Aren't we looking for CHR, not zero?
Good point. So what we do is XOR LONGWORD with a longword,
- each of whose bytes is C. This turns each byte that is C
+ each of whose bytes is CHR. This turns each byte that is CHR
into a zero. */
incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */
- /* If at least one byte of the word is C we don't get 0 in %edi. */
+ /* If at least one byte of the word is CHR we don't get 0 in %edi. */
jnz L(8) /* found it => return pointer */
/* This process is unfolded four times for better performance.
addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
is *not* 0 */
- jnc L(7) /* highest byte is C => return pointer */
+ jnc L(7) /* highest byte is CHR => 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
addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
is *not* 0 */
- jnc L(6) /* highest byte is C => return pointer */
+ jnc L(6) /* highest byte is CHR => 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
addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
is *not* 0 */
- jnc L(5) /* highest byte is C => return pointer */
+ jnc L(5) /* highest byte is CHR => 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
addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
is *not* 0 */
- jnc L(8) /* highest byte is C => return pointer */
+ jnc L(8) /* highest byte is CHR => 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
addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
is *not* 0 */
- jnc L(8) /* highest byte is C => return pointer */
+ jnc L(8) /* highest byte is CHR => 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
addl %ecx, %edi /* add the magic value to the word. We get
carry bits reported for each byte which
is *not* 0 */
- jnc L(8) /* highest byte is C => return pointer */
+ jnc L(8) /* highest byte is CHR => 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
L(3): andl $3, %esi /* mask out uninteresting bytes */
jz L(4) /* no remaining bytes => return NULL */
- cmpb %dl, (%eax) /* compare byte with C */
+ cmpb %dl, (%eax) /* compare byte with CHR */
je L(9) /* equal, than return pointer */
incl %eax /* increment source pointer */
decl %esi /* decrement length */
jz L(4) /* no remaining bytes => return NULL */
- cmpb %dl, (%eax) /* compare byte with C */
+ cmpb %dl, (%eax) /* compare byte with CHR */
je L(9) /* equal, than return pointer */
incl %eax /* increment source pointer */
decl %esi /* decrement length */
jz L(4) /* no remaining bytes => return NULL */
- cmpb %dl, (%eax) /* compare byte with C */
+ cmpb %dl, (%eax) /* compare byte with CHR */
je L(9) /* equal, than return pointer */
L(4): /* no byte found => return NULL */
L(9): popl %edi /* pop saved registers */
popl %esi
- ret
+ LEAVE
+ RET_PTR
END (memchr)
/* Compare two memory blocks for differences in the first COUNT bytes.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 2000 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
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/*
- INPUT PARAMETERS:
- block1 (sp + 4)
- block2 (sp + 8)
- len (sp + 12)
-*/
+#define PARMS LINKAGE+4 /* space for 1 saved reg */
+#define BLK1 PARMS
+#define BLK2 BLK1+PTR_SIZE
+#define LEN BLK2+PTR_SIZE
.text
ENTRY (memcmp)
+ ENTER
+
pushl %esi /* Save callee-safe registers. */
movl %edi, %edx /* Note that %edx is not used and can
so be used to save %edi. It's faster. */
- movl 8(%esp), %esi /* Load address of block #1. */
- movl 12(%esp), %edi /* Load address of block #2. */
- movl 16(%esp), %ecx /* Load maximal length of compare area. */
+ movl BLK1(%esp), %esi
+ movl BLK2(%esp), %edi
+ movl LEN(%esp), %ecx
cld /* Set direction of comparison. */
L(1): popl %esi /* Restore registers. */
movl %edx, %edi
+ LEAVE
ret
END (memcmp)
/* 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, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
+
+#define PARMS LINKAGE+16 /* space for 4 saved regs */
+#define RES PARMS
+#define S1 RES+PTR_SIZE
+#define SIZE S1+PTR_SIZE
+#define S2LIMB SIZE+4
#define res_ptr edi
#define s1_ptr esi
.text
ENTRY(__mpn_mul_1)
+ ENTER
INSN1(push,l ,R(edi))
INSN1(push,l ,R(esi))
INSN1(push,l ,R(ebx))
INSN1(push,l ,R(ebp))
- INSN2(mov,l ,R(res_ptr),MEM_DISP(esp,20))
- INSN2(mov,l ,R(s1_ptr),MEM_DISP(esp,24))
- INSN2(mov,l ,R(size),MEM_DISP(esp,28))
- INSN2(mov,l ,R(s2_limb),MEM_DISP(esp,32))
+ INSN2(mov,l ,R(res_ptr),MEM_DISP(esp,RES))
+ INSN2(mov,l ,R(s1_ptr),MEM_DISP(esp,S1))
+ INSN2(mov,l ,R(size),MEM_DISP(esp,SIZE))
+ INSN2(mov,l ,R(s2_limb),MEM_DISP(esp,S2LIMB))
INSN2(lea,l ,R(res_ptr),MEM_INDEX(res_ptr,size,4))
INSN2(lea,l ,R(s1_ptr),MEM_INDEX(s1_ptr,size,4))
INSN1(pop,l ,R(ebx))
INSN1(pop,l ,R(esi))
INSN1(pop,l ,R(edi))
+
+ LEAVE
ret
#undef size
END(__mpn_mul_1)
/* rawmemchr (str, ch) -- Return pointer to first occurrence of CH in STR.
For Intel 80x86, x>=3.
- Copyright (C) 1994, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
+ Copyright (C) 1994, 95, 96, 97, 98, 99, 2000 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>
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/*
- INPUT PARAMETERS:
- str (sp + 4)
- c (sp + 8)
-*/
+#define PARMS LINKAGE+4 /* space for 1 saved reg */
+#define RTN PARMS
+#define STR RTN+RTN_SIZE
+#define CHR STR+PTR_SIZE
.text
ENTRY (__rawmemchr)
+ ENTER
+
/* Save callee-safe register used in this function. */
pushl %edi
/* Load parameters into registers. */
- movl 8(%esp), %eax /* str: pointer to memory block. */
- movl 12(%esp), %edx /* c: byte we are looking for. */
+ movl STR(%esp), %eax
+ movl CHR(%esp), %edx
/* At the moment %edx contains C. What we need for the
algorithm is C in all bytes of the dword. Avoid
L(9): popl %edi /* pop saved register */
+ LEAVE
ret
END (__rawmemchr)
weak_alias (__rawmemchr, rawmemchr)
/* i80386 __mpn_rshift --
- Copyright (C) 1992, 1994, 1997, 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1994, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-/*
- INPUT PARAMETERS
- res_ptr (sp + 4)
- s_ptr (sp + 8)
- size (sp + 12)
- cnt (sp + 16)
-*/
-
#include "sysdep.h"
#include "asm-syntax.h"
+#include "bp-asm.h"
+
+#define PARMS LINKAGE+12 /* space for 3 saved regs */
+#define RES PARMS
+#define S RES+PTR_SIZE
+#define SIZE S+PTR_SIZE
+#define CNT SIZE+4
.text
ENTRY(__mpn_rshift)
+ ENTER
+
pushl %edi
pushl %esi
pushl %ebx
- movl 16(%esp),%edi /* res_ptr */
- movl 20(%esp),%esi /* s_ptr */
- movl 24(%esp),%edx /* size */
- movl 28(%esp),%ecx /* cnt */
+ movl RES(%esp),%edi
+ movl S(%esp),%esi
+ movl SIZE(%esp),%edx
+ movl CNT(%esp),%ecx
leal -4(%edi,%edx,4),%edi
leal (%esi,%edx,4),%esi
popl %ebx
popl %esi
popl %edi
+
+ LEAVE
ret
L(end): shrl %cl,%ebx /* compute most significant limb */
popl %ebx
popl %esi
popl %edi
+
+ LEAVE
ret
END(__mpn_rshift)
/* Copy SRC to DEST returning the address of the terminating '\0' in DEST.
For Intel 80x86, x>=3.
- Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1996, 1997, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper (drepper@gnu.ai.mit.edu).
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/*
- INPUT PARAMETERS:
- dest (sp + 4)
- src (sp + 8)
-*/
+#define PARMS LINKAGE /* no space for saved regs */
+#define RTN PARMS
+#define DEST RTN+RTN_SIZE
+#define SRC DEST+PTR_SIZE
.text
ENTRY (__stpcpy)
- movl 4(%esp), %eax /* load destination pointer */
- movl 8(%esp), %ecx /* load source pointer */
+ ENTER
+ movl DEST(%esp), %eax
+ movl SRC(%esp), %ecx
subl %eax, %ecx /* magic: reduce number of loop variants
to one using addressing mode */
L(4): incl %eax
L(3): incl %eax
L(2):
- ret
+
+ LEAVE
+ RET_PTR
END (__stpcpy)
weak_alias (__stpcpy, stpcpy)
/* 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, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1996, 1997, 2000 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>
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/*
- INPUT PARAMETERS:
- dest (sp + 4)
- src (sp + 8)
- maxlen (sp + 12)
-*/
+#define PARMS LINKAGE+4 /* space for 1 saved reg */
+#define RTN PARMS
+#define DEST RTN+RTN_SIZE
+#define SRC DEST+PTR_SIZE
+#define LEN SRC+PTR_SIZE
.text
ENTRY (__stpncpy)
+ ENTER
pushl %esi
- movl 8(%esp), %eax /* load destination pointer */
- movl 12(%esp), %esi /* load source pointer */
- movl 16(%esp), %ecx /* load maximal length */
+ movl DEST(%esp), %eax
+ movl SRC(%esp), %esi
+ movl LEN(%esp), %ecx
subl %eax, %esi /* magic: reduce number of loop variants
to one using addressing mode */
L(9): popl %esi /* restore saved register content */
- ret
+ LEAVE
+ RET_PTR
END (__stpncpy)
weak_alias (__stpncpy, stpncpy)
/* strchr (str, ch) -- Return pointer to first occurrence of CH in STR.
For Intel 80x86, x>=3.
- Copyright (C) 1994, 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000 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>
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/*
- INPUT PARAMETERS:
- str (sp + 4)
- ch (sp + 8)
-*/
+#define PARMS LINKAGE+4 /* space for 1 saved reg */
+#define RTN PARMS
+#define STR RTN+RTN_SIZE
+#define CHR STR+PTR_SIZE
.text
ENTRY (strchr)
- pushl %edi /* Save callee-safe registers used here. */
+ ENTER
- movl 8(%esp), %eax /* get string pointer */
- movl 12(%esp), %edx /* get character we are looking for */
+ pushl %edi /* Save callee-safe registers used here. */
+ movl STR(%esp), %eax
+ movl CHR(%esp), %edx
/* At the moment %edx contains C. What we need for the
algorithm is C in all bytes of the dword. Avoid
L(2): /* Return NULL. */
xorl %eax, %eax /* load NULL in return value register */
popl %edi /* restore saved register content */
- ret
+
+ LEAVE
+ RET_PTR
L(73): addl $4, %eax /* adjust pointer */
L(72): addl $4, %eax
L(6): popl %edi /* restore saved register content */
- ret
+ LEAVE
+ RET_PTR
END (strchr)
weak_alias (strchr, index)
-/* strchrnul (str, ch) -- Return pointer to first occurrence of CH in STR
+/* strchrnul (str, chr) -- Return pointer to first occurrence of CHR in STR
or the final NUL byte.
For Intel 80x86, x>=3.
- Copyright (C) 1994, 1995, 1996, 1997, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>
Some optimisations by Alan Modra <Alan@SPRI.Levels.UniSA.Edu.Au>
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/*
- INPUT PARAMETERS:
- str (sp + 4)
- ch (sp + 8)
-*/
+#define PARMS LINKAGE+4 /* space for 1 saved reg */
+#define RTN PARMS
+#define STR RTN+RTN_SIZE
+#define CHR STR+PTR_SIZE
.text
ENTRY (__strchrnul)
+ ENTER
+
pushl %edi /* Save callee-safe registers used here. */
- movl 8(%esp), %eax /* get string pointer */
- movl 12(%esp), %edx /* get character we are looking for */
+ movl STR(%esp), %eax
+ movl CHR(%esp), %edx
- /* At the moment %edx contains C. What we need for the
- algorithm is C in all bytes of the dword. Avoid
+ /* At the moment %edx contains CHR. What we need for the
+ algorithm is CHR in all bytes of the dword. Avoid
operations on 16 bit words because these require an
prefix byte (and one more cycle). */
movb %dl, %dh /* now it is 0|0|c|c */
into bit 32 (=carry flag), so all of the hole bits will
be changed.
- 3) But wait! Aren't we looking for C, not zero?
+ 3) But wait! Aren't we looking for CHR, not zero?
Good point. So what we do is XOR LONGWORD with a longword,
- each of whose bytes is C. This turns each byte that is C
+ each of whose bytes is CHR. This turns each byte that is CHR
into a zero. */
/* Each round the main loop processes 16 bytes. */
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* C */
+ is *not* CHR */
/* According to the algorithm we had to reverse the effect of the
XOR first and then test the overflow bits. But because the
incl %edi /* add 1: if one carry bit was *not* set
the addition will not result in 0. */
- /* If at least one byte of the word is C we don't get 0 in %edi. */
+ /* If at least one byte of the word is CHR we don't get 0 in %edi. */
jnz L(7) /* found it => return pointer */
/* Now we made sure the dword does not contain the character we are
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* C */
- jnc L(71) /* highest byte is C => return pointer */
+ is *not* CHR */
+ jnc L(71) /* highest byte is CHR => 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
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* C */
- jnc L(72) /* highest byte is C => return pointer */
+ is *not* CHR */
+ jnc L(72) /* highest byte is CHR => 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
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* C */
- jnc L(73) /* highest byte is C => return pointer */
+ is *not* CHR */
+ jnc L(73) /* highest byte is CHR => 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
But we have to take care of the case that a NUL char is
found before this in the dword. */
-L(7): testb %cl, %cl /* is first byte C? */
+L(7): testb %cl, %cl /* is first byte CHR? */
jz L(6) /* yes => return pointer */
cmpb %dl, %cl /* is first byte NUL? */
je L(6) /* yes => return NULL */
incl %eax /* it's not in the first byte */
- testb %ch, %ch /* is second byte C? */
+ testb %ch, %ch /* is second byte CHR? */
jz L(6) /* yes => return pointer */
cmpb %dl, %ch /* is second byte NUL? */
je L(6) /* 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? */
+ testb %cl, %cl /* is third byte CHR? */
jz L(6) /* yes => return pointer */
cmpb %dl, %cl /* is third byte NUL? */
je L(6) /* yes => return NULL */
L(6): popl %edi /* restore saved register content */
- ret
+ LEAVE
+ RET_PTR
END (__strchrnul)
weak_alias (__strchrnul, strchrnul)
/* 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, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1996, 1997, 2000 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>
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/*
- INPUT PARAMETERS:
- str (sp + 4)
- stopset (sp + 8)
-*/
+#define PARMS LINKAGE /* no space for saved regs */
+#define STR PARMS
+#define STOP STR+PTR_SIZE
.text
ENTRY (strcspn)
- movl 4(%esp), %edx /* get string pointer */
- movl 8(%esp), %eax /* get stopset pointer */
+ ENTER
+
+ movl STR(%esp), %edx
+ movl STOP(%esp), %eax
/* First we create a table with flags for all possible characters.
For the ASCII (7bit/8bit) or ISO-8859-X character sets which are
non-valid character */
addl $256, %esp /* remove stopset */
+ LEAVE
ret
END (strcspn)
/* 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, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1996, 1997, 2000 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.
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/*
- INPUT PARAMETERS:
- str (sp + 4)
- stopset (sp + 8)
-*/
+#define PARMS LINKAGE /* no space for saved regs */
+#define RTN PARMS
+#define STR RTN+RTN_SIZE
+#define STOP STR+PTR_SIZE
.text
ENTRY (strpbrk)
- movl 4(%esp), %edx /* get string pointer */
- movl 8(%esp), %eax /* get stopset pointer */
+ ENTER
+
+ movl STR(%esp), %edx
+ movl STOP(%esp), %eax
/* First we create a table with flags for all possible characters.
For the ASCII (7bit/8bit) or ISO-8859-X character sets which are
jnz L(7) /* no => return pointer */
xorl %eax, %eax /* return NULL */
-L(7): ret
+L(7): LEAVE
+ RET_PTR
END (strpbrk)
/* strrchr (str, ch) -- Return pointer to last occurrence of CH in STR.
For Intel 80x86, x>=3.
- Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1996, 1997, 2000 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>
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/*
- INPUT PARAMETERS:
- str (sp + 4)
- ch (sp + 8)
-*/
+#define PARMS LINKAGE+8 /* space for 2 saved regs */
+#define RTN PARMS
+#define STR RTN+RTN_SIZE
+#define CHR STR+PTR_SIZE
.text
ENTRY (strrchr)
+ ENTER
+
pushl %edi /* Save callee-safe registers used here. */
pushl %esi
xorl %eax, %eax
- movl 12(%esp), %esi /* get string pointer */
- movl 16(%esp), %ecx /* get character we are looking for */
+ movl STR(%esp), %esi
+ movl CHR(%esp), %ecx
/* At the moment %ecx contains C. What we need for the
algorithm is C in all bytes of the dword. Avoid
L(2): popl %esi /* restore saved register content */
popl %edi
- ret
+ LEAVE
+ RET_PTR
END (strrchr)
weak_alias (strrchr, rindex)
/* 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, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1996, 1997, 2000 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>
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
-/*
- INPUT PARAMETERS:
- str (sp + 4)
- skipset (sp + 8)
-*/
+#define PARMS LINKAGE /* no space for saved regs */
+#define STR PARMS
+#define SKIP STR+PTR_SIZE
.text
ENTRY (strspn)
- movl 4(%esp), %edx /* get string pointer */
- movl 8(%esp), %eax /* get skipset pointer */
+ ENTER
+
+ movl STR(%esp), %edx
+ movl SKIP(%esp), %eax
/* First we create a table with flags for all possible characters.
For the ASCII (7bit/8bit) or ISO-8859-X character sets which are
non-valid character */
addl $256, %esp /* remove stopset */
+ LEAVE
ret
END (strspn)
/* strtok (str, delim) -- Return next DELIM separated token from STR.
For Intel 80x86, x>=3.
- Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
#include <sysdep.h>
#include "asm-syntax.h"
+#include "bp-asm.h"
/* This file can be used for three variants of the strtok function:
#define FUNCTION strtok
#endif
+#define PARMS LINKAGE /* no space for saved regs */
+#define RTN PARMS
+#define STR RTN+RTN_SIZE
+#define DELIM STR+PTR_SIZE
+#define SAVE DELIM+PTR_SIZE
+
.text
ENTRY (FUNCTION)
+ ENTER
- movl 4(%esp), %edx /* Get start of string. */
- movl 8(%esp), %eax /* Get start of delimiter set. */
+ movl STR(%esp), %edx
+ movl DELIM(%esp), %eax
#if !defined (USE_AS_STRTOK_R) && defined (PIC)
pushl %ebx /* Save PIC register. */
#ifdef USE_AS_STRTOK_R
/* The value is stored in the third argument. */
- movl 12(%esp), %edx
+ movl SAVE(%esp), %edx
movl (%edx), %edx
#else
/* The value is in the local variable defined above. But
L(return):
/* Store the pointer to the next character. */
#ifdef USE_AS_STRTOK_R
- movl 12(%esp), %ecx
+ movl SAVE(%esp), %ecx
movl %edx, (%ecx)
#else
# ifndef PIC
popl %ebx
# endif
#endif
- ret
+ LEAVE
+ RET_PTR
L(returnNULL):
xorl %eax, %eax
/* 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, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1994, 1995, 1997, 1998, 2000 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-/*
- INPUT PARAMETERS
- res_ptr (sp + 4)
- s1_ptr (sp + 8)
- s2_ptr (sp + 12)
- size (sp + 16)
-*/
-
#include "sysdep.h"
#include "asm-syntax.h"
+#include "bp-asm.h"
+
+#define PARMS LINKAGE+8 /* space for 2 saved regs */
+#define RES PARMS
+#define S1 RES+PTR_SIZE
+#define S2 S1+PTR_SIZE
+#define SIZE S2+PTR_SIZE
.text
ENTRY(__mpn_sub_n)
+ ENTER
+
pushl %edi
pushl %esi
- movl 12(%esp),%edi /* res_ptr */
- movl 16(%esp),%esi /* s1_ptr */
- movl 20(%esp),%edx /* s2_ptr */
- movl 24(%esp),%ecx /* size */
+ movl RES(%esp),%edi
+ movl S1(%esp),%esi
+ movl S2(%esp),%edx
+ movl SIZE(%esp),%ecx
movl %ecx,%eax
shrl $3,%ecx /* compute count for unrolled loop */
popl %esi
popl %edi
+
+ LEAVE
ret
END(__mpn_sub_n)
/* 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, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1992, 1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
The GNU MP Library is free software; you can redistribute it and/or modify
the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA. */
-/*
- INPUT PARAMETERS
- res_ptr (sp + 4)
- s1_ptr (sp + 8)
- sizeP (sp + 12)
- s2_limb (sp + 16)
-*/
-
#include "sysdep.h"
#include "asm-syntax.h"
+#include "bp-asm.h"
+
+#define PARMS LINKAGE+16 /* space for 4 saved regs */
+#define RES PARMS
+#define S1 RES+PTR_SIZE
+#define SIZE S1+PTR_SIZE
+#define S2LIMB SIZE+4
#define res_ptr edi
#define s1_ptr esi
.text
ENTRY(__mpn_submul_1)
+ ENTER
INSN1(push,l ,R(edi))
INSN1(push,l ,R(esi))
INSN1(push,l ,R(ebx))
INSN1(push,l ,R(ebp))
- INSN2(mov,l ,R(res_ptr),MEM_DISP(esp,20))
- INSN2(mov,l ,R(s1_ptr),MEM_DISP(esp,24))
- INSN2(mov,l ,R(sizeP),MEM_DISP(esp,28))
- INSN2(mov,l ,R(s2_limb),MEM_DISP(esp,32))
+ INSN2(mov,l ,R(res_ptr),MEM_DISP(esp,RES))
+ INSN2(mov,l ,R(s1_ptr),MEM_DISP(esp,S1))
+ INSN2(mov,l ,R(sizeP),MEM_DISP(esp,SIZE))
+ INSN2(mov,l ,R(s2_limb),MEM_DISP(esp,S2LIMB))
INSN2(lea,l ,R(res_ptr),MEM_INDEX(res_ptr,sizeP,4))
INSN2(lea,l ,R(s1_ptr),MEM_INDEX(s1_ptr,sizeP,4))
INSN1(pop,l ,R(ebx))
INSN1(pop,l ,R(esi))
INSN1(pop,l ,R(edi))
+
+ LEAVE
ret
END(__mpn_submul_1)