Add PIC version.

This commit is contained in:
tsubai 1998-11-24 11:14:54 +00:00
parent 0298a4dd05
commit 106908bdb8
8 changed files with 58 additions and 26 deletions

View File

@ -1,17 +1,26 @@
/* $NetBSD: brk.S,v 1.3 1998/05/25 15:35:06 ws Exp $ */
/* $NetBSD: brk.S,v 1.4 1998/11/24 11:14:54 tsubai Exp $ */
#include "SYS.h"
.globl _ASM_LABEL(curbrk)
.globl minbrk
.data
minbrk: .long _C_LABEL(end) # XXX not used yet
.text
#ifdef PIC
XXX
#else
ENTRY(brk)
#ifdef PIC
mflr 10
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr 9
mtlr 10
lwz 5,_C_LABEL(end)@got(9)
#else
lis 5,_C_LABEL(end)@ha # r5 = &_end
addi 5,5,_C_LABEL(end)@l
#endif
cmplw 5,3 # if (&_end <= r3)
bgt 0f
mr 5,3 # r5 = r3
@ -20,10 +29,14 @@ ENTRY(brk)
li 0,SYS_break
sc # assume, that r5 is kept
bso 1f
#ifdef PIC
lwz 6,_ASM_LABEL(curbrk)@got(9)
stw 5,0(6)
#else
lis 6,_ASM_LABEL(curbrk)@ha # record new break
stw 5,_ASM_LABEL(curbrk)@l(6)
#endif
blr # return 0
1:
b _ASM_LABEL(cerror)
#endif
b PIC_PLT(_ASM_LABEL(cerror))

View File

@ -1,4 +1,4 @@
/* $NetBSD: cerror.S,v 1.2 1998/05/25 15:28:03 ws Exp $ */
/* $NetBSD: cerror.S,v 1.3 1998/11/24 11:14:57 tsubai Exp $ */
#include <machine/asm.h>
#include "SYS.h"
@ -6,14 +6,18 @@
/* XXX _REENTRANT */
.globl _C_LABEL(errno)
ASENTRY(cerror)
#ifdef PIC
ASENTRY(cerror)
XXX
mflr 10
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr 4
lwz 4,_C_LABEL(errno)@got(4)
stw 3,0(4)
mtlr 10
#else
ASENTRY(cerror)
lis 4,_C_LABEL(errno)@ha
stw 3,_C_LABEL(errno)@l(4)
#endif
li 3,-1
li 4,-1
blr
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: pipe.S,v 1.3 1998/05/25 15:35:06 ws Exp $ */
/* $NetBSD: pipe.S,v 1.4 1998/11/24 11:14:57 tsubai Exp $ */
#include "SYS.h"
@ -12,4 +12,4 @@ ENTRY(pipe)
li 3,0
blr # and return 0
1:
b _ASM_LABEL(cerror)
b PIC_PLT(_ASM_LABEL(cerror))

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbrk.S,v 1.3 1998/05/25 15:35:06 ws Exp $ */
/* $NetBSD: sbrk.S,v 1.4 1998/11/24 11:14:57 tsubai Exp $ */
#include "SYS.h"
@ -12,18 +12,27 @@ _ASM_LABEL(curbrk):
ENTRY(sbrk)
#ifdef PIC
XXX
mflr 10
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr 5
mtlr 10
lwz 5,_ASM_LABEL(curbrk)@got(5)
lwz 6,0(5)
#else
lis 5,_ASM_LABEL(curbrk)@ha
lwz 6,_ASM_LABEL(curbrk)@l(5) # r6 = old break
#endif
add 3,3,6
mr 7,3 # r7 = new break
li 0,SYS_break
sc # break(new_break)
bso 1f
mr 3,6 # set return value
#ifdef PIC
stw 7,0(5)
#else
stw 7,_ASM_LABEL(curbrk)@l(5) # record new break
#endif
blr
1:
b _ASM_LABEL(cerror)
#endif
b PIC_PLT(_ASM_LABEL(cerror))

View File

@ -1,4 +1,4 @@
/* $NetBSD: setlogin.S,v 1.2 1998/05/25 15:28:03 ws Exp $ */
/* $NetBSD: setlogin.S,v 1.3 1998/11/24 11:14:57 tsubai Exp $ */
#include "SYS.h"
@ -6,10 +6,16 @@
SYSCALL(setlogin)
#ifdef PIC
XXX
mflr 10
bl _GLOBAL_OFFSET_TABLE_@local-4
mflr 4
lwz 4,_C_LABEL(__logname_valid)@got(4)
li 5,0
stw 5,0(4)
mtlr 10
#else
lis 4,_C_LABEL(__logname_valid)@ha
li 5,0
stw 5,_C_LABEL(__logname_valid)@l(4)
blr
#endif
blr

View File

@ -1,4 +1,4 @@
/* $NetBSD: sigpending.S,v 1.4 1998/10/03 12:30:38 tsubai Exp $ */
/* $NetBSD: sigpending.S,v 1.5 1998/11/24 11:14:57 tsubai Exp $ */
#include "SYS.h"
@ -11,4 +11,4 @@ ENTRY(sigpending)
li 3,0 # and return 0
blr
1:
b _ASM_LABEL(cerror)
b PIC_PLT(_ASM_LABEL(cerror))

View File

@ -1,4 +1,4 @@
/* $NetBSD: sigprocmask.S,v 1.4 1998/10/03 12:30:38 tsubai Exp $ */
/* $NetBSD: sigprocmask.S,v 1.5 1998/11/24 11:14:57 tsubai Exp $ */
#include "SYS.h"
@ -23,4 +23,4 @@ ENTRY(sigprocmask)
li 3,0
blr # in any case, return 0
3:
b _ASM_LABEL(cerror)
b PIC_PLT(_ASM_LABEL(cerror))

View File

@ -1,4 +1,4 @@
/* $NetBSD: sigsuspend.S,v 1.4 1998/10/03 12:30:39 tsubai Exp $ */
/* $NetBSD: sigsuspend.S,v 1.5 1998/11/24 11:14:57 tsubai Exp $ */
#include "SYS.h"
@ -6,4 +6,4 @@ ENTRY(sigsuspend)
lwz 3,0(3) # indirect to mask arg
li 0,SYS_compat_13_sigsuspend13
sc
b _ASM_LABEL(cerror) # always terminates with EINTR
b PIC_PLT(_ASM_LABEL(cerror)) # always terminates with EINTR