brk.S revision 85518
185518Sjake/*
285518Sjake * Copyright (c) 1992, 1993
385518Sjake *	The Regents of the University of California.  All rights reserved.
485518Sjake *
585518Sjake * This software was developed by the Computer Systems Engineering group
685518Sjake * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
785518Sjake * contributed to Berkeley.
885518Sjake *
985518Sjake * Redistribution and use in source and binary forms, with or without
1085518Sjake * modification, are permitted provided that the following conditions
1185518Sjake * are met:
1285518Sjake * 1. Redistributions of source code must retain the above copyright
1385518Sjake *    notice, this list of conditions and the following disclaimer.
1485518Sjake * 2. Redistributions in binary form must reproduce the above copyright
1585518Sjake *    notice, this list of conditions and the following disclaimer in the
1685518Sjake *    documentation and/or other materials provided with the distribution.
1785518Sjake * 3. All advertising materials mentioning features or use of this software
1885518Sjake *    must display the following acknowledgement:
1985518Sjake *	This product includes software developed by the University of
2085518Sjake *	California, Berkeley and its contributors.
2185518Sjake * 4. Neither the name of the University nor the names of its contributors
2285518Sjake *    may be used to endorse or promote products derived from this software
2385518Sjake *    without specific prior written permission.
2485518Sjake *
2585518Sjake * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2685518Sjake * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2785518Sjake * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2885518Sjake * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2985518Sjake * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3085518Sjake * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3185518Sjake * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3285518Sjake * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3385518Sjake * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3485518Sjake * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3585518Sjake * SUCH DAMAGE.
3685518Sjake *
3785518Sjake * from: Header: brk.s,v 1.3 92/06/25 12:56:05 mccanne Exp
3885518Sjake */
3985518Sjake
4085518Sjake#if defined(SYSLIBC_SCCS) && !defined(lint)
4185518Sjake#if 0
4285518Sjake	.asciz "@(#)brk.s	8.1 (Berkeley) 6/4/93"
4385518Sjake#else
4485518Sjake	RCSID("$NetBSD: brk.S,v 1.9 2000/07/25 20:15:40 mycroft Exp $")
4585518Sjake#endif
4685518Sjake#endif /* SYSLIBC_SCCS and not lint */
4785518Sjake
4885518Sjake#if defined(SYSLIBC_RCS) && !defined(lint)
4985518Sjake	.text
5085518Sjake	.asciz "$FreeBSD: head/lib/libc/sparc64/sys/brk.S 85518 2001-10-26 05:40:07Z jake $"
5185518Sjake#endif /* SYSLIBC_RCS and not lint */
5285518Sjake
5385518Sjake#include "SYS.h"
5485518Sjake
5585518Sjake	.globl	HIDENAME(curbrk)
5685518Sjake	.globl	HIDENAME(minbrk)
5785518Sjake
5885518Sjake_SYSENTRY(brk)
5985518Sjake	PIC_PROLOGUE(%o3, %o2)
6085518Sjake	SET(HIDENAME(minbrk), %o2, %o3)
6185518Sjake	ldx	[%o3], %o4
6285518Sjake	cmp	%o4, %o0
6385518Sjake	movg	%xcc, %o4, %o0
6485518Sjake	mov	%o0, %o4
6585518Sjake	mov	SYS_break, %g1
6685518Sjake	ta	%xcc, ST_SYSCALL
6785518Sjake	bcc,a,pt %xcc, 1f
6885518Sjake	 nop
6985518Sjake	ERROR()
7085518Sjake1:	SET(HIDENAME(curbrk), %o2, %o3)
7185518Sjake	retl
7285518Sjake	 stx	%o4, [%o3]
73