xref: /csrg-svn/lib/libc/mips/sys/sbrk.s (revision 57859)
152730Sbostic/*-
252730Sbostic * Copyright (c) 1991 The Regents of the University of California.
352730Sbostic * 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*57859Sralph	ASMSTR("@(#)sbrk.s	5.2 (Berkeley) 02/04/93")
1552730Sbostic#endif /* LIBC_SCCS and not lint */
1652730Sbostic
1752730Sbostic#define	SYS_brk		17
1852730Sbostic
19*57859Sralph	.data
2052730Sbostic	.globl	_minbrk
2152730Sbostic_minbrk:
2252730Sbostic	.word	end
2352730Sbostic	.globl	_curbrk
2452730Sbostic_curbrk:
2552730Sbostic	.word	end
2652730Sbostic	.text
2752730Sbostic
2852730SbosticLEAF(sbrk)
2952730Sbostic	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
3552730Sbostic	sw	a0, _curbrk	# save current val of _curbrk from above
3652730Sbostic	j	ra
3752730Sbostic1:
3852730Sbostic	j	_cerror
3952730SbosticEND(sbrk)
40