Added PIC support where required.

Cleaned out and dead / redundant code.
This commit is contained in:
mark 1997-10-06 00:07:09 +00:00
parent 9d64c268b2
commit e08cd408b1
14 changed files with 128 additions and 53 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: Ovfork.S,v 1.2 1996/05/12 19:55:00 mark Exp $ */
/* $NetBSD: Ovfork.S,v 1.3 1997/10/06 00:07:09 mark Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.

View File

@ -1,4 +1,4 @@
/* $NetBSD: brk.S,v 1.2 1996/05/12 19:55:04 mark Exp $ */
/* $NetBSD: brk.S,v 1.3 1997/10/06 00:07:10 mark Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -41,23 +41,60 @@
.globl minbrk
.globl curbrk
/* The minimum allowable brk address */
.data
minbrk: .long _end
.text
.align 0
/*
* Change the data segment size
*/
ENTRY(brk)
#ifdef PIC
/* Setup the GOT */
ldr r3, got
add r3, pc, r3
L1:
ldr r1, Lminbrk
ldr r1, [r3, r1]
#else
ldr r1, Lminbrk
#endif
/* Get the minimum allowable brk address */
ldr r1, [r1]
/*
* Valid the address specified and set to the minimum
* if the address is below minbrk.
*/
cmp r0, r1
movlt r0, r1
mov r2, r0
swi SYS_break
bcs cerror
mov r0, #0x00000000
#ifdef PIC
ldr r1, Lcurbrk
ldr r1, [r3, r1]
#else
ldr r1, Lcurbrk
#endif
/* Store the new address in curbrk */
str r2, [r1]
/* return 0 for sucess */
mov r0, #0x00000000
mov r15, r14
#ifdef PIC
.align 0
got:
.word __GLOBAL_OFFSET_TABLE_ + (. - (L1+4))
#endif
Lminbrk:
.word minbrk

View File

@ -1,4 +1,4 @@
/* $NetBSD: cerror.S,v 1.3 1996/06/05 19:02:12 mark Exp $ */
/* $NetBSD: cerror.S,v 1.4 1997/10/06 00:07:11 mark Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -37,16 +37,31 @@
#include "SYS.h"
.text
.align 0
.globl _errno
.global cerror
.type cerror,@function
cerror:
#ifdef PIC
/* Setup the GOT */
ldr r3, got
add r3, pc, r3
L1:
ldr r1, Lerrno
ldr r1, [r3, r1]
#else
ldr r1, Lerrno
#endif
str r0, [r1]
mvn r0, #0x00000000
mvn r1, #0x00000000
mov r15, r14
#ifdef PIC
.align 0
got:
.word __GLOBAL_OFFSET_TABLE_ + (. - (L1+4))
#endif
.globl _errno
Lerrno:
.word _errno

View File

@ -1,4 +1,4 @@
/* $NetBSD: exect.S,v 1.2 1996/05/12 19:55:09 mark Exp $ */
/* $NetBSD: exect.S,v 1.3 1997/10/06 00:07:12 mark Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -37,9 +37,6 @@
#include "SYS.h"
.text
.align 0
ENTRY(exect)
swi SYS_execve
bcs cerror

View File

@ -1,4 +1,4 @@
/* $NetBSD: fork.S,v 1.2 1996/05/12 19:55:11 mark Exp $ */
/* $NetBSD: fork.S,v 1.3 1997/10/06 00:07:13 mark Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.

View File

@ -1,4 +1,4 @@
/* $NetBSD: pipe.S,v 1.2 1996/05/12 19:55:16 mark Exp $ */
/* $NetBSD: pipe.S,v 1.3 1997/10/06 00:07:14 mark Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -37,9 +37,6 @@
#include "SYS.h"
.text
.align 0
ENTRY(pipe)
mov r2, r0
swi SYS_pipe

View File

@ -1,4 +1,4 @@
/* $NetBSD: ptrace.S,v 1.3 1996/08/07 17:38:16 mark Exp $
/* $NetBSD: ptrace.S,v 1.4 1997/10/06 00:07:15 mark Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -37,13 +37,19 @@
#include "SYS.h"
.text
.align 0
ENTRY(ptrace)
stmfd sp!, {r0, r1}
mov r0, #0x00000000
#ifdef PIC
/* Setup the GOT */
ldr r0, got
add r0, pc, r0
L1:
ldr r1, Lerrno
ldr r1, [r0, r1]
#else
ldr r1, Lerrno
#endif
mov r0, #0x00000000
str r0, [r1]
ldmfd sp!, {r0, r1}
@ -51,5 +57,11 @@ ENTRY(ptrace)
bcs cerror
mov r15, r14
#ifdef PIC
.align 0
got:
.word __GLOBAL_OFFSET_TABLE_ + (. - (L1+4))
#endif
Lerrno:
.word _errno

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbrk.S,v 1.2 1996/05/12 19:55:24 mark Exp $ */
/* $NetBSD: sbrk.S,v 1.3 1997/10/06 00:07:16 mark Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -45,17 +45,42 @@ curbrk: .long _end
.text
.align 0
/*
* Change the data segment size
*/
ENTRY(sbrk)
#ifdef PIC
/* Setup the GOT */
ldr r3, got
add r3, pc, r3
L1:
ldr r2, Lcurbrk
ldr r2, [r3, r2]
#else
ldr r2, Lcurbrk
#endif
/* Get the current brk address */
ldr r1, [r2]
/* Calculate new value */
mov r3, r0
add r0, r0, r1
swi SYS_break
bcs cerror
/* Store new curbrk value */
ldr r0, [r2]
add r1, r0, r3
str r1, [r2]
mov r15, r14
#ifdef PIC
.align 0
got:
.word __GLOBAL_OFFSET_TABLE_ + (. - (L1+4))
#endif
Lcurbrk:
.word curbrk

