xref: /titanic_41/usr/src/lib/libbc/libc/sys/common/sparc/brk.s (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1!
2! CDDL HEADER START
3!
4! The contents of this file are subject to the terms of the
5! Common Development and Distribution License, Version 1.0 only
6! (the "License").  You may not use this file except in compliance
7! with the License.
8!
9! You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10! or http://www.opensolaris.org/os/licensing.
11! See the License for the specific language governing permissions
12! and limitations under the License.
13!
14! When distributing Covered Code, include this CDDL HEADER in each
15! file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16! If applicable, add the following below this CDDL HEADER, with the
17! fields enclosed by brackets "[]" replaced with your own identifying
18! information: Portions Copyright [yyyy] [name of copyright owner]
19!
20! CDDL HEADER END
21!
22!	"%Z%%M%	%I%	%E% SMI"
23!	Copyright (c) 1986 by Sun Microsystems, Inc.
24!
25	.seg	".text"
26
27#include "SYS.h"
28#define ALIGNSIZE	8
29
30#define	SYS_brk		17
31
32	.global .curbrk
33	.type	.curbrk,#object
34	.size	.curbrk,4
35
36	ENTRY(brk)
37	add	%o0, (ALIGNSIZE-1), %o0	! round up new break to a
38	andn	%o0, (ALIGNSIZE-1), %o0	! multiple of alignsize
39	mov	%o0, %o2		! save new break
40	mov	SYS_brk, %g1
41	t	8
42	CERROR(o5)
43#ifdef PIC
44	PIC_SETUP(o5)
45	ld	[%o5 + .curbrk], %g1
46	st	%o2, [%g1]
47#else
48	sethi	%hi(.curbrk), %g1	! save new break
49	st	%o2, [%g1 + %lo(.curbrk)]
50#endif
51	RET
52	SET_SIZE(brk)
53