brk.S revision 92999
11849Swollman/*- 21849Swollman * Copyright (c) 1990 The Regents of the University of California. 31849Swollman * All rights reserved. 41849Swollman * 51849Swollman * This code is derived from software contributed to Berkeley by 61849Swollman * William Jolitz. 71849Swollman * 81849Swollman * Redistribution and use in source and binary forms, with or without 91849Swollman * modification, are permitted provided that the following conditions 101849Swollman * are met: 111849Swollman * 1. Redistributions of source code must retain the above copyright 121849Swollman * notice, this list of conditions and the following disclaimer. 131849Swollman * 2. Redistributions in binary form must reproduce the above copyright 141849Swollman * notice, this list of conditions and the following disclaimer in the 151849Swollman * documentation and/or other materials provided with the distribution. 161849Swollman * 3. All advertising materials mentioning features or use of this software 171849Swollman * must display the following acknowledgement: 181849Swollman * This product includes software developed by the University of 191849Swollman * California, Berkeley and its contributors. 201849Swollman * 4. Neither the name of the University nor the names of its contributors 211849Swollman * may be used to endorse or promote products derived from this software 221849Swollman * without specific prior written permission. 231849Swollman * 241849Swollman * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 251849Swollman * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 261849Swollman * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 271849Swollman * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 281849Swollman * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 291849Swollman * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 301849Swollman * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 311849Swollman * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 321849Swollman * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 331849Swollman * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 341849Swollman * SUCH DAMAGE. 351849Swollman */ 361849Swollman 3792999Sobrien#if defined(SYSLIBC_SCCS) && !defined(lint) 3892999Sobrien .asciz "@(#)brk.s 5.2 (Berkeley) 12/17/90" 3992999Sobrien#endif /* SYSLIBC_SCCS and not lint */ 4092999Sobrien#include <machine/asm.h> 4192999Sobrien__FBSDID("$FreeBSD: head/lib/libc/i386/sys/brk.S 92999 2002-03-23 02:10:28Z obrien $"); 421849Swollman 431849Swollman#include "SYS.h" 441849Swollman 4515634Speter .globl HIDENAME(curbrk) 4615634Speter .globl HIDENAME(minbrk) 471849SwollmanENTRY(_brk) 481849Swollman jmp ok 491849Swollman 501849SwollmanENTRY(brk) 511849Swollman#ifdef PIC 521849Swollman movl 4(%esp),%eax 531849Swollman PIC_PROLOGUE 5415634Speter movl PIC_GOT(HIDENAME(curbrk)),%edx # set up GOT addressing 5515634Speter movl PIC_GOT(HIDENAME(minbrk)),%ecx # 5616719Sbde PIC_EPILOGUE 571849Swollman cmpl %eax,(%ecx) 5816719Sbde jbe ok 591849Swollman movl (%ecx),%eax 601849Swollman movl %eax,4(%esp) 611849Swollmanok: 6287006Sjhb mov $SYS_break,%eax 6315634Speter KERNCALL 641849Swollman jb err 651849Swollman movl 4(%esp),%eax 661849Swollman movl %eax,(%edx) 671849Swollman movl $0,%eax 681849Swollman ret 691849Swollmanerr: 7015634Speter PIC_PROLOGUE 7115634Speter jmp PIC_PLT(HIDENAME(cerror)) 721849Swollman 731849Swollman#else 741849Swollman 751849Swollman movl 4(%esp),%eax 7615634Speter cmpl %eax,HIDENAME(minbrk) 7716719Sbde jbe ok 7815634Speter movl HIDENAME(minbrk),%eax 791849Swollman movl %eax,4(%esp) 801849Swollmanok: 8187006Sjhb mov $SYS_break,%eax 8215634Speter KERNCALL 831849Swollman jb err 841849Swollman movl 4(%esp),%eax 8515634Speter movl %eax,HIDENAME(curbrk) 861849Swollman movl $0,%eax 871849Swollman ret 881849Swollmanerr: 8915634Speter jmp HIDENAME(cerror) 901849Swollman#endif 91