Fix mdoc(7)/man(7) mix up.
[netbsd-mini2440.git] / lib / libc / arch / powerpc64 / sys / brk.S
blob71f336d28fc73cd69b644827c15691e2658da0d6
1 /*      $NetBSD: brk.S,v 1.2 2006/07/06 17:05:04 ross Exp $     */
3 #include "SYS.h"
5         .globl  _C_LABEL(__curbrk)
6         .globl  _C_LABEL(__minbrk)
7         .globl  _C_LABEL(_end)
9 #ifdef WEAK_ALIAS
10 WEAK_ALIAS(brk, _brk)
11 #endif
13         .macro  LdAddr  r,sym
14         .pushsection    ".toc","aw"
15 100:    .tc \sym[TC],\sym
16         .popsection
17         ld      \r,100b@toc(2)
18         .endm
20         .data
21 _C_LABEL(__minbrk):
22         .long   _C_LABEL(_end)      
23         .text
25 ENTRY(_brk)
26         LdAddr  %r5,_end
27         cmpld   %r5,%r3                 # if (&_end <= r3)
28         bgt     0f
29         mr      %r5,%r3                 # r5 = r3
31         mr      %r3,%r5                 # new break value
32         li      %r0,SYS_break
33         sc                              # assume, that r5 is kept
34         bso     1f
35         LdAddr  %r6,__curbrk
36         std     %r5,0(%r6)
37         blr                             # return 0
40         b       .__cerror