xref: /original-bsd/lib/libc/mips/sys/sbrk.s (revision ea3a8ee8)
1/*-
2 * Copyright (c) 1991 The Regents of the University of California.
3 * 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	5.2 (Berkeley) 02/04/93")
15#endif /* LIBC_SCCS and not lint */
16
17#define	SYS_brk		17
18
19	.data
20	.globl	_minbrk
21_minbrk:
22	.word	end
23	.globl	_curbrk
24_curbrk:
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