xref: /original-bsd/lib/libc/i386/sys/brk.s (revision c3e32dec)
1/*-
2 * Copyright (c) 1990, 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 * William Jolitz.
7 *
8 * %sccs.include.redist.c%
9 */
10
11#if defined(SYSLIBC_SCCS) && !defined(lint)
12	.asciz "@(#)brk.s	8.1 (Berkeley) 06/04/93"
13#endif /* SYSLIBC_SCCS and not lint */
14
15#include "SYS.h"
16
17#define	SYS_brk		17
18
19	.globl	curbrk
20	.globl	minbrk
21ENTRY(_brk)
22	jmp	ok
23
24ENTRY(brk)
25	movl	4(%esp),%eax
26	cmpl	%eax,minbrk
27	jl	ok
28	movl	minbrk,%eax
29	movl	%eax,4(%esp)
30ok:
31	lea	SYS_brk,%eax
32	LCALL(7,0)
33	jb	err
34	movl	4(%esp),%eax
35	movl	%eax,curbrk
36	movl	$0,%eax
37	ret
38err:
39	jmp	cerror
40