Sync usage with man page.
[netbsd-mini2440.git] / lib / libc / arch / powerpc64 / sys / sbrk.S
blobbe9cd8e37beb5b6fe55b40977af12f1a24f0a237
1 /*      $NetBSD: sbrk.S,v 1.2 2006/07/05 18:28:43 ross 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
13         .data
14 _C_LABEL(__curbrk):
15         .long   _C_LABEL(_end)
16         .text
18         .macro  LdAddr  r,sym
19         .pushsection    ".toc","aw"
20 100:    .tc \sym[TC],\sym
21         .popsection
22         ld      \r,100b@toc(2)
23         .endm
25 ENTRY(_sbrk)
26         ldAddr  %r6,__curbrk
27         add     %r3,%r3,%r6
28         mr      %r7,%r3                         # r7 = new break
29         li      %r0,SYS_break
30         sc                                      # break(new_break)
31         bso     1f
32         mr      %r3,%r6                         # set return value
33         LdAddr  %r6,__curbrk
34         std     %r7,0(%r6)
35         blr
37         b       PIC_PLT(_C_LABEL(__cerror))