167117Sdfr/*	$NetBSD: sbrk.S,v 1.4 1996/10/17 03:08:20 cgd Exp $	*/
267117Sdfr
367117Sdfr/*
467117Sdfr * Copyright (c) 1994, 1995 Carnegie-Mellon University.
567117Sdfr * All rights reserved.
667117Sdfr *
767117Sdfr * Author: Chris G. Demetriou
867117Sdfr *
967117Sdfr * Permission to use, copy, modify and distribute this software and
1067117Sdfr * its documentation is hereby granted, provided that both the copyright
1167117Sdfr * notice and this permission notice appear in all copies of the
1267117Sdfr * software, derivative works or modified versions, and any portions
1367117Sdfr * thereof, and that both notices appear in supporting documentation.
1467117Sdfr *
1567117Sdfr * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
1667117Sdfr * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
1767117Sdfr * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
1867117Sdfr *
1967117Sdfr * Carnegie Mellon requests users of this software to return to
2067117Sdfr *
2167117Sdfr *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
2267117Sdfr *  School of Computer Science
2367117Sdfr *  Carnegie Mellon University
2467117Sdfr *  Pittsburgh PA 15213-3890
2567117Sdfr *
2667117Sdfr * any improvements or extensions that they make and grant Carnegie the
2767117Sdfr * rights to redistribute these changes.
2867117Sdfr */
2967117Sdfr
30111777Sobrien#include <machine/asm.h>
31111777Sobrien__FBSDID("$FreeBSD$");
32111777Sobrien
3367117Sdfr#include "SYS.h"
3467117Sdfr
3567117Sdfr	.globl	_end
3667117Sdfr
3767117Sdfr	.data
3867117SdfrEXPORT(curbrk)
3967117Sdfr	.quad	_end
4067117Sdfr
4167117Sdfr	.text
4267117SdfrENTRY(sbrk, 1)
43102298Smarcel	add	r14 = @ltoff(curbrk), gp
44102298Smarcel	;;
45102298Smarcel	ld8	r14 = [r14]
46115084Smarcel	cmp.eq	p6, p0 = r32, r0
47102298Smarcel	;;
48102298Smarcel	ld8	ret0 = [r14]
49102298Smarcel(p6)	br.ret.sptk.few	rp
50102298Smarcel	;;
51115084Smarcel	add	r32 = ret0, r32
52115084Smarcel	;;
53115084Smarcel	st8	[sp] = r32
5467117Sdfr	CALLSYS_ERROR(break)
55115084Smarcel	ld8	r15 = [sp]
56102298Smarcel	add	r14 = @ltoff(curbrk), gp
57102298Smarcel	;;
58102298Smarcel	ld8	r14 = [r14]
59102298Smarcel	;;
60102298Smarcel	ld8	ret0 = [r14]
61115084Smarcel	st8	[r14] = r15
62102298Smarcel	br.ret.sptk.few	rp
6367117SdfrEND(sbrk)
64