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