convert remaining ppc32 code to ppc64

This commit is contained in:
ross 2006-07-05 18:28:43 +00:00
parent 0584742537
commit 3fbcafa1c9
1 changed files with 12 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbrk.S,v 1.1 2006/07/01 16:37:20 ross Exp $ */
/* $NetBSD: sbrk.S,v 1.2 2006/07/05 18:28:43 ross Exp $ */
#include "SYS.h"
@ -9,34 +9,29 @@
WEAK_ALIAS(sbrk, _sbrk)
#endif
.data
_C_LABEL(__curbrk):
.long _C_LABEL(_end)
.text
.macro LdAddr r,sym
.pushsection ".toc","aw"
100: .tc sym[TC],sym
.popsection
ld \r,100b@toc(2)
.endm
ENTRY(_sbrk)
#ifdef PIC
mflr %r10
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr %r5
mtlr %r10
lwz %r5,_C_LABEL(__curbrk)@got(%r5)
lwz %r6,0(%r5)
#else
lis %r5,_C_LABEL(__curbrk)@ha
lwz %r6,_C_LABEL(__curbrk)@l(%r5) # r6 = old break
#endif
ldAddr %r6,__curbrk
add %r3,%r3,%r6
mr %r7,%r3 # r7 = new break
li %r0,SYS_break
sc # break(new_break)
bso 1f
mr %r3,%r6 # set return value
#ifdef PIC
stw %r7,0(%r5)
#else
stw %r7,_C_LABEL(__curbrk)@l(%r5) # record new break
#endif
LdAddr %r6,__curbrk
std %r7,0(%r6)
blr
1:
b PIC_PLT(_C_LABEL(__cerror))