xref: /original-bsd/lib/libc/i386/sys/sbrk.s (revision b3f911e0)
1/*-
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * William Jolitz.
7 *
8 * %sccs.include.redist.c%
9 */
10
11#if defined(SYSLIBC_SCCS) && !defined(lint)
12	.asciz "@(#)sbrk.s	5.1 (Berkeley) 04/23/90"
13#endif /* SYSLIBC_SCCS and not lint */
14
15#include "SYS.h"
16
17#define	SYS_brk		17
18
19	.globl	_end
20	.globl	minbrk
21	.globl	curbrk
22
23	.data
24minbrk:	.long	_end
25curbrk:	.long	_end
26	.text
27
28ENTRY(sbrk)
29	movl	4(%esp),%ecx
30	movl	curbrk,%eax
31	addl	%eax,4(%esp)
32	lea	SYS_brk,%eax
33	LCALL(7,0)
34	jb	err
35	movl	curbrk,%eax
36	addl	%ecx,curbrk
37	ret
38err:
39	jmp	cerror
40