2N/A!
2N/A! CDDL HEADER START
2N/A!
2N/A! The contents of this file are subject to the terms of the
2N/A! Common Development and Distribution License, Version 1.0 only
2N/A! (the "License"). You may not use this file except in compliance
2N/A! with the License.
2N/A!
2N/A! You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A! or http://www.opensolaris.org/os/licensing.
2N/A! See the License for the specific language governing permissions
2N/A! and limitations under the License.
2N/A!
2N/A! When distributing Covered Code, include this CDDL HEADER in each
2N/A! file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A! If applicable, add the following below this CDDL HEADER, with the
2N/A! fields enclosed by brackets "[]" replaced with your own identifying
2N/A! information: Portions Copyright [yyyy] [name of copyright owner]
2N/A!
2N/A! CDDL HEADER END
2N/A!
2N/A! "%Z%%M% %I% %E% SMI"
2N/A! Copyright (c) 1986 by Sun Microsystems, Inc.
2N/A!
2N/A! .seg "text"
2N/A
2N/A .file "sbrk.s"
2N/A
2N/A#include "SYS.h"
2N/A#include <sys/syscall.h>
2N/A
2N/A#define ALIGNSIZE 8
2N/A
2N/A .global .curbrk
2N/A .type .curbrk,#object
2N/A .size .curbrk,4
2N/A
2N/A .global end
2N/A .section ".data"
2N/A .align 4
2N/A.curbrk:
2N/A .word end
2N/A
2N/A ENTRY(sbrk)
2N/A add %o0, (ALIGNSIZE-1), %o0 ! round up request to align size
2N/A andn %o0, (ALIGNSIZE-1), %o0
2N/A#ifdef PIC
2N/A PIC_SETUP(o5)
2N/A ld [%o5 + .curbrk], %g1
2N/A ld [%g1], %o3
2N/A#else
2N/A sethi %hi(.curbrk), %o2
2N/A ld [%o2 + %lo(.curbrk)], %o3
2N/A#endif
2N/A add %o3, (ALIGNSIZE-1), %o3 ! round up .curbrk to align size
2N/A andn %o3, (ALIGNSIZE-1), %o3
2N/A add %o3, %o0, %o0 ! new break setting = request + .curbrk
2N/A mov %o0, %o4 ! save it
2N/A mov SYS_brk, %g1
2N/A t 8
2N/A CERROR(o5)
2N/A#ifdef PIC
2N/A PIC_SETUP(o5)
2N/A ld [%o5 + .curbrk], %g1
2N/A st %o4, [%g1]
2N/A#else
2N/A st %o4, [%o2 + %lo(.curbrk)] ! store new break in .curbrk
2N/A#endif
2N/A retl
2N/A mov %o3, %o0 ! return old break
2N/A SET_SIZE(sbrk)
2N/A