xref: /csrg-svn/lib/libc/mips/sys/brk.s (revision 52723)
1*52723Sbostic/*-
2*52723Sbostic * Copyright (c) 1991 The Regents of the University of California.
3*52723Sbostic * All rights reserved.
4*52723Sbostic *
5*52723Sbostic * This code is derived from software contributed to Berkeley by
6*52723Sbostic * Ralph Campbell.
7*52723Sbostic *
8*52723Sbostic * %sccs.include.redist.c%
9*52723Sbostic */
10*52723Sbostic
11*52723Sbostic#include "SYS.h"
12*52723Sbostic
13*52723Sbostic#if defined(LIBC_SCCS) && !defined(lint)
14*52723Sbostic	ASMSTR("@(#)brk.s	5.1 (Berkeley) 02/29/92")
15*52723Sbostic#endif /* LIBC_SCCS and not lint */
16*52723Sbostic
17*52723Sbostic#define	SYS_brk		17
18*52723Sbostic
19*52723SbosticLEAF(brk)
20*52723Sbostic	lw	v0, _minbrk
21*52723Sbostic	bgeu	a0, v0, _brk
22*52723Sbostic	move	a0, v0		# don't allow break < minbrk
23*52723SbosticALEAF(_brk)
24*52723Sbostic	li	v0, SYS_brk
25*52723Sbostic	syscall
26*52723Sbostic	bne	a3, zero, 1f
27*52723Sbostic	sw	a0, _curbrk
28*52723Sbostic	move	v0, zero
29*52723Sbostic	j	ra
30*52723Sbostic1:
31*52723Sbostic	j	_cerror
32*52723SbosticEND(brk)
33