]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/unix/sysv/linux/alpha/brk.S
update from 961105, second try
[thirdparty/glibc.git] / sysdeps / unix / sysv / linux / alpha / brk.S
CommitLineData
a5113b14 1/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
b20e47cb
RM
2 Contributed by Brendan Kehoe (brendan@zen.org).
3
4The GNU C Library is free software; you can redistribute it and/or
5modify it under the terms of the GNU Library General Public License as
6published by the Free Software Foundation; either version 2 of the
7License, or (at your option) any later version.
8
9The GNU C Library is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12Library General Public License for more details.
13
14You should have received a copy of the GNU Library General Public
15License along with the GNU C Library; see the file COPYING.LIB. If
16not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17Cambridge, MA 02139, USA. */
18
19/* __brk is a special syscall under Linux since it never returns an
20error. Instead, the error condition is indicated by returning the old
21break value (instead of the new, requested one). */
22
23#include <sysdep.h>
1f64ac13 24#define _ERRNO_H
b20e47cb
RM
25#include <errnos.h>
26
a5113b14
UD
27#ifdef PIC
28.section .bss
29 .align 3
30 .globl __curbrk
31__curbrk: .skip 8
32 .type __curbrk,@object
33 .size __curbrk,8
34#else
84724245 35.comm __curbrk, 8
a5113b14 36#endif
b20e47cb
RM
37
38 .text
510ca033 39LEAF(__brk, 0)
b20e47cb 40 ldgp gp, 0(t12)
b5791037
UD
41#ifdef PROF
42 lda AT, _mcount
43 jsr AT, (AT), _mcount
44#endif
b20e47cb
RM
45 .prologue 1
46
a1470b6f 47 ldiq v0, __NR_brk
b20e47cb 48 call_pal PAL_callsys
84724245
RM
49
50 /* Correctly handle the brk(0) query case. */
51 cmoveq a0, v0, a0
52
b20e47cb 53 subq a0, v0, t0
510ca033 54 bne t0, error
b20e47cb
RM
55
56 /* Update __curbrk and return cleanly. */
84724245 57 stq a0, __curbrk
510ca033 58 mov zero, v0
b20e47cb
RM
59 ret
60
61 /* What a horrible way to die. */
62error: ldi v0, ENOMEM
a1470b6f 63 jmp zero, __syscall_error
b20e47cb 64
84724245 65 END(__brk)
b20e47cb
RM
66
67weak_alias (__brk, brk)