View File

@ -1,4 +1,4 @@
/* $NetBSD: setlogin.S,v 1.2 1996/05/12 19:55:27 mark Exp $ */
/* $NetBSD: setlogin.S,v 1.3 1997/10/06 00:07:17 mark Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@ -40,10 +40,25 @@
.globl ___logname_valid /* in getlogin() */
SYSCALL(setlogin)
mov r0, #0x00000000
#ifdef PIC
/* Setup the GOT */
ldr r0, got
add r0, pc, r0
L1:
ldr r1, Llogname
ldr r1, [r0, r1]
#else
ldr r1, Llogname
#endif
mov r0, #0x00000000
str r0, [r1]
mov r15, r14
#ifdef PIC
.align 0
got:
.word __GLOBAL_OFFSET_TABLE_ + (. - (L1+4))
#endif
Llogname:
.word ___logname_valid

View File

@ -1,4 +1,4 @@
/* $NetBSD: sigpending.S,v 1.2 1996/05/12 19:55:30 mark Exp $ */
/* $NetBSD: sigpending.S,v 1.3 1997/10/06 00:07:18 mark Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -37,9 +37,6 @@
#include "SYS.h"
.text
.align 0
ENTRY(sigpending)
mov r2, r0
swi SYS_sigpending

View File

@ -1,4 +1,4 @@
/* $NetBSD: sigprocmask.S,v 1.2 1996/05/12 19:55:33 mark Exp $ */
/* $NetBSD: sigprocmask.S,v 1.3 1997/10/06 00:07:19 mark Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -37,9 +37,6 @@
#include "SYS.h"
.text
.align 0
ENTRY(sigprocmask)
teq r1, #0x00000000
moveq r0, #0x00000001

View File

@ -1,4 +1,4 @@
/* $NetBSD: sigreturn.S,v 1.3 1996/11/30 02:31:49 jtc Exp $ */
/* $NetBSD: sigreturn.S,v 1.4 1997/10/06 00:07:20 mark Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -41,16 +41,5 @@
* We must preserve the state of the registers as the user has set them up.
*/
/* I must code this bit ... - mark */
#if 0
#ifdef GPROF
#undef ENTRY
#define ENTRY(x) \
.globl _/**/x; .align 2; _/**/x: pusha ; \
.data; 1:; .long 0; .text; movl $1b,%eax; call mcount; popa ; nop
#endif /* GPROF */
#endif
SYSCALL(sigreturn)
mov r15, r14

View File

@ -1,4 +1,4 @@
/* $NetBSD: sigsuspend.S,v 1.2 1996/05/12 19:55:38 mark Exp $ */
/* $NetBSD: sigsuspend.S,v 1.3 1997/10/06 00:07:21 mark Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -37,9 +37,6 @@
#include "SYS.h"
.text
.align 0
ENTRY(sigsuspend)
ldr r0, [r0]
swi SYS_sigsuspend

View File

@ -1,4 +1,4 @@
/* $NetBSD: syscall.S,v 1.2 1996/05/12 19:55:44 mark Exp $ */
/* $NetBSD: syscall.S,v 1.3 1997/10/06 00:07:22 mark Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@ -37,9 +37,6 @@
#include "SYS.h"
.text
.align 0
ENTRY(syscall)
swi 0x00000000
bcs cerror