xref: /csrg-svn/lib/libc/mips/sys/sbrk.s (revision 58280)
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*58280Sralph	ASMSTR("@(#)sbrk.s	5.3 (Berkeley) 02/26/93")
1552730Sbostic#endif /* LIBC_SCCS and not lint */
1652730Sbostic
1752730Sbostic#define	SYS_brk		17
1852730Sbostic
1957859Sralph	.data
20*58280Sralph	.globl	minbrk
21*58280Sralphminbrk:
2252730Sbostic	.word	end
23*58280Sralph	.globl	curbrk
24*58280Sralphcurbrk:
2552730Sbostic	.word	end
2652730Sbostic	.text
2752730Sbostic
2852730SbosticLEAF(sbrk)
29*58280Sralph	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
35*58280Sralph	sw	a0, curbrk	# save current val of _curbrk from above
3652730Sbostic	j	ra
3752730Sbostic1:
3852730Sbostic	j	_cerror
3952730SbosticEND(sbrk)
40