diff options
Diffstat (limited to 'lib/libc/i386/sys/sbrk.S')
-rw-r--r-- | lib/libc/i386/sys/sbrk.S | 66 |
1 files changed, 48 insertions, 18 deletions
diff --git a/lib/libc/i386/sys/sbrk.S b/lib/libc/i386/sys/sbrk.S index 7fecd93..a3afd89 100644 --- a/lib/libc/i386/sys/sbrk.S +++ b/lib/libc/i386/sys/sbrk.S @@ -1,6 +1,6 @@ /*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. + * Copyright (c) 1990 The Regents of the University of California. + * All rights reserved. * * This code is derived from software contributed to Berkeley by * William Jolitz. @@ -32,34 +32,64 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $Id$ */ -#if defined(SYSLIBC_SCCS) && !defined(lint) - .asciz "@(#)sbrk.s 8.1 (Berkeley) 6/4/93" -#endif /* SYSLIBC_SCCS and not lint */ +#if defined(SYSLIBC_RCS) && !defined(lint) + .text + .asciz "$Id$" +#endif /* SYSLIBC_RCS and not lint */ #include "SYS.h" -#define SYS_brk 17 - - .globl _end - .globl minbrk - .globl curbrk + .globl CNAME(end) + .globl HIDENAME(minbrk) + .globl HIDENAME(curbrk) .data -minbrk: .long _end -curbrk: .long _end +HIDENAME(minbrk): .long CNAME(end) +HIDENAME(curbrk): .long CNAME(end) .text ENTRY(sbrk) +#ifdef PIC + movl 4(%esp),%ecx + PIC_PROLOGUE + movl PIC_GOT(HIDENAME(curbrk)),%edx + movl (%edx),%eax + PIC_EPILOGUE + testl %ecx,%ecx + jz back + addl %eax,4(%esp) + lea SYS_break,%eax + KERNCALL + jb err + PIC_PROLOGUE + movl PIC_GOT(HIDENAME(curbrk)),%edx + movl (%edx),%eax + addl %ecx,(%edx) + PIC_EPILOGUE +back: + ret +err: + PIC_PROLOGUE + jmp PIC_PLT(HIDENAME(cerror)) + +#else /* !PIC */ + movl 4(%esp),%ecx - movl curbrk,%eax + movl HIDENAME(curbrk),%eax + testl %ecx,%ecx + jz back addl %eax,4(%esp) - lea SYS_brk,%eax - LCALL(7,0) + lea SYS_break,%eax + KERNCALL jb err - movl curbrk,%eax - addl %ecx,curbrk + movl HIDENAME(curbrk),%eax + addl %ecx,HIDENAME(curbrk) +back: ret err: - jmp cerror + jmp HIDENAME(cerror) +#endif /* PIC */ |