Sync usage with man page.
[netbsd-mini2440.git] / lib / libc / arch / powerpc / sys / sbrk.S
blobdd9522ae86235ff6b9ddec8faf4d8bcfa92c7793
1 /*      $NetBSD: sbrk.S,v 1.8 2000/06/26 06:25:44 kleink Exp $  */
3 #include "SYS.h"
5         .globl  _C_LABEL(__curbrk)
6         .globl  _C_LABEL(_end)
8 #ifdef WEAK_ALIAS
9 WEAK_ALIAS(sbrk, _sbrk)
10 #endif
12         .data
13 _C_LABEL(__curbrk):
14         .long   _C_LABEL(_end)
15         .text
17 ENTRY(_sbrk)
18 #ifdef PIC
19         mflr    %r10
20         bl      _GLOBAL_OFFSET_TABLE_@local-4
21         mflr    %r5
22         mtlr    %r10
23         lwz     %r5,_C_LABEL(__curbrk)@got(%r5)
24         lwz     %r6,0(%r5)
25 #else
26         lis     %r5,_C_LABEL(__curbrk)@ha
27         lwz     %r6,_C_LABEL(__curbrk)@l(%r5)   # r6 = old break
28 #endif
29         add     %r3,%r3,%r6
30         mr      %r7,%r3                         # r7 = new break
31         li      %r0,SYS_break
32         sc                                      # break(new_break)
33         bso     1f
34         mr      %r3,%r6                         # set return value
35 #ifdef PIC
36         stw     %r7,0(%r5)
37 #else
38         stw     %r7,_C_LABEL(__curbrk)@l(%r5)   # record new break
39 #endif
40         blr
42         b       PIC_PLT(_C_LABEL(__cerror))