xref: /csrg-svn/lib/libc/mips/sys/sbrk.s (revision 52730)
1*52730Sbostic/*-
2*52730Sbostic * Copyright (c) 1991 The Regents of the University of California.
3*52730Sbostic * All rights reserved.
4*52730Sbostic *
5*52730Sbostic * This code is derived from software contributed to Berkeley by
6*52730Sbostic * Ralph Campbell.
7*52730Sbostic *
8*52730Sbostic * %sccs.include.redist.c%
9*52730Sbostic */
10*52730Sbostic
11*52730Sbostic#include "SYS.h"
12*52730Sbostic
13*52730Sbostic#if defined(LIBC_SCCS) && !defined(lint)
14*52730Sbostic	ASMSTR("@(#)sbrk.s	5.1 (Berkeley) 02/29/92")
15*52730Sbostic#endif /* LIBC_SCCS and not lint */
16*52730Sbostic
17*52730Sbostic#define	SYS_brk		17
18*52730Sbostic
19*52730Sbostic	.sdata
20*52730Sbostic	.globl	_minbrk
21*52730Sbostic_minbrk:
22*52730Sbostic	.word	end
23*52730Sbostic	.globl	_curbrk
24*52730Sbostic_curbrk:
25*52730Sbostic	.word	end
26*52730Sbostic	.text
27*52730Sbostic
28*52730SbosticLEAF(sbrk)
29*52730Sbostic	lw	v1, _curbrk
30*52730Sbostic	li	v0, SYS_brk
31*52730Sbostic	addu	a0, a0, v1	# compute current break
32*52730Sbostic	syscall
33*52730Sbostic	bne	a3, zero, 1f
34*52730Sbostic	move	v0, v1		# return old val of _curbrk from above
35*52730Sbostic	sw	a0, _curbrk	# save current val of _curbrk from above
36*52730Sbostic	j	ra
37*52730Sbostic1:
38*52730Sbostic	j	_cerror
39*52730SbosticEND(sbrk)
40