diff options
Diffstat (limited to 'sysdeps/i386')
-rw-r--r-- | sysdeps/i386/bits/select.h | 19 | ||||
-rw-r--r-- | sysdeps/i386/bzero.c | 20 | ||||
-rw-r--r-- | sysdeps/i386/memcopy.h | 42 | ||||
-rw-r--r-- | sysdeps/i386/memset.c | 21 |
4 files changed, 57 insertions, 45 deletions
diff --git a/sysdeps/i386/bits/select.h b/sysdeps/i386/bits/select.h index f2ab43ebbb..f21407f81f 100644 --- a/sysdeps/i386/bits/select.h +++ b/sysdeps/i386/bits/select.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998 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 @@ -24,12 +24,17 @@ #if defined __GNUC__ && __GNUC__ >= 2 # define __FD_ZERO(fdsetp) \ - __asm__ __volatile__ ("cld; rep; stosl" \ - : "=m" ((fdsetp)->fds_bits[__FDELT (__FD_SETSIZE)]) \ - : "a" (0), "c" (sizeof (__fd_set) \ - / sizeof (__fd_mask)), \ - "D" (&(fdsetp)->fds_bits[0]) \ - :"cx","di","memory") + do { \ + int __d0, __d1; \ + __asm__ __volatile__ ("cld; rep; stosl" \ + : "=m" ((fdsetp)->fds_bits[__FDELT (__FD_SETSIZE)]),\ + "=&c" (__d0), "=&D" (__d1) \ + : "a" (0), "1" (sizeof (__fd_set) \ + / sizeof (__fd_mask)), \ + "2" (&(fdsetp)->fds_bits[0]) \ + : "memory"); \ + } while (0) + # define __FD_SET(fd, fdsetp) \ __asm__ __volatile__ ("btsl %1,%0" \ : "=m" ((fdsetp)->fds_bits[__FDELT (fd)]) \ diff --git a/sysdeps/i386/bzero.c b/sysdeps/i386/bzero.c index 99f2352dc6..80574cca6a 100644 --- a/sysdeps/i386/bzero.c +++ b/sysdeps/i386/bzero.c @@ -1,6 +1,6 @@ /* bzero -- set a block of memory to zero. For Intel 80x86, x>=3. This file is part of the GNU C Library. - Copyright (C) 1991, 1992, 1993, 1997 Free Software Foundation, Inc. + Copyright (C) 1991, 1992, 1993, 1997, 1998 Free Software Foundation, Inc. Contributed by Torbjorn Granlund (tege@sics.se). The GNU C Library is free software; you can redistribute it and/or @@ -31,7 +31,7 @@ __bzero (dstpp, len) size_t len; { /* N.B.: This code is almost verbatim from memset.c. */ - + int d0; unsigned long int dstp = (unsigned long int) dstpp; /* This explicit register allocation @@ -55,25 +55,25 @@ __bzero (dstpp, len) /* Fill bytes until DSTP is aligned on a longword boundary. */ asm volatile ("rep\n" "stosb" /* %0, %2, %3 */ : - "=D" (dstp) : - "0" (dstp), "c" ((-dstp) % OPSIZ), "a" (x) : - "cx"); + "=D" (dstp), "=c" (d0) : + "0" (dstp), "1" ((-dstp) % OPSIZ), "a" (x) : + "memory"); /* Fill longwords. */ asm volatile ("rep\n" "stosl" /* %0, %2, %3 */ : - "=D" (dstp) : - "0" (dstp), "c" (len / OPSIZ), "a" (x) : - "cx"); + "=D" (dstp), "=c" (d0) : + "0" (dstp), "1" (len / OPSIZ), "a" (x) : + "memory"); len %= OPSIZ; } /* Write the last few bytes. */ asm volatile ("rep\n" "stosb" /* %0, %2, %3 */ : - "=D" (dstp) : + "=D" (dstp), "=c" (d0) : "0" (dstp), "c" (len), "a" (x) : - "cx"); + "memory"); } weak_alias (__bzero, bzero) diff --git a/sysdeps/i386/memcopy.h b/sysdeps/i386/memcopy.h index 576f996957..68ce91e095 100644 --- a/sysdeps/i386/memcopy.h +++ b/sysdeps/i386/memcopy.h @@ -1,5 +1,5 @@ /* memcopy.h -- definitions for memory copy functions. i386 version. - Copyright (C) 1991, 1997 Free Software Foundation, Inc. + Copyright (C) 1991, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Torbjorn Granlund (tege@sics.se). @@ -25,19 +25,23 @@ #undef BYTE_COPY_FWD #define BYTE_COPY_FWD(dst_bp, src_bp, nbytes) \ - asm volatile(/* Clear the direction flag, so copying goes forward. */ \ - "cld\n" \ - /* Copy bytes. */ \ - "rep\n" \ - "movsb" : \ - "=D" (dst_bp), "=S" (src_bp) : \ - "0" (dst_bp), "1" (src_bp), "c" (nbytes) : \ - "cx") + do { \ + int __d0; \ + asm volatile(/* Clear the direction flag, so copying goes forward. */ \ + "cld\n" \ + /* Copy bytes. */ \ + "rep\n" \ + "movsb" : \ + "=D" (dst_bp), "=S" (src_bp), "=c" (__d0) : \ + "0" (dst_bp), "1" (src_bp), "2" (nbytes) : \ + "memory"); \ + } while (0) #undef BYTE_COPY_BWD #define BYTE_COPY_BWD(dst_ep, src_ep, nbytes) \ do \ { \ + int __d0; \ asm volatile(/* Set the direction flag, so copying goes backwards. */ \ "std\n" \ /* Copy bytes. */ \ @@ -45,9 +49,9 @@ "movsb\n" \ /* Clear the dir flag. Convention says it should be 0. */ \ "cld" : \ - "=D" (dst_ep), "=S" (src_ep) : \ - "0" (dst_ep - 1), "1" (src_ep - 1), "c" (nbytes) : \ - "cx"); \ + "=D" (dst_ep), "=S" (src_ep), "=c" (__d0) : \ + "0" (dst_ep - 1), "1" (src_ep - 1), "2" (nbytes) : \ + "memory"); \ dst_ep += 1; \ src_ep += 1; \ } while (0) @@ -56,14 +60,15 @@ #define WORD_COPY_FWD(dst_bp, src_bp, nbytes_left, nbytes) \ do \ { \ + int __d0; \ asm volatile(/* Clear the direction flag, so copying goes forward. */ \ "cld\n" \ /* Copy longwords. */ \ "rep\n" \ "movsl" : \ - "=D" (dst_bp), "=S" (src_bp) : \ - "0" (dst_bp), "1" (src_bp), "c" ((nbytes) / 4) : \ - "cx"); \ + "=D" (dst_bp), "=S" (src_bp), "=c" (__d0) : \ + "0" (dst_bp), "1" (src_bp), "2" ((nbytes) / 4) : \ + "memory"); \ (nbytes_left) = (nbytes) % 4; \ } while (0) @@ -71,6 +76,7 @@ #define WORD_COPY_BWD(dst_ep, src_ep, nbytes_left, nbytes) \ do \ { \ + int __d0; \ asm volatile(/* Set the direction flag, so copying goes backwards. */ \ "std\n" \ /* Copy longwords. */ \ @@ -78,9 +84,9 @@ "movsl\n" \ /* Clear the dir flag. Convention says it should be 0. */ \ "cld" : \ - "=D" (dst_ep), "=S" (src_ep) : \ - "0" (dst_ep - 4), "1" (src_ep - 4), "c" ((nbytes) / 4) : \ - "cx"); \ + "=D" (dst_ep), "=S" (src_ep), "=c" (__d0) : \ + "0" (dst_ep - 4), "1" (src_ep - 4), "2" ((nbytes) / 4) : \ + "memory"); \ dst_ep += 4; \ src_ep += 4; \ (nbytes_left) = (nbytes) % 4; \ diff --git a/sysdeps/i386/memset.c b/sysdeps/i386/memset.c index 0cb6578df6..e7a8bc6d73 100644 --- a/sysdeps/i386/memset.c +++ b/sysdeps/i386/memset.c @@ -1,6 +1,6 @@ /* Set a block of memory to some byte value. For Intel 80x86, x>=3. - Copyright (C) 1991, 1992, 1993, 1997 Free Software Foundation, Inc. + Copyright (C) 1991, 1992, 1993, 1997, 1998 Free Software Foundation, Inc. Contributed by Torbjorn Granlund (tege@sics.se). The GNU C Library is free software; you can redistribute it and/or @@ -28,6 +28,7 @@ void * memset (void *dstpp, int c, size_t len) { + int d0; unsigned long int dstp = (unsigned long int) dstpp; /* This explicit register allocation @@ -55,25 +56,25 @@ memset (void *dstpp, int c, size_t len) /* Fill bytes until DSTP is aligned on a longword boundary. */ asm volatile("rep\n" "stosb" /* %0, %2, %3 */ : - "=D" (dstp) : - "0" (dstp), "c" ((-dstp) % OPSIZ), "a" (x) : - "cx"); + "=D" (dstp), "=c" (d0) : + "0" (dstp), "1" ((-dstp) % OPSIZ), "a" (x) : + "memory"); /* Fill longwords. */ asm volatile("rep\n" "stosl" /* %0, %2, %3 */ : - "=D" (dstp) : - "0" (dstp), "c" (len / OPSIZ), "a" (x) : - "cx"); + "=D" (dstp), "=c" (d0) : + "0" (dstp), "1" (len / OPSIZ), "a" (x) : + "memory"); len %= OPSIZ; } /* Write the last few bytes. */ asm volatile("rep\n" "stosb" /* %0, %2, %3 */ : - "=D" (dstp) : - "0" (dstp), "c" (len), "a" (x) : - "cx"); + "=D" (dstp), "=c" (d0) : + "0" (dstp), "1" (len), "a" (x) : + "memory"); return dstpp; } |