diff options
author | phk <phk@FreeBSD.org> | 1995-10-04 15:58:57 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1995-10-04 15:58:57 +0000 |
commit | b895ae5b59f7ef26e055a29a17f276194be4e670 (patch) | |
tree | d55031e8897d66db05d1474a538727393c274be8 /lib/libc/i386/sys | |
parent | 8b107cd7a8f65436e7abaeb4853b2e4980f8bbd2 (diff) | |
download | FreeBSD-src-b895ae5b59f7ef26e055a29a17f276194be4e670.zip FreeBSD-src-b895ae5b59f7ef26e055a29a17f276194be4e670.tar.gz |
Calling sbrk(2) with zero argument doesn't need to generate a syscall.
Reviewed by: bde
Diffstat (limited to 'lib/libc/i386/sys')
-rw-r--r-- | lib/libc/i386/sys/sbrk.S | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/libc/i386/sys/sbrk.S b/lib/libc/i386/sys/sbrk.S index b0324ae..2d65b59 100644 --- a/lib/libc/i386/sys/sbrk.S +++ b/lib/libc/i386/sys/sbrk.S @@ -33,12 +33,12 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sbrk.S,v 1.1 1994/08/05 01:18:49 wollman Exp $ + * $Id: sbrk.S,v 1.2 1995/01/23 01:30:04 davidg Exp $ */ #if defined(SYSLIBC_RCS) && !defined(lint) .text - .asciz "$Id$" + .asciz "$Id: sbrk.S,v 1.2 1995/01/23 01:30:04 davidg Exp $" #endif /* SYSLIBC_RCS and not lint */ #include "SYS.h" @@ -61,6 +61,8 @@ ENTRY(sbrk) movl PIC_GOT(curbrk),%edx movl (%edx),%eax PIC_EPILOGUE + testl %ecx,%ecx + jz back addl %eax,4(%esp) lea SYS_brk,%eax LCALL(7,0) @@ -70,21 +72,25 @@ ENTRY(sbrk) movl (%edx),%eax addl %ecx,(%edx) PIC_EPILOGUE +back: ret err: jmp PIC_PLT(cerror) -#else +#else /* !PIC */ movl 4(%esp),%ecx movl curbrk,%eax + testl %ecx,%ecx + jz back addl %eax,4(%esp) lea SYS_brk,%eax LCALL(7,0) jb err movl curbrk,%eax addl %ecx,curbrk +back: ret err: jmp cerror -#endif +#endif /* PIC */ |