xref: /csrg-svn/lib/libc/mips/sys/sbrk.s (revision 61148)
152730Sbostic/*-
2*61148Sbostic * Copyright (c) 1991, 1993
3*61148Sbostic *	The Regents of the University of California.  All rights reserved.
452730Sbostic *
552730Sbostic * This code is derived from software contributed to Berkeley by
652730Sbostic * Ralph Campbell.
752730Sbostic *
852730Sbostic * %sccs.include.redist.c%
952730Sbostic */
1052730Sbostic
1152730Sbostic#include "SYS.h"
1252730Sbostic
1352730Sbostic#if defined(LIBC_SCCS) && !defined(lint)
14*61148Sbostic	ASMSTR("@(#)sbrk.s	8.1 (Berkeley) 06/04/93")
1552730Sbostic#endif /* LIBC_SCCS and not lint */
1652730Sbostic
1752730Sbostic#define	SYS_brk		17
1852730Sbostic
1957859Sralph	.data
2058280Sralph	.globl	minbrk
2158280Sralphminbrk:
2252730Sbostic	.word	end
2358280Sralph	.globl	curbrk
2458280Sralphcurbrk:
2552730Sbostic	.word	end
2652730Sbostic	.text
2752730Sbostic
2852730SbosticLEAF(sbrk)
2958280Sralph	lw	v1, curbrk
3052730Sbostic	li	v0, SYS_brk
3152730Sbostic	addu	a0, a0, v1	# compute current break
3252730Sbostic	syscall
3352730Sbostic	bne	a3, zero, 1f
3452730Sbostic	move	v0, v1		# return old val of _curbrk from above
3558280Sralph	sw	a0, curbrk	# save current val of _curbrk from above
3652730Sbostic	j	ra
3752730Sbostic1:
3852730Sbostic	j	_cerror
3952730SbosticEND(sbrk)
40