summaryrefslogtreecommitdiffstats
path: root/lib/libc/i386/sys/brk.S
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/i386/sys/brk.S')
-rw-r--r--lib/libc/i386/sys/brk.S58
1 files changed, 42 insertions, 16 deletions
diff --git a/lib/libc/i386/sys/brk.S b/lib/libc/i386/sys/brk.S
index f85186c..4fdf0c6 100644
--- a/lib/libc/i386/sys/brk.S
+++ b/lib/libc/i386/sys/brk.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,60 @@
* 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 "@(#)brk.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 curbrk
- .globl minbrk
+ .globl HIDENAME(curbrk)
+ .globl HIDENAME(minbrk)
ENTRY(_brk)
jmp ok
ENTRY(brk)
+#ifdef PIC
+ movl 4(%esp),%eax
+ PIC_PROLOGUE
+ movl PIC_GOT(HIDENAME(curbrk)),%edx # set up GOT addressing
+ movl PIC_GOT(HIDENAME(minbrk)),%ecx #
+ PIC_EPILOGUE
+ cmpl %eax,(%ecx)
+ jbe ok
+ movl (%ecx),%eax
+ movl %eax,4(%esp)
+ok:
+ lea SYS_break,%eax
+ KERNCALL
+ jb err
+ movl 4(%esp),%eax
+ movl %eax,(%edx)
+ movl $0,%eax
+ ret
+err:
+ PIC_PROLOGUE
+ jmp PIC_PLT(HIDENAME(cerror))
+
+#else
+
movl 4(%esp),%eax
- cmpl %eax,minbrk
- jl ok
- movl minbrk,%eax
+ cmpl %eax,HIDENAME(minbrk)
+ jbe ok
+ movl HIDENAME(minbrk),%eax
movl %eax,4(%esp)
ok:
- lea SYS_brk,%eax
- LCALL(7,0)
+ lea SYS_break,%eax
+ KERNCALL
jb err
movl 4(%esp),%eax
- movl %eax,curbrk
+ movl %eax,HIDENAME(curbrk)
movl $0,%eax
ret
err:
- jmp cerror
+ jmp HIDENAME(cerror)
+#endif
OpenPOWER on IntegriCloud