Initial commit of arm26 port
This commit is contained in:
parent
6a36c27519
commit
6c97e2bd78
|
@ -0,0 +1,263 @@
|
|||
#!/bin/sh -
|
||||
# $NetBSD: MAKEDEV,v 1.1 2000/05/09 21:55:44 bjh21 Exp $
|
||||
#
|
||||
# Copyright (c) 1990 The Regents of the University of California.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. All advertising materials mentioning features or use of this software
|
||||
# must display the following acknowledgement:
|
||||
# This product includes software developed by the University of
|
||||
# California, Berkeley and its contributors.
|
||||
# 4. Neither the name of the University nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
###########################################################################
|
||||
#
|
||||
# PLEASE RUN "cd ../share/man/man8 ; perl5 MAKEDEV2manpage.pl"
|
||||
# AFTER CHANGING THIS FILE, AND COMMIT THE UPDATED MANPAGE!
|
||||
#
|
||||
###########################################################################
|
||||
#
|
||||
# Device "make" file. Valid arguments:
|
||||
# all Makes all known devices, including local devices.
|
||||
# If units are expected for a device MAKEDEV supplies the
|
||||
# standard numbers.
|
||||
# minimal A minimal set of devices for install disks, etc.
|
||||
# std The standard devices (console, drum, klog, kmem, mem,
|
||||
# null, stderr, stdin, stdout, tty, zero).
|
||||
# local Configuration specific devices which are created by running
|
||||
# the MAKEDEV.local shell script with the argument "all".
|
||||
#
|
||||
# Tapes:
|
||||
# st* SCSI tape
|
||||
#
|
||||
# Disks:
|
||||
# ccd* concatenated disk driver
|
||||
# md* memory pseudo-disk devices
|
||||
# vnd* file pseudo-disks
|
||||
#
|
||||
# Terminals:
|
||||
# ttyE? Workstation console ("wscons") glass-tty emulators
|
||||
#
|
||||
# Pseudo terminals:
|
||||
# pty* set of 16 master and slave pseudo terminals
|
||||
#
|
||||
# Special purpose devices:
|
||||
# fd file descriptors (/dev/fd/*)
|
||||
|
||||
dialin=0
|
||||
dialout=524288
|
||||
callunit=262144
|
||||
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
umask 77
|
||||
for i
|
||||
do
|
||||
case $i in
|
||||
|
||||
all)
|
||||
sh $0 std fd pty0 pty1
|
||||
sh $0 vnd0 vnd1 vnd2 vnd3
|
||||
sh $0 ccd0 ccd1 ccd2 ccd3 md0 md1
|
||||
sh $0 wskbd0 wsmouse0
|
||||
sh $0 wscons
|
||||
;;
|
||||
|
||||
minimal)
|
||||
sh $0 std
|
||||
sh $0 pty0 ccd0 ccd1 md0
|
||||
sh $0 ttyE0 ttyE1 wsmouse0 wskbd0 ttyEcfg
|
||||
;;
|
||||
|
||||
wscons)
|
||||
sh $0 ttyE0 ttyE1 ttyE2 ttyE3 ttyE4 ttyE5 ttyE6 ttyE7
|
||||
sh $0 wsmouse0 wsmouse1 wsmouse2 wsmouse3
|
||||
sh $0 wskbd0 wskbd1 wskbd2 wskbd3
|
||||
sh $0 ttyEcfg
|
||||
sh $0 wsmux
|
||||
;;
|
||||
|
||||
wskbd*)
|
||||
major=11
|
||||
unit=${i#wskbd}
|
||||
wskbd=wskbd$unit
|
||||
rm -f $wskbd
|
||||
mknod $wskbd c $major $unit
|
||||
chown root.wheel $wskbd
|
||||
chmod 600 $wskbd
|
||||
;;
|
||||
|
||||
wsmouse*)
|
||||
major=12
|
||||
unit=${i#wsmouse}
|
||||
wsmouse=wsmouse$unit
|
||||
rm -f $wsmouse
|
||||
mknod $wsmouse c 12 $unit
|
||||
chown root.wheel $wsmouse
|
||||
chmod 600 $wsmouse
|
||||
;;
|
||||
|
||||
wsmux|wsmouse|wskbd)
|
||||
rm -f wsmouse wskbd
|
||||
mknod wsmouse c 13 0
|
||||
mknod wskbd c 13 1
|
||||
chown root.wheel wsmouse wskbd
|
||||
chmod 600 wsmouse wskbd
|
||||
;;
|
||||
|
||||
std)
|
||||
rm -f console drum mem kmem null zero io tty klog stdin stdout stderr
|
||||
mknod console c 0 0
|
||||
mknod tty c 1 0 ; chmod 666 tty
|
||||
mknod kmem c 2 1 ; chmod 640 kmem ; chgrp kmem kmem
|
||||
mknod mem c 2 0 ; chmod 640 mem ; chgrp kmem mem
|
||||
mknod null c 2 2 ; chmod 666 null
|
||||
mknod zero c 2 3 ; chmod 666 zero
|
||||
mknod drum c 3 0 ; chmod 640 drum ; chgrp kmem drum
|
||||
mknod klog c 6 0 ; chmod 600 klog
|
||||
mknod stdin c 7 0 ; chmod 666 stdin
|
||||
mknod stdout c 7 1 ; chmod 666 stdout
|
||||
mknod stderr c 7 2 ; chmod 666 stderr
|
||||
;;
|
||||
|
||||
fd)
|
||||
major=7
|
||||
rm -f fd/*
|
||||
mkdir fd > /dev/null 2>&1
|
||||
n=0
|
||||
while [ $n -lt 64 ]; do
|
||||
mknod fd/$n c $major $n
|
||||
n=$(($n + 1))
|
||||
done
|
||||
chown -R root.wheel fd
|
||||
chmod 755 fd
|
||||
chmod 666 fd/*
|
||||
;;
|
||||
|
||||
md*)
|
||||
unit=${i#md}; blk=1; chr=8;
|
||||
rm -f md${unit}? rmd${unit}?
|
||||
mknod md${unit}a b $blk $(($unit * 8 + 0))
|
||||
mknod md${unit}c b $blk $(($unit * 8 + 2))
|
||||
# mknod rmd${unit}a c $chr $(($unit * 8 + 0))
|
||||
# mknod rmd${unit}c c $chr $(($unit * 8 + 2))
|
||||
chgrp operator md${unit}? #rmd${unit}?
|
||||
chmod 640 md${unit}? #rmd${unit}?
|
||||
;;
|
||||
|
||||
ccd*|vnd*)
|
||||
case $i in
|
||||
ccd*) name=ccd; unit=${i#ccd}; blk=3; chr=9;;
|
||||
vnd*) name=vnd; unit=${i#vnd}; blk=2; chr=8;;
|
||||
esac
|
||||
rm -f $name$unit? r$name$unit?
|
||||
mknod ${name}${unit}a b $blk $(($unit * 8 + 0))
|
||||
mknod ${name}${unit}b b $blk $(($unit * 8 + 1))
|
||||
mknod ${name}${unit}c b $blk $(($unit * 8 + 2))
|
||||
mknod ${name}${unit}d b $blk $(($unit * 8 + 3))
|
||||
mknod ${name}${unit}e b $blk $(($unit * 8 + 4))
|
||||
mknod ${name}${unit}f b $blk $(($unit * 8 + 5))
|
||||
mknod ${name}${unit}g b $blk $(($unit * 8 + 6))
|
||||
mknod ${name}${unit}h b $blk $(($unit * 8 + 7))
|
||||
mknod r${name}${unit}a c $chr $(($unit * 8 + 0))
|
||||
mknod r${name}${unit}b c $chr $(($unit * 8 + 1))
|
||||
mknod r${name}${unit}c c $chr $(($unit * 8 + 2))
|
||||
mknod r${name}${unit}d c $chr $(($unit * 8 + 3))
|
||||
mknod r${name}${unit}e c $chr $(($unit * 8 + 4))
|
||||
mknod r${name}${unit}f c $chr $(($unit * 8 + 5))
|
||||
mknod r${name}${unit}g c $chr $(($unit * 8 + 6))
|
||||
mknod r${name}${unit}h c $chr $(($unit * 8 + 7))
|
||||
chgrp operator ${name}${unit}[a-h] r${name}${unit}[a-h]
|
||||
chmod 640 ${name}${unit}[a-h] r${name}${unit}[a-h]
|
||||
;;
|
||||
|
||||
ttyEcfg)
|
||||
rm -f $i
|
||||
mknod $i c 14 255
|
||||
chown root:wheel $i
|
||||
;;
|
||||
|
||||
ttyE*)
|
||||
case $i in
|
||||
ttyE*) name=ttyE; unit=${i#ttyE}; major=14; minor=$unit;;
|
||||
esac
|
||||
rm -f $name$unit
|
||||
mknod $name$unit c $major $minor
|
||||
chown uucp.wheel $name$unit
|
||||
;;
|
||||
|
||||
pty*)
|
||||
class=${i#pty}
|
||||
case $class in
|
||||
0) name=p;;
|
||||
1) name=q;;
|
||||
2) name=r;;
|
||||
3) name=s;;
|
||||
4) name=t;;
|
||||
5) name=u;;
|
||||
6) name=v;;
|
||||
7) name=w;;
|
||||
8) name=x;;
|
||||
9) name=y;;
|
||||
10) name=z;;
|
||||
11) name=P;;
|
||||
12) name=Q;;
|
||||
13) name=R;;
|
||||
14) name=S;;
|
||||
15) name=T;;
|
||||
*) echo "$0: $i: pty unit must be between 0 and 15"
|
||||
continue ;;
|
||||
esac
|
||||
rm -f tty$name[0-9a-f] pty$name[0-9a-f]
|
||||
for j in 0 1 2 3 4 5 6 7 8 9 a b c d e f
|
||||
do
|
||||
case $j in
|
||||
[0-9]) jn=$j ;;
|
||||
a) jn=10 ;;
|
||||
b) jn=11 ;;
|
||||
c) jn=12 ;;
|
||||
d) jn=13 ;;
|
||||
e) jn=14 ;;
|
||||
f) jn=15 ;;
|
||||
esac
|
||||
unit=$(($class * 16 + $jn))
|
||||
mknod tty$name$j c 4 $unit
|
||||
mknod pty$name$j c 5 $unit
|
||||
done
|
||||
chgrp wheel tty$name? pty$name?
|
||||
chmod 666 tty$name? pty$name?
|
||||
;;
|
||||
|
||||
local)
|
||||
umask 0
|
||||
sh $0.local all
|
||||
umask 77
|
||||
;;
|
||||
|
||||
*)
|
||||
echo $i: unknown device
|
||||
;;
|
||||
|
||||
esac
|
||||
done
|
|
@ -0,0 +1,97 @@
|
|||
# $NetBSD: disktab,v 1.1 2000/05/09 21:55:44 bjh21 Exp $
|
||||
#
|
||||
# Disk geometry and partition layout tables.
|
||||
# Key:
|
||||
# dt controller type
|
||||
# ty type of disk (fixed, removeable, simulated)
|
||||
# d[0-4] drive-type-dependent parameters
|
||||
# ns #sectors/track
|
||||
# nt #tracks/cylinder
|
||||
# nc #cylinders/disk
|
||||
# sc #sectors/cylinder, ns*nt default
|
||||
# su #sectors/unit, sc*nc default
|
||||
# se sector size, DEV_BSIZE default
|
||||
# rm rpm, 3600 default
|
||||
# sf supports bad144-style bad sector forwarding
|
||||
# sk sector skew per track, default 0
|
||||
# cs sector skew per cylinder, default 0
|
||||
# hs headswitch time, default 0
|
||||
# ts one-cylinder seek time, default 0
|
||||
# il sector interleave (n:1), 1 default
|
||||
# bs boot block size, default BBSIZE
|
||||
# sb superblock size, default SBSIZE
|
||||
# o[a-h] partition offsets in sectors
|
||||
# p[a-h] partition sizes in sectors
|
||||
# b[a-h] partition block sizes in bytes
|
||||
# f[a-h] partition fragment sizes in bytes
|
||||
# t[a-h] partition types (filesystem, swap, etc)
|
||||
#
|
||||
# All partition sizes reserve space for bad sector tables.
|
||||
# (5 cylinders needed for maintenance + replacement sectors)
|
||||
#
|
||||
|
||||
# a == root
|
||||
# b == swap
|
||||
# c == whole disk
|
||||
# d == scratch
|
||||
# e == /var
|
||||
# f == scratch
|
||||
# h == /usr
|
||||
|
||||
cfs420a|Conner Peripherals 420MB IDE:\
|
||||
:dt=ESDI:ty=winchester:se#512:nt#16:ns#63:nc#826: \
|
||||
:pa#20160:oa#416304:ta=4.2BSD:ba#4096:fa#512: \
|
||||
:pb#17136:ob#436464:tb=swap: \
|
||||
:pc#832608:oc#0: \
|
||||
:pd#416304:od#0:td=adfs:bd#512: \
|
||||
:pe#379008:oe#453600:te=4.2BSD:be#4096:fe#512:
|
||||
|
||||
disk4|Seagate ST3491A:\
|
||||
:dt=ESDI:ty=winchester:se#512:nt#15:ns#62:nc#899: \
|
||||
:pa#46500:oa#46500:ta=4.2BSD:ba#4096:fa#512: \
|
||||
:pb#46500:ob#93000:tb=swap:bb#4096:fb#512: \
|
||||
:pc#836070:oc#0: \
|
||||
:pd#46500:od#0:td=adfs:bd#512: \
|
||||
:pe#46500:oe#139500:te=4.2BSD:be#512: \
|
||||
:pf#650070:of#186000:tf=4.2BSD:bf#4096:ff#512:
|
||||
|
||||
cfs425a|Conner Peripherals 425MB IDE:\
|
||||
:dt=ESDI:ty=winchester:se#512:nt#16:ns#62:nc#839: \
|
||||
:pa#49600:oa#49600:ta=4.2BSD:ba#4096:fa#512: \
|
||||
:pb#49600:ob#99200:tb=swap: \
|
||||
:pc#832288:oc#0: \
|
||||
:pd#49600:od#0:td=adfs:bd#512: \
|
||||
:pe#49600:oe#148800:te=4.2BSD:be#4096:fe#512: \
|
||||
:pf#633888:of#198400:tf=4.2BSD:bf#4096:ff#512:
|
||||
|
||||
cfa850|Conner Peripherals 850MB IDE:\
|
||||
:dt=ESDI:ty=winchester:\
|
||||
:nc#1651:ns#63:nt#16:se#512:\
|
||||
:pa#60480:oa#50400:ta=4.2BSD:\
|
||||
:pb#129024:ob#110880:tb=swap:\
|
||||
:pc#1664208:oc#0:\
|
||||
:pd#50400:od#0:\
|
||||
:pe#1424304:oe#239904:te=4.2BSD:
|
||||
|
||||
floppy|3.5in High Density Floppy:\
|
||||
:ty=floppy:se#512:nt#2:rm#300:ns#18:nc#80:\
|
||||
:pa#2880:oa#0:ba#4096:fa#512:\
|
||||
:pb#2880:ob#0:\
|
||||
:pc#2880:oc#0:
|
||||
|
||||
LMR650E|pd650|PD650|650MB PD Cartridge:\
|
||||
:dt=SCSI::ty=removable:se#512:nt#64:ns#32:nc#634: \
|
||||
:pa#1298432:oa#0:ta=4.2BSD:ba#4096:fa#512:\
|
||||
:pc#1298432:oc#0:
|
||||
|
||||
mdroot|miniroot|arm32 root disc:\
|
||||
:ty=simulated:se#512:nt#2:ns#18:nc#80:\
|
||||
:ta=4.4BSD:pa#2880:oa#0:ba#4096:fa#512:\
|
||||
:pb#0:ob#0:\
|
||||
:pc#2880:oc#0:
|
||||
|
||||
install-ramdisk|Installation ramdisk:\
|
||||
:ty=simulated:se#512:nt#2:ns#17:nc#100:\
|
||||
:ta=4.4BSD:pa#3400:oa#0:ba#4096:fa#512:\
|
||||
:pb#0:ob#0:\
|
||||
:pc#3400:oc#0:
|
|
@ -0,0 +1,4 @@
|
|||
# $NetBSD: fstab.nfs,v 1.1 2000/05/09 21:55:44 bjh21 Exp $
|
||||
#
|
||||
server:/export/client/root / nfs rw,-r=1024,-w=1024
|
||||
server:/export/netbsd.arm26/usr /usr nfs ro,-r=1024,-w=1024
|
|
@ -0,0 +1,42 @@
|
|||
#
|
||||
# from: @(#)ttys 5.1 (Berkeley) 4/17/89
|
||||
# $NetBSD: ttys,v 1.1 2000/05/09 21:55:44 bjh21 Exp $
|
||||
#
|
||||
# name getty type status comments
|
||||
#
|
||||
ttyE0 "/usr/libexec/getty Pc" vt220 on secure
|
||||
ttyE1 "/usr/libexec/getty Pc" vt220 off secure
|
||||
ttyE2 "/usr/libexec/getty Pc" vt220 off secure
|
||||
ttyE3 "/usr/libexec/getty Pc" vt220 off secure
|
||||
ttyp0 none network
|
||||
ttyp1 none network
|
||||
ttyp2 none network
|
||||
ttyp3 none network
|
||||
ttyp4 none network
|
||||
ttyp5 none network
|
||||
ttyp6 none network
|
||||
ttyp7 none network
|
||||
ttyp8 none network
|
||||
ttyp9 none network
|
||||
ttypa none network
|
||||
ttypb none network
|
||||
ttypc none network
|
||||
ttypd none network
|
||||
ttype none network
|
||||
ttypf none network
|
||||
ttyq0 none network
|
||||
ttyq1 none network
|
||||
ttyq2 none network
|
||||
ttyq3 none network
|
||||
ttyq4 none network
|
||||
ttyq5 none network
|
||||
ttyq6 none network
|
||||
ttyq7 none network
|
||||
ttyq8 none network
|
||||
ttyq9 none network
|
||||
ttyqa none network
|
||||
ttyqb none network
|
||||
ttyqc none network
|
||||
ttyqd none network
|
||||
ttyqe none network
|
||||
ttyqf none network
|
|
@ -0,0 +1,3 @@
|
|||
# $NetBSD: Makefile,v 1.1 2000/05/09 21:55:45 bjh21 Exp $
|
||||
|
||||
.include "${.CURDIR}/../common_elf/Makefile.inc"
|
|
@ -0,0 +1,163 @@
|
|||
/* $NetBSD: c++rt0.c,v 1.1 2000/05/09 21:55:45 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Paul Kranenburg.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Run-time module for GNU C++ compiled shared libraries.
|
||||
*
|
||||
* The linker constructs the following arrays of pointers to global
|
||||
* constructors and destructors. The first element contains the
|
||||
* number of pointers in each.
|
||||
* The tables are also null-terminated.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
/*
|
||||
* We make the __{C,D}TOR_LIST__ symbols appear as type `SETD' and
|
||||
* include a dummy local function in the set. This keeps references
|
||||
* to these symbols local to the shared object this module is linked to.
|
||||
*/
|
||||
static void dummy __P((void)) { return; }
|
||||
|
||||
/* Note: this is "a.out" dependent. */
|
||||
__asm(".stabs \"___CTOR_LIST__\",22,0,0,_dummy");
|
||||
__asm(".stabs \"___DTOR_LIST__\",22,0,0,_dummy");
|
||||
|
||||
#ifdef __arm32__ /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
#define ARM32_BROKEN_RELOCATIONS /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
#endif /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
|
||||
void (*__CTOR_LIST__[0]) __P((void));
|
||||
void (*__DTOR_LIST__[0]) __P((void));
|
||||
|
||||
#ifdef ARM32_BROKEN_RELOCATIONS /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
static void __dtors __P((long)); /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
static void __ctors __P((long)); /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
#else /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
static void __dtors __P((void));
|
||||
static void __ctors __P((void));
|
||||
#endif
|
||||
|
||||
static void
|
||||
#ifdef ARM32_BROKEN_RELOCATIONS /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
__dtors(base) /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
long base; /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
#else /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
__dtors()
|
||||
#endif
|
||||
{
|
||||
unsigned long i = (unsigned long) __DTOR_LIST__[0];
|
||||
void (**p)(void) = __DTOR_LIST__ + i;
|
||||
|
||||
while (i--)
|
||||
#ifdef ARM32_BROKEN_RELOCATIONS /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
(*(void (*)(void))((char *)(*p--) + base))(); /* XXX ... */
|
||||
#else /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
(**p--)();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
#ifdef ARM32_BROKEN_RELOCATIONS /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
__ctors(base) /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
long base; /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
#else /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
__ctors()
|
||||
#endif
|
||||
{
|
||||
unsigned long i = (unsigned long) __CTOR_LIST__[0];
|
||||
void (**p)(void) = __CTOR_LIST__ + 1;
|
||||
|
||||
while (i--)
|
||||
#ifdef ARM32_BROKEN_RELOCATIONS /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
(*(void (*)(void))((char *)(*p++) + base))(); /* XXX ... */
|
||||
#else /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
(**p++)();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ARM32_BROKEN_RELOCATIONS /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
extern void __init __P((long)) asm(".init"); /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
extern void __fini __P((long)) asm(".fini"); /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
#else /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
extern void __init __P((void)) asm(".init");
|
||||
extern void __fini __P((void)) asm(".fini");
|
||||
#endif
|
||||
|
||||
void
|
||||
#ifdef ARM32_BROKEN_RELOCATIONS /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
__init(base) /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
long base; /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
#else /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
__init()
|
||||
#endif
|
||||
{
|
||||
static int initialized = 0;
|
||||
|
||||
/*
|
||||
* Call global constructors.
|
||||
* Arrange to call global destructors at exit.
|
||||
*/
|
||||
if (!initialized) {
|
||||
initialized = 1;
|
||||
#ifdef ARM32_BROKEN_RELOCATIONS /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
__ctors(base); /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
#else /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
__ctors();
|
||||
#endif /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
#ifdef ARM32_BROKEN_RELOCATIONS /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
__fini(base) /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
long base; /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
#else /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
__fini()
|
||||
#endif /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
{
|
||||
/*
|
||||
* Call global destructors.
|
||||
*/
|
||||
#ifdef ARM32_BROKEN_RELOCATIONS /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
__dtors(base); /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
#else /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
__dtors();
|
||||
#endif /* XXX ARM32_BROKEN_RELOCATIONS */
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
/* $NetBSD: crt0.c,v 1.1 2000/05/09 21:55:45 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1997 Mark Brinicombe
|
||||
* Copyright (C) 1995 Wolfgang Solfrank.
|
||||
* Copyright (C) 1995 TooLs GmbH.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by TooLs GmbH.
|
||||
* 4. The name of TooLs GmbH may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#undef DYNAMIC /* XXX Too complicated for me! */
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
extern void _start(void);
|
||||
void __start(int, char *[], char *[]);
|
||||
|
||||
__asm("
|
||||
.text
|
||||
.align 0
|
||||
.global _start
|
||||
_start:
|
||||
/* Get ps_strings pointer from kernel */
|
||||
teq r10, #0
|
||||
ldr r3, Lps_strings
|
||||
movne r0, #0
|
||||
str r0, [r3]
|
||||
|
||||
/* Get argc, argv, and envp from stack */
|
||||
ldr r0, [sp, #0x0000]
|
||||
add r1, sp, #0x0004
|
||||
add r2, r1, r0, lsl #2
|
||||
add r2, r2, #0x0004
|
||||
|
||||
b " ___STRING(_C_FUNC(__start)) "
|
||||
.align 0
|
||||
Lps_strings:
|
||||
.word " ___STRING(_C_LABEL(__ps_strings)) "
|
||||
");
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: crt0.c,v 1.1 2000/05/09 21:55:45 bjh21 Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
void
|
||||
__start(int argc, char **argv, char **envp)
|
||||
{
|
||||
char *ap;
|
||||
|
||||
environ = envp;
|
||||
|
||||
if ((ap = argv[0]))
|
||||
if ((__progname = _strrchr(ap, '/')) == NULL)
|
||||
__progname = ap;
|
||||
else
|
||||
++__progname;
|
||||
|
||||
#ifdef DYNAMIC
|
||||
/* ld(1) convention: if DYNAMIC = 0 then staticly linked */
|
||||
#ifdef stupid_gcc
|
||||
if (&_DYNAMIC)
|
||||
#else
|
||||
if ( ({volatile caddr_t x = (caddr_t)&_DYNAMIC; x; }) )
|
||||
#endif
|
||||
_rtld_setup(&_DYNAMIC);
|
||||
#endif /* DYNAMIC */
|
||||
|
||||
#ifdef MCRT0
|
||||
atexit(_mcleanup);
|
||||
monstartup((u_long)&_eprol, (u_long)&_etext);
|
||||
#endif /* MCRT0 */
|
||||
|
||||
__asm("__callmain:"); /* Defined for the benefit of debuggers */
|
||||
exit(main(argc, argv, envp));
|
||||
}
|
||||
|
||||
#include "common.c"
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# $NetBSD: Makefile.inc,v 1.1 2000/05/09 21:55:45 bjh21 Exp $
|
||||
|
||||
KMINCLUDES=
|
||||
KMSRCS=arch/arm26/gen/divsi3.S arch/arm26/string/memmove.S \
|
||||
arch/arm26/string/memcpy.S
|
||||
# __APCS_26__ required for SYS.h stuff
|
||||
CPPFLAGS+=-DSOFTFLOAT -D__APCS_26__
|
||||
|
||||
.include <fplib/Makefile.inc>
|
|
@ -0,0 +1,92 @@
|
|||
/* $NetBSD: SYS.h,v 1.1 2000/05/09 21:55:45 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)SYS.h 5.5 (Berkeley) 5/7/91
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#ifdef __STDC__
|
||||
#define SYSTRAP(x) swi SYS_ ## x
|
||||
#else
|
||||
#define SYSTRAP(x) swi SYS_/**/x
|
||||
#endif
|
||||
|
||||
#define _SYSCALL_NOERROR(x,y) \
|
||||
ENTRY(x); \
|
||||
SYSTRAP(y)
|
||||
|
||||
#define _SYSCALL(x, y) \
|
||||
_SYSCALL_NOERROR(x,y); \
|
||||
bcs cerror
|
||||
|
||||
#define SYSCALL_NOERROR(x) \
|
||||
_SYSCALL_NOERROR(x,x)
|
||||
|
||||
#define SYSCALL(x) \
|
||||
_SYSCALL(x,x)
|
||||
|
||||
#ifdef __APCS_26__
|
||||
|
||||
#define PSEUDO_NOERROR(x,y) \
|
||||
_SYSCALL_NOERROR(x,y); \
|
||||
movs r15, r14
|
||||
|
||||
#define PSEUDO(x,y) \
|
||||
_SYSCALL(x,y); \
|
||||
movs r15, r14
|
||||
|
||||
#else /* !__APCS_26__ */
|
||||
|
||||
#define PSEUDO_NOERROR(x,y) \
|
||||
_SYSCALL_NOERROR(x,y); \
|
||||
mov r15, r14
|
||||
|
||||
#define PSEUDO(x,y) \
|
||||
_SYSCALL(x,y); \
|
||||
mov r15, r14
|
||||
|
||||
#endif /* !__APCS_26__ */
|
||||
|
||||
#define RSYSCALL_NOERROR(x) \
|
||||
PSEUDO_NOERROR(x,x)
|
||||
|
||||
#define RSYSCALL(x) \
|
||||
PSEUDO(x,x)
|
||||
|
||||
.globl cerror
|
|
@ -0,0 +1,23 @@
|
|||
# $NetBSD: Makefile.inc,v 1.1 2000/05/09 21:55:46 bjh21 Exp $
|
||||
|
||||
.PATH: ${.CURDIR}/arch/arm26/fplib
|
||||
|
||||
SRCS+=fplib_glue.S fplib_libc.c softfloat.c
|
||||
|
||||
softfloat.o: softfloat.c
|
||||
@echo ${COMPILE.c:Q} -freg-struct-return ${.IMPSRC}
|
||||
@${COMPILE.c} -freg-struct-return ${.IMPSRC} -o ${.TARGET}.o
|
||||
@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
|
||||
@rm -f ${.TARGET}.o
|
||||
|
||||
softfloat.po: softfloat.c
|
||||
@echo ${COMPILE.c:Q} -pg -freg-struct-return ${.IMPSRC} -o ${.TARGET}
|
||||
@${COMPILE.c} -pg -freg-struct-return ${.IMPSRC} -o ${.TARGET}.o
|
||||
@${LD} -X -r ${.TARGET}.o -o ${.TARGET}
|
||||
@rm -f ${.TARGET}.o
|
||||
|
||||
softfloat.so: softfloat.c
|
||||
@echo ${COMPILE.c:Q} ${CPICFLAGS} -freg-struct-return ${.IMPSRC} -o ${.TARGET}
|
||||
@${COMPILE.c} ${CPICFLAGS} -freg-struct-return ${.IMPSRC} -o ${.TARGET}.o
|
||||
@${LD} -x -r ${.TARGET}.o -o ${.TARGET}
|
||||
@rm -f ${.TARGET}.o
|
|
@ -0,0 +1,79 @@
|
|||
/* $NetBSD: arm-gcc.h,v 1.1 2000/05/09 21:55:46 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
One of either `BIGENDIAN' or `LITTLEENDIAN' must be defined.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
#define LITTLEENDIAN
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
`BIT64' can be defined to indicate that 64-bit integer types are supported
|
||||
by the compiler.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
#define BITS64
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Each of the following `typedef's defines the most convenient type that holds
|
||||
integers of at least as many bits as specified. For example, `uint8' should
|
||||
be the most convenient type that can hold unsigned integers of as many as
|
||||
8 bits. The `flag' type must be able to hold either a 0 or 1. For most
|
||||
implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed
|
||||
to the same as `int'.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
typedef char flag;
|
||||
typedef unsigned char uint8;
|
||||
typedef signed char int8;
|
||||
typedef int uint16;
|
||||
typedef int int16;
|
||||
typedef unsigned int uint32;
|
||||
typedef signed int int32;
|
||||
#ifdef BITS64
|
||||
typedef unsigned long long int bits64;
|
||||
typedef signed long long int sbits64;
|
||||
#endif
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Each of the following `typedef's defines a type that holds integers
|
||||
of _exactly_ the number of bits specified. For instance, for most
|
||||
implementation of C, `bits16' and `sbits16' should be `typedef'ed to
|
||||
`unsigned short int' and `signed short int' (or `short int'), respectively.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
typedef unsigned char bits8;
|
||||
typedef signed char sbits8;
|
||||
typedef unsigned short int bits16;
|
||||
typedef signed short int sbits16;
|
||||
typedef unsigned int bits32;
|
||||
typedef signed int sbits32;
|
||||
#ifdef BITS64
|
||||
typedef unsigned long long int uint64;
|
||||
typedef signed long long int int64;
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Macros to define functions with the GCC expected names
|
||||
*/
|
||||
|
||||
#define float32_add __addsf3
|
||||
#define float64_add __adddf3
|
||||
#define float32_sub __subsf3
|
||||
#define float64_sub __subdf3
|
||||
#define float32_mul __mulsf3
|
||||
#define float64_mul __muldf3
|
||||
#define float32_div __divsf3
|
||||
#define float64_div __divdf3
|
||||
#define int32_to_float32 __floatsisf
|
||||
#define int32_to_float64 __floatsidf
|
||||
#define float32_to_int32_round_to_zero __fixsfsi
|
||||
#define float64_to_int32_round_to_zero __fixdfsi
|
||||
#define float32_to_uint32_round_to_zero __fixunssfsi
|
||||
#define float64_to_uint32_round_to_zero __fixunsdfsi
|
||||
#define float32_to_float64 __extendsfdf2
|
||||
#define float64_to_float32 __truncdfsf2
|
|
@ -0,0 +1,63 @@
|
|||
/* $NetBSD: environment.h,v 1.1 2000/05/09 21:55:46 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
This C header file is part of the SoftFloat IEC/IEEE Floating-point
|
||||
Arithmetic Package, Release 1a.
|
||||
|
||||
Written by John R. Hauser. This work was made possible by the International
|
||||
Computer Science Institute, located at Suite 600, 1947 Center Street,
|
||||
Berkeley, California 94704. Funding was provided in part by the National
|
||||
Science Foundation under grant MIP-9311980. The original version of
|
||||
this code was written as part of a project to build a fixed-point vector
|
||||
processor in collaboration with the University of California at Berkeley,
|
||||
overseen by Profs. Nelson Morgan and John Wawrzynek. More information
|
||||
is available through the web page `http://www.cs.berkeley.edu/~jhauser/
|
||||
softfloat.html'.
|
||||
|
||||
THIS PACKAGE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has
|
||||
been made to avoid it, THIS PACKAGE MAY CONTAIN FAULTS THAT WILL AT TIMES
|
||||
RESULT IN INCORRECT BEHAVIOR. USE OF THIS PACKAGE IS RESTRICTED TO PERSONS
|
||||
AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY AND ALL
|
||||
LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
|
||||
|
||||
Derivative works are acceptable, even for commercial purposes, so long as
|
||||
(1) they include prominent notice that the work is derivative, and (2) they
|
||||
include prominent notice akin to these three paragraphs for those parts of
|
||||
this code that are retained.
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Include common integer types and flags.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
#include "arm-gcc.h"
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
The word `INLINE' appears before all routines that should be inlined. If
|
||||
a compiler does not support inlining, this macro should be defined to be
|
||||
`static'.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
#define INLINE static __inline
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Move private identifiers with external linkage into implementation namespace.
|
||||
-- Klaus Klein <kleink@netbsd.org>, May 5, 1999
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
#define float_exception_flags _arm_float_exception_flags
|
||||
#define float_rounding_mode _arm_float_rounding_mode
|
||||
#define float32_eq _arm_float32_eq
|
||||
#define float32_le _arm_float32_le
|
||||
#define float32_lt _arm_float32_lt
|
||||
#define float64_eq _arm_float64_eq
|
||||
#define float64_le _arm_float64_le
|
||||
#define float64_lt _arm_float64_lt
|
||||
#define float_raise _arm_float_raise
|
|
@ -0,0 +1,211 @@
|
|||
/* $NetBSD: fplib_glue.S,v 1.1 2000/05/09 21:55:46 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Neil A. Carson and Mark Brinicombe
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
#define SIGN_BIT_TWIDDLE 0x80000000
|
||||
|
||||
/********************************* COMPARISONS ********************************/
|
||||
|
||||
/*
|
||||
* 'Equal' wrapper. This returns 0 if the numbers are equal, or (1 | -1)
|
||||
* otherwise. So we need to invert the output.
|
||||
*/
|
||||
ENTRY(__eqsf2)
|
||||
stmfd sp!, {lr}
|
||||
bl _C_LABEL(_arm_float32_eq)
|
||||
eor r0, r0, #1
|
||||
#ifdef __APCS_26__
|
||||
ldmfd sp!, {pc}^
|
||||
#else
|
||||
ldmfd sp!, {pc}
|
||||
#endif
|
||||
|
||||
ENTRY(__eqdf2)
|
||||
stmfd sp!, {lr}
|
||||
bl _C_LABEL(_arm_float64_eq)
|
||||
eor r0, r0, #1
|
||||
#ifdef __APCS_26__
|
||||
ldmfd sp!, {pc}^
|
||||
#else
|
||||
ldmfd sp!, {pc}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 'Not Equal' wrapper. This returns -1 or 1 (say, 1!) if the numbers are
|
||||
* not equal, 0 otherwise. However no not equal call is provided, so we have
|
||||
* to use an 'equal' call and invert the result. The result is already
|
||||
* inverted though! Confusing?!
|
||||
*/
|
||||
ENTRY(__nesf2)
|
||||
stmfd sp!, {lr}
|
||||
bl _C_LABEL(_arm_float32_eq)
|
||||
eor r0, r0, #1
|
||||
#ifdef __APCS_26__
|
||||
ldmfd sp!, {pc}^
|
||||
#else
|
||||
ldmfd sp!, {pc}
|
||||
#endif
|
||||
|
||||
ENTRY(__nedf2)
|
||||
stmfd sp!, {lr}
|
||||
bl _C_LABEL(_arm_float64_eq)
|
||||
eor r0, r0, #1
|
||||
#ifdef __APCS_26__
|
||||
ldmfd sp!, {pc}^
|
||||
#else
|
||||
ldmfd sp!, {pc}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 'Greater Than' wrapper. This returns 1 if the number is greater, 0
|
||||
* or -1 otherwise. Unfortunately, no such function exists. We have to
|
||||
* instead compare the numbers using the 'less than' calls in order to
|
||||
* make up our mind. This means that we can call 'less than or equal' and
|
||||
* invert the result.
|
||||
*/
|
||||
ENTRY(__gtsf2)
|
||||
stmfd sp!, {lr}
|
||||
bl _C_LABEL(_arm_float32_le)
|
||||
eor r0, r0, #1
|
||||
#ifdef __APCS_26__
|
||||
ldmfd sp!, {pc}^
|
||||
#else
|
||||
ldmfd sp!, {pc}
|
||||
#endif
|
||||
|
||||
ENTRY(__gtdf2)
|
||||
stmfd sp!, {lr}
|
||||
bl _C_LABEL(_arm_float64_le)
|
||||
eor r0, r0, #1
|
||||
#ifdef __APCS_26__
|
||||
ldmfd sp!, {pc}^
|
||||
#else
|
||||
ldmfd sp!, {pc}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 'Greater Than or Equal' wrapper. We emulate this by inverting the result
|
||||
* of a 'less than' call.
|
||||
*/
|
||||
ENTRY(__gesf2)
|
||||
stmfd sp!, {lr}
|
||||
bl _C_LABEL(_arm_float32_lt)
|
||||
eor r0, r0, #1
|
||||
cmp r0, #0
|
||||
mvneq r0, #0
|
||||
#ifdef __APCS_26__
|
||||
ldmfd sp!, {pc}^
|
||||
#else
|
||||
ldmfd sp!, {pc}
|
||||
#endif
|
||||
|
||||
ENTRY(__gedf2)
|
||||
stmfd sp!, {lr}
|
||||
bl _C_LABEL(_arm_float64_lt)
|
||||
eor r0, r0, #1
|
||||
cmp r0, #0
|
||||
mvneq r0, #0
|
||||
#ifdef __APCS_26__
|
||||
ldmfd sp!, {pc}^
|
||||
#else
|
||||
ldmfd sp!, {pc}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 'Less Than' wrapper. A 1 from the ARM code needs to be turned into -1.
|
||||
*/
|
||||
ENTRY(__ltsf2)
|
||||
stmfd sp!, {lr}
|
||||
bl _C_LABEL(_arm_float32_lt)
|
||||
cmp r0, #1
|
||||
mvneq r0, #0
|
||||
#ifdef __APCS_26__
|
||||
ldmfd sp!, {pc}^
|
||||
#else
|
||||
ldmfd sp!, {pc}
|
||||
#endif
|
||||
|
||||
ENTRY(__ltdf2)
|
||||
stmfd sp!, {lr}
|
||||
bl _C_LABEL(_arm_float64_lt)
|
||||
cmp r0, #1
|
||||
mvneq r0, #0
|
||||
#ifdef __APCS_26__
|
||||
ldmfd sp!, {pc}^
|
||||
#else
|
||||
ldmfd sp!, {pc}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 'Less Than or Equal' wrapper. A 0 must turn into a 1, and a 1 into a 0.
|
||||
*/
|
||||
ENTRY(__lesf2)
|
||||
stmfd sp!, {lr}
|
||||
bl _C_LABEL(_arm_float32_le)
|
||||
eor r0, r0, #1
|
||||
#ifdef __APCS_26__
|
||||
ldmfd sp!, {pc}^
|
||||
#else
|
||||
ldmfd sp!, {pc}
|
||||
#endif
|
||||
|
||||
ENTRY(__ledf2)
|
||||
stmfd sp!, {lr}
|
||||
bl _C_LABEL(_arm_float64_le)
|
||||
eor r0, r0, #1
|
||||
#ifdef __APCS_26__
|
||||
ldmfd sp!, {pc}^
|
||||
#else
|
||||
ldmfd sp!, {pc}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Float negate... This isn't provided by the library, but it's hardly the
|
||||
* hardest function in the world to write... :) In fact, because of the
|
||||
* position in the registers of arguments, the double precision version can
|
||||
* go here too ;-)
|
||||
*/
|
||||
ENTRY(__negsf2)
|
||||
ENTRY(__negdf2)
|
||||
eor r0, r0, #SIGN_BIT_TWIDDLE
|
||||
#ifdef __APCS_26__
|
||||
movs pc, lr
|
||||
#else
|
||||
mov pc, lr
|
||||
#endif
|
|
@ -0,0 +1,86 @@
|
|||
/* $NetBSD: fplib_libc.c,v 1.1 2000/05/09 21:55:46 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Neil A. Carson and Mark Brinicombe
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include "environment.h"
|
||||
#include "softfloat.h"
|
||||
|
||||
void sfp_setround __P((int rnd_dir));
|
||||
int sfp_getround __P((void));
|
||||
void sfp_setmask __P((int mask));
|
||||
int sfp_getmask __P((void));
|
||||
void sfp_setsticky __P((int except));
|
||||
int sfp_getsticky __P((void));
|
||||
|
||||
void
|
||||
sfp_setround(rnd_dir)
|
||||
int rnd_dir;
|
||||
{
|
||||
float_rounding_mode = rnd_dir;
|
||||
}
|
||||
|
||||
int
|
||||
sfp_getround(void)
|
||||
{
|
||||
return(float_rounding_mode);
|
||||
}
|
||||
|
||||
void
|
||||
sfp_setmask(mask)
|
||||
int mask;
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
sfp_getmask(void)
|
||||
{
|
||||
return(0);
|
||||
}
|
||||
|
||||
void
|
||||
sfp_setsticky(except)
|
||||
int except;
|
||||
{
|
||||
float_exception_flags = except;
|
||||
}
|
||||
|
||||
int
|
||||
sfp_getsticky(void)
|
||||
{
|
||||
return(float_exception_flags);
|
||||
}
|
|
@ -0,0 +1,754 @@
|
|||
/* $NetBSD: softfloat-macros.h,v 1.1 2000/05/09 21:55:46 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
This C source fragment is part of the SoftFloat IEC/IEEE Floating-point
|
||||
Arithmetic Package, Release 1a.
|
||||
|
||||
Written by John R. Hauser. This work was made possible by the International
|
||||
Computer Science Institute, located at Suite 600, 1947 Center Street,
|
||||
Berkeley, California 94704. Funding was provided in part by the National
|
||||
Science Foundation under grant MIP-9311980. The original version of
|
||||
this code was written as part of a project to build a fixed-point vector
|
||||
processor in collaboration with the University of California at Berkeley,
|
||||
overseen by Profs. Nelson Morgan and John Wawrzynek. More information
|
||||
is available through the web page `http://www.cs.berkeley.edu/~jhauser/
|
||||
softfloat.html'.
|
||||
|
||||
THIS PACKAGE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has
|
||||
been made to avoid it, THIS PACKAGE MAY CONTAIN FAULTS THAT WILL AT TIMES
|
||||
RESULT IN INCORRECT BEHAVIOR. USE OF THIS PACKAGE IS RESTRICTED TO PERSONS
|
||||
AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY AND ALL
|
||||
LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
|
||||
|
||||
Derivative works are acceptable, even for commercial purposes, so long as
|
||||
(1) they include prominent notice that the work is derivative, and (2) they
|
||||
include prominent notice akin to these three paragraphs for those parts of
|
||||
this code that are retained.
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
INLINE void shiftDown32Jamming( bits32 a, uint16 count, bits32 *zPtr );
|
||||
|
||||
INLINE void shiftDown64ExtraJamming(
|
||||
bits32 a0,
|
||||
bits32 a1,
|
||||
bits32 a2,
|
||||
uint16 count,
|
||||
bits32 *z0Ptr,
|
||||
bits32 *z1Ptr,
|
||||
bits32 *z2Ptr
|
||||
);
|
||||
|
||||
INLINE void shiftDown64Jamming(
|
||||
bits32 a0, bits32 a1, uint16 count, bits32 *z0Ptr, bits32 *z1Ptr );
|
||||
|
||||
INLINE void shiftDown64(
|
||||
bits32 a0, bits32 a1, uint16 count, bits32 *z0Ptr, bits32 *z1Ptr );
|
||||
|
||||
INLINE void shortShiftUp64(
|
||||
bits32 a0, bits32 a1, uint16 count, bits32 *z0Ptr, bits32 *z1Ptr );
|
||||
|
||||
INLINE void shortShiftUp96(
|
||||
bits32 a0,
|
||||
bits32 a1,
|
||||
bits32 a2,
|
||||
uint16 count,
|
||||
bits32 *z0Ptr,
|
||||
bits32 *z1Ptr,
|
||||
bits32 *z2Ptr
|
||||
);
|
||||
|
||||
INLINE void add64(
|
||||
bits32 a0, bits32 a1, bits32 b0, bits32 b1, bits32 *z0Ptr, bits32 *z1Ptr );
|
||||
|
||||
INLINE void add96(
|
||||
bits32 a0,
|
||||
bits32 a1,
|
||||
bits32 a2,
|
||||
bits32 b0,
|
||||
bits32 b1,
|
||||
bits32 b2,
|
||||
bits32 *z0Ptr,
|
||||
bits32 *z1Ptr,
|
||||
bits32 *z2Ptr
|
||||
);
|
||||
|
||||
INLINE void sub64(
|
||||
bits32 a0, bits32 a1, bits32 b0, bits32 b1, bits32 *z0Ptr, bits32 *z1Ptr );
|
||||
|
||||
INLINE void sub96(
|
||||
bits32 a0,
|
||||
bits32 a1,
|
||||
bits32 a2,
|
||||
bits32 b0,
|
||||
bits32 b1,
|
||||
bits32 b2,
|
||||
bits32 *z0Ptr,
|
||||
bits32 *z1Ptr,
|
||||
bits32 *z2Ptr
|
||||
);
|
||||
|
||||
INLINE void mul32To64( bits32 a, bits32 b, bits32 *z0Ptr, bits32 *z1Ptr );
|
||||
|
||||
INLINE void mul64By32To96(
|
||||
bits32 a0,
|
||||
bits32 a1,
|
||||
bits32 b,
|
||||
bits32 *z0Ptr,
|
||||
bits32 *z1Ptr,
|
||||
bits32 *z2Ptr
|
||||
);
|
||||
|
||||
INLINE void mul64To128(
|
||||
bits32 a0,
|
||||
bits32 a1,
|
||||
bits32 b0,
|
||||
bits32 b1,
|
||||
bits32 *z0Ptr,
|
||||
bits32 *z1Ptr,
|
||||
bits32 *z2Ptr,
|
||||
bits32 *z3Ptr
|
||||
);
|
||||
|
||||
static bits32 estimateDiv64To32( bits32 a0, bits32 a1, bits32 b );
|
||||
|
||||
#if 0 /* unused */
|
||||
static bits32 estimateSqrt32( int16 aExp, bits32 a );
|
||||
#endif
|
||||
|
||||
static int8 countLeadingZeros( bits32 a );
|
||||
|
||||
INLINE flag eq64( bits32 a0, bits32 a1, bits32 b0, bits32 b1 );
|
||||
|
||||
INLINE flag le64( bits32 a0, bits32 a1, bits32 b0, bits32 b1 );
|
||||
|
||||
INLINE flag lt64( bits32 a0, bits32 a1, bits32 b0, bits32 b1 );
|
||||
|
||||
#if 0 /* XXX not used */
|
||||
INLINE flag ne64( bits32 a0, bits32 a1, bits32 b0, bits32 b1 );
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Shifts `a' down by the number of bits given in `count'. If any nonzero bits
|
||||
are shifted off, they are ``jammed'' into the least significant bit of the
|
||||
result by setting the least significant bit to 1. The value of `count' can
|
||||
be arbitrarily large; in particular, if `count' is greater than 32, the
|
||||
result will be either 0 or 1, depending on whether `a' is zero or nonzero.
|
||||
The result is stored in the location pointed to by `zPtr'.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
INLINE void shiftDown32Jamming( bits32 a, uint16 count, bits32 *zPtr )
|
||||
{
|
||||
bits32 z;
|
||||
|
||||
if ( count == 0 ) {
|
||||
z = a;
|
||||
}
|
||||
else if ( count < 32 ) {
|
||||
z = ( a>>count ) | ( 0 < ( a<<( ( - count ) & 31 ) ) );
|
||||
}
|
||||
else {
|
||||
z = ( 0 < a );
|
||||
}
|
||||
*zPtr = z;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Shifts the 96-bit value formed by concatenating `a0', `a1', and `a2' down by
|
||||
32 _plus_ the number of bits given in `count'. The shifted-down result is
|
||||
at most 64 nonzero bits; these are broken into two 32-bit pieces which are
|
||||
stored at the locations pointed to by `z0Ptr' and `z1Ptr'. The bits shifted
|
||||
off form a third 32-bit result as follows: The _last_ bit shifted off is
|
||||
the most-significant bit of the extra result, and the other 31 bits of the
|
||||
extra result are all zero if and only if _all_but_the_last_ bits shifted off
|
||||
were all zero. This extra result is stored in the location pointed to by
|
||||
`z2Ptr'. The value of `count' can be arbitrarily large.
|
||||
(This routine makes more sense if `a0', `a1', and `a2' are considered
|
||||
to form a fixed-point value with binary point between `a1' and `a2'. This
|
||||
fixed-point value is shifted down by the number of bits given in `count',
|
||||
and the integer part of the result is returned at the locations pointed to
|
||||
by `z0Ptr' and `z1Ptr'. The fractional part of the result may be slightly
|
||||
corrupted as described above, and is returned at the location pointed to by
|
||||
`z2Ptr'.)
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
INLINE void
|
||||
shiftDown64ExtraJamming(
|
||||
bits32 a0,
|
||||
bits32 a1,
|
||||
bits32 a2,
|
||||
uint16 count,
|
||||
bits32 *z0Ptr,
|
||||
bits32 *z1Ptr,
|
||||
bits32 *z2Ptr
|
||||
)
|
||||
{
|
||||
bits32 z0, z1, z2;
|
||||
int8 negCount = ( - count ) & 31;
|
||||
|
||||
if ( count == 0 ) {
|
||||
z2 = a2;
|
||||
z1 = a1;
|
||||
z0 = a0;
|
||||
}
|
||||
else {
|
||||
if ( count < 32 ) {
|
||||
z2 = a1<<negCount;
|
||||
z1 = ( a0<<negCount ) | ( a1>>count );
|
||||
z0 = a0>>count;
|
||||
}
|
||||
else {
|
||||
if ( count == 32 ) {
|
||||
z2 = a1;
|
||||
z1 = a0;
|
||||
}
|
||||
else {
|
||||
a2 |= a1;
|
||||
if ( count < 64 ) {
|
||||
z2 = a0<<negCount;
|
||||
z1 = a0>>( count & 31 );
|
||||
}
|
||||
else {
|
||||
z2 = ( count == 64 ) ? a0 : ( 0 < a0 );
|
||||
z1 = 0;
|
||||
}
|
||||
}
|
||||
z0 = 0;
|
||||
}
|
||||
z2 |= ( 0 < a2 );
|
||||
}
|
||||
*z2Ptr = z2;
|
||||
*z1Ptr = z1;
|
||||
*z0Ptr = z0;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Shifts the 64-bit value formed by concatenating `a0' and `a1' down by the
|
||||
number of bits given in `count'. If any nonzero bits are shifted off, they
|
||||
are ``jammed'' into the least significant bit of the result by setting the
|
||||
least significant bit to 1. The value of `count' can be arbitrarily large;
|
||||
in particular, if `count' is greater than 64, the result will be either 0
|
||||
or 1, depending on whether the concatenation of `a0' and `a1' is zero or
|
||||
nonzero. The result is broken into two 32-bit pieces which are stored at
|
||||
the locations pointed to by `z0Ptr' and `z1Ptr'.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
INLINE void
|
||||
shiftDown64Jamming(
|
||||
bits32 a0, bits32 a1, uint16 count, bits32 *z0Ptr, bits32 *z1Ptr )
|
||||
{
|
||||
bits32 z0, z1;
|
||||
int8 negCount = ( - count ) & 31;
|
||||
|
||||
if ( count == 0 ) {
|
||||
z1 = a1;
|
||||
z0 = a0;
|
||||
}
|
||||
else if ( count < 32 ) {
|
||||
z1 = ( a0<<negCount ) | ( a1>>count ) | ( 0 < ( a1<<negCount ) );
|
||||
z0 = a0>>count;
|
||||
}
|
||||
else {
|
||||
if ( count == 32 ) {
|
||||
z1 = a0 | ( 0 < a1 );
|
||||
}
|
||||
else if ( count < 64 ) {
|
||||
z1 = ( a0>>( count & 31 ) ) | ( 0 < ( ( a0<<negCount ) | a1 ) );
|
||||
}
|
||||
else {
|
||||
z1 = ( 0 < ( a0 | a1 ) );
|
||||
}
|
||||
z0 = 0;
|
||||
}
|
||||
*z1Ptr = z1;
|
||||
*z0Ptr = z0;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Shifts the 64-bit value formed by concatenating `a0' and `a1' down by the
|
||||
number of bits given in `count'. Any bits shifted off are lost. The value
|
||||
of `count' can be arbitrarily large; in particular, if `count' is greater
|
||||
than 64, the result will be 0. The result is broken into two 32-bit pieces
|
||||
which are stored at the locations pointed to by `z0Ptr' and `z1Ptr'.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
INLINE void
|
||||
shiftDown64(
|
||||
bits32 a0, bits32 a1, uint16 count, bits32 *z0Ptr, bits32 *z1Ptr )
|
||||
{
|
||||
bits32 z0, z1;
|
||||
int8 negCount = ( - count ) & 31;
|
||||
|
||||
if ( count == 0 ) {
|
||||
z1 = a1;
|
||||
z0 = a0;
|
||||
}
|
||||
else if ( count < 32 ) {
|
||||
z1 = ( a0<<negCount ) | ( a1>>count );
|
||||
z0 = a0>>count;
|
||||
}
|
||||
else {
|
||||
z1 = ( count < 64 ) ? ( a0>>( count & 31 ) ) : 0;
|
||||
z0 = 0;
|
||||
}
|
||||
*z1Ptr = z1;
|
||||
*z0Ptr = z0;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Shifts the 64-bit value formed by concatenating `a0' and `a1' up by the
|
||||
number of bits given in `count'. Any bits shifted off are lost. The value
|
||||
of `count' must be less than 32. The result is broken into two 32-bit
|
||||
pieces which are stored at the locations pointed to by `z0Ptr' and `z1Ptr'.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
INLINE void
|
||||
shortShiftUp64(
|
||||
bits32 a0, bits32 a1, uint16 count, bits32 *z0Ptr, bits32 *z1Ptr )
|
||||
{
|
||||
|
||||
*z1Ptr = a1<<count;
|
||||
*z0Ptr =
|
||||
( count == 0 ) ? a0 : ( a0<<count ) | ( a1>>( ( - count ) & 31 ) );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Shifts the 96-bit value formed by concatenating `a0', `a1', and `a2' up by
|
||||
the number of bits given in `count'. Any bits shifted off are lost. The
|
||||
value of `count' must be less than 32. The result is broken into three
|
||||
32-bit pieces which are stored at the locations pointed to by `z0Ptr',
|
||||
`z1Ptr', and `z2Ptr'.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
INLINE void
|
||||
shortShiftUp96(
|
||||
bits32 a0,
|
||||
bits32 a1,
|
||||
bits32 a2,
|
||||
uint16 count,
|
||||
bits32 *z0Ptr,
|
||||
bits32 *z1Ptr,
|
||||
bits32 *z2Ptr
|
||||
)
|
||||
{
|
||||
bits32 z0, z1, z2;
|
||||
int8 negCount;
|
||||
|
||||
z2 = a2<<count;
|
||||
z1 = a1<<count;
|
||||
z0 = a0<<count;
|
||||
if ( 0 < count ) {
|
||||
negCount = ( ( - count ) & 31 );
|
||||
z1 |= a2>>negCount;
|
||||
z0 |= a1>>negCount;
|
||||
}
|
||||
*z2Ptr = z2;
|
||||
*z1Ptr = z1;
|
||||
*z0Ptr = z0;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Adds the 64-bit value formed by concatenating `a0' and `a1' to the 64-bit
|
||||
value formed by concatenating `b0' and `b1'. Addition is modulo 2^64, so
|
||||
any carry out is lost. The result is broken into two 32-bit pieces which
|
||||
are stored at the locations pointed to by `z0Ptr' and `z1Ptr'.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
INLINE void
|
||||
add64(
|
||||
bits32 a0, bits32 a1, bits32 b0, bits32 b1, bits32 *z0Ptr, bits32 *z1Ptr )
|
||||
{
|
||||
bits32 z1;
|
||||
|
||||
z1 = a1 + b1;
|
||||
*z1Ptr = z1;
|
||||
*z0Ptr = a0 + b0 + ( z1 < a1 );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Adds the 96-bit value formed by concatenating `a0', `a1', and `a2' to the
|
||||
96-bit value formed by concatenating `b0', `b1', and `b2'. Addition is
|
||||
modulo 2^96, so any carry out is lost. The result is broken into three
|
||||
32-bit pieces which are stored at the locations pointed to by `z0Ptr',
|
||||
`z1Ptr', and `z2Ptr'.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
INLINE void
|
||||
add96(
|
||||
bits32 a0,
|
||||
bits32 a1,
|
||||
bits32 a2,
|
||||
bits32 b0,
|
||||
bits32 b1,
|
||||
bits32 b2,
|
||||
bits32 *z0Ptr,
|
||||
bits32 *z1Ptr,
|
||||
bits32 *z2Ptr
|
||||
)
|
||||
{
|
||||
bits32 z0, z1, z2;
|
||||
int8 carry0, carry1;
|
||||
|
||||
z2 = a2 + b2;
|
||||
carry1 = ( z2 < a2 );
|
||||
z1 = a1 + b1;
|
||||
carry0 = ( z1 < a1 );
|
||||
z0 = a0 + b0;
|
||||
z1 += carry1;
|
||||
z0 += ( z1 < carry1 );
|
||||
z0 += carry0;
|
||||
*z2Ptr = z2;
|
||||
*z1Ptr = z1;
|
||||
*z0Ptr = z0;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Subtracts the 64-bit value formed by concatenating `b0' and `b1' from the
|
||||
64-bit value formed by concatenating `a0' and `a1'. Subtraction is modulo
|
||||
2^64, so any borrow out (carry out) is lost. The result is broken into two
|
||||
32-bit pieces which are stored at the locations pointed to by `z0Ptr' and
|
||||
`z1Ptr'.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
INLINE void
|
||||
sub64(
|
||||
bits32 a0, bits32 a1, bits32 b0, bits32 b1, bits32 *z0Ptr, bits32 *z1Ptr )
|
||||
{
|
||||
|
||||
*z1Ptr = a1 - b1;
|
||||
*z0Ptr = a0 - b0 - ( a1 < b1 );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Subtracts the 96-bit value formed by concatenating `b0', `b1', and `b2' from
|
||||
the 96-bit value formed by concatenating `a0', `a1', and `a2'. Subtraction
|
||||
is modulo 2^96, so any borrow out (carry out) is lost. The result is broken
|
||||
into three 32-bit pieces which are stored at the locations pointed to by
|
||||
`z0Ptr', `z1Ptr', and `z2Ptr'.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
INLINE void
|
||||
sub96(
|
||||
bits32 a0,
|
||||
bits32 a1,
|
||||
bits32 a2,
|
||||
bits32 b0,
|
||||
bits32 b1,
|
||||
bits32 b2,
|
||||
bits32 *z0Ptr,
|
||||
bits32 *z1Ptr,
|
||||
bits32 *z2Ptr
|
||||
)
|
||||
{
|
||||
bits32 z0, z1, z2;
|
||||
int8 borrow0, borrow1;
|
||||
|
||||
z2 = a2 - b2;
|
||||
borrow1 = ( a2 < b2 );
|
||||
z1 = a1 - b1;
|
||||
borrow0 = ( a1 < b1 );
|
||||
z0 = a0 - b0;
|
||||
z0 -= ( z1 < borrow1 );
|
||||
z1 -= borrow1;
|
||||
z0 -= borrow0;
|
||||
*z2Ptr = z2;
|
||||
*z1Ptr = z1;
|
||||
*z0Ptr = z0;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Multiplies `a' by `b' to obtain a 64-bit product. The product is broken
|
||||
into two 32-bit pieces which are stored at the locations pointed to by
|
||||
`z0Ptr' and `z1Ptr'.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
INLINE void mul32To64( bits32 a, bits32 b, bits32 *z0Ptr, bits32 *z1Ptr )
|
||||
{
|
||||
bits16 aHigh, aLow, bHigh, bLow;
|
||||
bits32 z0, zMiddle, zMiddleOther, z1;
|
||||
|
||||
aLow = ( a & 0xFFFF );
|
||||
aHigh = a>>16;
|
||||
bLow = ( b & 0xFFFF );
|
||||
bHigh = b>>16;
|
||||
z1 = aLow * bLow;
|
||||
zMiddle = aLow * bHigh;
|
||||
zMiddleOther = aHigh * bLow;
|
||||
z0 = aHigh * bHigh;
|
||||
zMiddle += zMiddleOther;
|
||||
z0 += ( ( zMiddle < zMiddleOther )<<16 ) + ( zMiddle>>16 );
|
||||
zMiddle = zMiddle<<16;
|
||||
z1 += zMiddle;
|
||||
z0 += ( z1 < zMiddle );
|
||||
*z1Ptr = z1;
|
||||
*z0Ptr = z0;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Multiplies the 64-bit value formed by concatenating `a0' and `a1' by `b' to
|
||||
obtain a 96-bit product. The product is broken into three 32-bit pieces
|
||||
which are stored at the locations pointed to by `z0Ptr', `z1Ptr', and
|
||||
`z2Ptr'.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
INLINE void
|
||||
mul64By32To96(
|
||||
bits32 a0,
|
||||
bits32 a1,
|
||||
bits32 b,
|
||||
bits32 *z0Ptr,
|
||||
bits32 *z1Ptr,
|
||||
bits32 *z2Ptr
|
||||
)
|
||||
{
|
||||
bits32 z0, z1, z2, more1;
|
||||
|
||||
mul32To64( a1, b, &z1, &z2 );
|
||||
mul32To64( a0, b, &z0, &more1 );
|
||||
add64( z0, more1, 0, z1, &z0, &z1 );
|
||||
*z2Ptr = z2;
|
||||
*z1Ptr = z1;
|
||||
*z0Ptr = z0;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Multiplies the 64-bit value formed by concatenating `a0' and `a1' to the
|
||||
64-bit value formed by concatenating `b0' and `b1' to obtain a 128-bit
|
||||
product. The product is broken into four 32-bit pieces which are stored at
|
||||
the locations pointed to by `z0Ptr', `z1Ptr', `z2Ptr', and `z3Ptr'.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
INLINE void
|
||||
mul64To128(
|
||||
bits32 a0,
|
||||
bits32 a1,
|
||||
bits32 b0,
|
||||
bits32 b1,
|
||||
bits32 *z0Ptr,
|
||||
bits32 *z1Ptr,
|
||||
bits32 *z2Ptr,
|
||||
bits32 *z3Ptr
|
||||
)
|
||||
{
|
||||
bits32 z0, z1, z2, z3;
|
||||
bits32 more1, more2;
|
||||
|
||||
mul32To64( a1, b1, &z2, &z3 );
|
||||
mul32To64( a1, b0, &z1, &more2 );
|
||||
add64( z1, more2, 0, z2, &z1, &z2 );
|
||||
mul32To64( a0, b0, &z0, &more1 );
|
||||
add64( z0, more1, 0, z1, &z0, &z1 );
|
||||
mul32To64( a0, b1, &more1, &more2 );
|
||||
add64( more1, more2, 0, z2, &more1, &z2 );
|
||||
add64( z0, z1, 0, more1, &z0, &z1 );
|
||||
*z3Ptr = z3;
|
||||
*z2Ptr = z2;
|
||||
*z1Ptr = z1;
|
||||
*z0Ptr = z0;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Returns an approximation to the 32-bit integer quotient obtained by dividing
|
||||
the 64-bit value formed by concatenating `a0' and `a1' by `b'. The divisor
|
||||
`b' must be at least 2^31. If q is the exact quotient truncated toward
|
||||
zero, the approximation returned lies between q and q + 2 inclusive. If
|
||||
the exact quotient q is larger than 32 bits, the maximum positive 32-bit
|
||||
unsigned integer is returned.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
static bits32 estimateDiv64To32( bits32 a0, bits32 a1, bits32 b )
|
||||
{
|
||||
bits32 z;
|
||||
bits32 rem0, rem1;
|
||||
bits32 term0, term1;
|
||||
bits32 b0, b1;
|
||||
|
||||
if ( b <= a0 ) return 0xFFFFFFFF;
|
||||
b0 = b>>16;
|
||||
z = ( b0<<16 <= a0 ) ? 0xFFFF0000 : ( a0 / b0 )<<16;
|
||||
mul32To64( b, z, &term0, &term1 );
|
||||
sub64( a0, a1, term0, term1, &rem0, &rem1 );
|
||||
while ( ( (sbits32) rem0 ) < 0 ) {
|
||||
z -= 0x10000;
|
||||
b1 = b<<16;
|
||||
add64( rem0, rem1, b0, b1, &rem0, &rem1 );
|
||||
}
|
||||
rem0 = ( rem0<<16 ) | ( rem1>>16 );
|
||||
z |= ( b0<<16 <= rem0 ) ? 0xFFFF : rem0 / b0;
|
||||
return z;
|
||||
|
||||
}
|
||||
|
||||
#if 0 /* unused */
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Returns an approximation to the square root of the 32-bit significand given
|
||||
by `a'. Considered as an integer, `a' must be at least 2^31. If bit 0 of
|
||||
`aExp' (the least significant bit) is 1, the integer returned approximates
|
||||
2^31*sqrt(`a'/2^31), where `a' is considered an integer. If bit 0 of `aExp'
|
||||
is 0, the integer returned approximates 2^31*sqrt(`a'/2^30). In either
|
||||
case, the approximation returned lies strictly within +/-2 of the exact
|
||||
value.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
static bits32 estimateSqrt32( int16 aExp, bits32 a )
|
||||
{
|
||||
static const bits16 sqrtOddAdjustments[] = {
|
||||
0x0004, 0x0022, 0x005D, 0x00B1, 0x011D, 0x019F, 0x0236, 0x02E0,
|
||||
0x039C, 0x0468, 0x0545, 0x0631, 0x072B, 0x0832, 0x0946, 0x0A67
|
||||
};
|
||||
static const bits16 sqrtEvenAdjustments[] = {
|
||||
0x0A2D, 0x08AF, 0x075A, 0x0629, 0x051A, 0x0429, 0x0356, 0x029E,
|
||||
0x0200, 0x0179, 0x0109, 0x00AF, 0x0068, 0x0034, 0x0012, 0x0002
|
||||
};
|
||||
int8 index;
|
||||
bits32 z;
|
||||
|
||||
index = ( a>>27 ) & 15;
|
||||
if ( aExp & 1 ) {
|
||||
z = 0x4000 + ( a>>17 ) - sqrtOddAdjustments[ index ];
|
||||
z = ( ( a / z )<<14 ) + ( z<<15 );
|
||||
a = a>>1;
|
||||
}
|
||||
else {
|
||||
z = 0x8000 + ( a>>17 ) - sqrtEvenAdjustments[ index ];
|
||||
z = ( ( a / z ) + z );
|
||||
z = ( 0x20000 <= z ) ? 0xFFFF8000 : ( z<<15 );
|
||||
if ( z <= a ) return (bits32) ( ( (sbits32) a )>>1 );
|
||||
}
|
||||
return ( ( estimateDiv64To32( a, 0, z ) )>>1 ) + ( z>>1 );
|
||||
|
||||
}
|
||||
#endif /* unused */
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Returns the number of leading 0 bits before the most-significant 1 bit
|
||||
of `a'. If `a' is zero, 32 is returned.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
static int8 countLeadingZeros( bits32 a )
|
||||
{
|
||||
static const int8 countLeadingZerosHigh[] = {
|
||||
8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
};
|
||||
int8 shiftCount;
|
||||
|
||||
shiftCount = 0;
|
||||
if ( a < 0x10000 ) {
|
||||
shiftCount += 16;
|
||||
a = a<<16;
|
||||
}
|
||||
if ( a < 0x1000000 ) {
|
||||
shiftCount += 8;
|
||||
a = a<<8;
|
||||
}
|
||||
shiftCount += countLeadingZerosHigh[ a>>24 ];
|
||||
return shiftCount;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Returns 1 if the 64-bit value formed by concatenating `a0' and `a1' is equal
|
||||
to the 64-bit value formed by concatenating `b0' and `b1'. Otherwise,
|
||||
returns 0.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
INLINE flag eq64( bits32 a0, bits32 a1, bits32 b0, bits32 b1 )
|
||||
{
|
||||
|
||||
return ( a0 == b0 ) && ( a1 == b1 );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Returns 1 if the 64-bit value formed by concatenating `a0' and `a1' is less
|
||||
than or equal to the 64-bit value formed by concatenating `b0' and `b1'.
|
||||
Otherwise, returns 0.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
INLINE flag le64( bits32 a0, bits32 a1, bits32 b0, bits32 b1 )
|
||||
{
|
||||
|
||||
return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 <= b1 ) );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Returns 1 if the 64-bit value formed by concatenating `a0' and `a1' is less
|
||||
than the 64-bit value formed by concatenating `b0' and `b1'. Otherwise,
|
||||
returns 0.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
INLINE flag lt64( bits32 a0, bits32 a1, bits32 b0, bits32 b1 )
|
||||
{
|
||||
|
||||
return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 < b1 ) );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Returns 1 if the 64-bit value formed by concatenating `a0' and `a1' is not
|
||||
equal to the 64-bit value formed by concatenating `b0' and `b1'. Otherwise,
|
||||
returns 0.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
#if 0 /* XXX not used */
|
||||
INLINE flag ne64( bits32 a0, bits32 a1, bits32 b0, bits32 b1 )
|
||||
{
|
||||
|
||||
return ( a0 != b0 ) || ( a1 != b1 );
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
@ -0,0 +1,173 @@
|
|||
/* $NetBSD: softfloat-specialize.h,v 1.1 2000/05/09 21:55:46 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
This C source fragment is part of the SoftFloat IEC/IEEE Floating-point
|
||||
Arithmetic Package, Release 1a.
|
||||
|
||||
Written by John R. Hauser. This work was made possible by the International
|
||||
Computer Science Institute, located at Suite 600, 1947 Center Street,
|
||||
Berkeley, California 94704. Funding was provided in part by the National
|
||||
Science Foundation under grant MIP-9311980. The original version of
|
||||
this code was written as part of a project to build a fixed-point vector
|
||||
processor in collaboration with the University of California at Berkeley,
|
||||
overseen by Profs. Nelson Morgan and John Wawrzynek. More information
|
||||
is available through the web page `http://www.cs.berkeley.edu/~jhauser/
|
||||
softfloat.html'.
|
||||
|
||||
THIS PACKAGE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has
|
||||
been made to avoid it, THIS PACKAGE MAY CONTAIN FAULTS THAT WILL AT TIMES
|
||||
RESULT IN INCORRECT BEHAVIOR. USE OF THIS PACKAGE IS RESTRICTED TO PERSONS
|
||||
AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY AND ALL
|
||||
LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
|
||||
|
||||
Derivative works are acceptable, even for commercial purposes, so long as
|
||||
(1) they include prominent notice that the work is derivative, and (2) they
|
||||
include prominent notice akin to these three paragraphs for those parts of
|
||||
this code that are retained.
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
static flag float32_is_signaling_nan( float32 a );
|
||||
static flag float64_is_signaling_nan( float64 a );
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Underflow tininess-detection mode. (Statically initialized to default.)
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
static flag float_detect_tininess = float_tininess_after_rounding;
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Raises the exceptions specified by `flags'. Floating-point traps can be
|
||||
defined here if desired. It is currently not possible for such a trap to
|
||||
substitute a result value. If traps are not implemented, this routine
|
||||
should be simply `float_exception_flags |= flags;'.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
void float_raise( uint8 flags )
|
||||
{
|
||||
|
||||
float_exception_flags |= flags;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
The pattern for a default generated single-precision NaN.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
enum {
|
||||
float32_default_nan = 0xFFC00000
|
||||
};
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
The pattern for a default generated double-precision NaN. The `high' and
|
||||
`low' words hold the most- and least-significant bits, respectively.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
enum {
|
||||
float64_default_nan_high = 0xFFF80000,
|
||||
float64_default_nan_low = 0x00000000
|
||||
};
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Returns true if the single-precision floating-point value `a' is a signaling
|
||||
NaN; otherwise returns false.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
static flag float32_is_signaling_nan( float32 a )
|
||||
{
|
||||
|
||||
return ( ( a & 0x7FC00000 ) == 0x7F800000 ) && ( a & 0x003FFFFF );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Returns true if the double-precision floating-point value `a' is a signaling
|
||||
NaN; otherwise returns false.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
static flag float64_is_signaling_nan( float64 a )
|
||||
{
|
||||
|
||||
return
|
||||
( ( a.high & 0x7FF80000 ) == 0x7FF00000 )
|
||||
&& ( ( a.high & 0x0007FFFF ) || a.low );
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Converts a single-precision NaN `a' to a double-precision quiet NaN. If `a'
|
||||
is a signaling NaN, the invalid exception is raised.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
static float64 float32ToFloat64NaN( float32 a )
|
||||
{
|
||||
float64 z;
|
||||
|
||||
if ( float32_is_signaling_nan( a ) ) float_raise( float_flag_invalid );
|
||||
z.low = float64_default_nan_low;
|
||||
z.high = float64_default_nan_high;
|
||||
return z;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Converts a double-precision NaN `a' to a single-precision quiet NaN. If `a'
|
||||
is a signaling NaN, the invalid exception is raised.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
static float32 float64ToFloat32NaN( float64 a )
|
||||
{
|
||||
|
||||
if ( float64_is_signaling_nan( a ) ) float_raise( float_flag_invalid );
|
||||
return float32_default_nan;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Takes two single-precision floating-point values `a' and `b', one of which
|
||||
is a NaN, and returns the appropriate NaN result. If either `a' or `b' is a
|
||||
signaling NaN, the invalid exception is raised.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
static float32 propagateFloat32NaN( float32 a, float32 b )
|
||||
{
|
||||
|
||||
if ( float32_is_signaling_nan( a ) || float32_is_signaling_nan( b ) ) {
|
||||
float_raise( float_flag_invalid );
|
||||
}
|
||||
return float32_default_nan;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Takes two double-precision floating-point values `a' and `b', one of which
|
||||
is a NaN, and returns the appropriate NaN result. If either `a' or `b' is a
|
||||
signaling NaN, the invalid exception is raised.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
static float64 propagateFloat64NaN( float64 a, float64 b )
|
||||
{
|
||||
float64 z;
|
||||
|
||||
if ( float64_is_signaling_nan( a ) || float64_is_signaling_nan( b ) ) {
|
||||
float_raise( float_flag_invalid );
|
||||
}
|
||||
z.low = float64_default_nan_low;
|
||||
z.high = float64_default_nan_high;
|
||||
return z;
|
||||
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,166 @@
|
|||
/* $NetBSD: softfloat.h,v 1.1 2000/05/09 21:55:46 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
This C header file is part of the SoftFloat IEC/IEEE Floating-point
|
||||
Arithmetic Package, Release 1a.
|
||||
|
||||
Written by John R. Hauser. This work was made possible by the International
|
||||
Computer Science Institute, located at Suite 600, 1947 Center Street,
|
||||
Berkeley, California 94704. Funding was provided in part by the National
|
||||
Science Foundation under grant MIP-9311980. The original version of
|
||||
this code was written as part of a project to build a fixed-point vector
|
||||
processor in collaboration with the University of California at Berkeley,
|
||||
overseen by Profs. Nelson Morgan and John Wawrzynek. More information
|
||||
is available through the web page `http://www.cs.berkeley.edu/~jhauser/
|
||||
softfloat.html'.
|
||||
|
||||
THIS PACKAGE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort has
|
||||
been made to avoid it, THIS PACKAGE MAY CONTAIN FAULTS THAT WILL AT TIMES
|
||||
RESULT IN INCORRECT BEHAVIOR. USE OF THIS PACKAGE IS RESTRICTED TO PERSONS
|
||||
AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY AND ALL
|
||||
LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
|
||||
|
||||
Derivative works are acceptable, even for commercial purposes, so long as
|
||||
(1) they include prominent notice that the work is derivative, and (2) they
|
||||
include prominent notice akin to these three paragraphs for those parts of
|
||||
this code that are retained.
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
#include <machine/ieeefp.h>
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Software IEC/IEEE floating-point types.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
typedef unsigned int float32;
|
||||
typedef struct {
|
||||
unsigned int high;
|
||||
unsigned int low;
|
||||
} float64;
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Software IEC/IEEE floating-point rounding mode and exception flags.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
extern unsigned char float_rounding_mode;
|
||||
extern unsigned char float_exception_flags;
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Floating-point rounding mode codes.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
enum {
|
||||
float_round_nearest_even = FP_RN,
|
||||
float_round_up = FP_RP,
|
||||
float_round_down = FP_RM,
|
||||
float_round_to_zero = FP_RZ
|
||||
};
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Floating-point exception flag masks.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
enum {
|
||||
float_flag_invalid = FP_X_INV,
|
||||
float_flag_divbyzero = FP_X_DZ,
|
||||
float_flag_overflow = FP_X_OFL,
|
||||
float_flag_underflow = FP_X_UFL,
|
||||
float_flag_inexact = FP_X_IMP
|
||||
};
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Floating-point underflow tininess-detection mode.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
extern char float_detect_tininess;
|
||||
enum {
|
||||
float_tininess_before_rounding = 0,
|
||||
float_tininess_after_rounding = 1
|
||||
};
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Routine to raise any or all of the software IEC/IEEE floating-point
|
||||
exception flags.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
void float_raise( unsigned char );
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Software IEC/IEEE floating-point conversion routines.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
float32 int32_to_float32( int );
|
||||
float64 int32_to_float64( int );
|
||||
#if 0 /* unused */
|
||||
static int float32_to_int32( float32 );
|
||||
#endif
|
||||
int float32_to_int32_round_to_zero( float32 );
|
||||
float64 float32_to_float64( float32 );
|
||||
#if 0 /* unused */
|
||||
static int float64_to_int32( float64 );
|
||||
#endif
|
||||
int float64_to_int32_round_to_zero( float64 );
|
||||
float32 float64_to_float32( float64 );
|
||||
unsigned int float64_to_uint32_round_to_zero( float64 a );
|
||||
unsigned int float32_to_uint32_round_to_zero( float32 a );
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Software IEC/IEEE single-precision operations.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
#if 0 /* unused */
|
||||
static float32 float32_round_to_int( float32 );
|
||||
#endif
|
||||
float32 float32_add( float32, float32 );
|
||||
float32 float32_sub( float32, float32 );
|
||||
float32 float32_mul( float32, float32 );
|
||||
float32 float32_div( float32, float32 );
|
||||
#if 0 /* unused */
|
||||
static float32 float32_rem( float32, float32 );
|
||||
static float32 float32_sqrt( float32 );
|
||||
#endif
|
||||
char float32_eq( float32, float32 );
|
||||
char float32_le( float32, float32 );
|
||||
char float32_lt( float32, float32 );
|
||||
#if 0 /* unused */
|
||||
static char float32_eq_signaling( float32, float32 );
|
||||
static char float32_le_quiet( float32, float32 );
|
||||
static char float32_lt_quiet( float32, float32 );
|
||||
#endif
|
||||
|
||||
/*
|
||||
-------------------------------------------------------------------------------
|
||||
Software IEC/IEEE double-precision operations.
|
||||
-------------------------------------------------------------------------------
|
||||
*/
|
||||
#if 0 /* unused */
|
||||
static float64 float64_round_to_int( float64 );
|
||||
#endif
|
||||
float64 float64_add( float64, float64 );
|
||||
float64 float64_sub( float64, float64 );
|
||||
float64 float64_mul( float64, float64 );
|
||||
float64 float64_div( float64, float64 );
|
||||
#if 0 /* unused */
|
||||
static float64 float64_rem( float64, float64 );
|
||||
static float64 float64_sqrt( float64 );
|
||||
#endif
|
||||
char float64_eq( float64, float64 );
|
||||
char float64_le( float64, float64 );
|
||||
char float64_lt( float64, float64 );
|
||||
#if 0 /* unused */
|
||||
char float64_eq_signaling( float64, float64 );
|
||||
#endif
|
||||
char float64_le_quiet( float64, float64 );
|
||||
char float64_lt_quiet( float64, float64 );
|
|
@ -0,0 +1,13 @@
|
|||
# $NetBSD: Makefile.inc,v 1.1 2000/05/09 21:55:47 bjh21 Exp $
|
||||
|
||||
SRCS+= alloca.S byte_swap_2.S byte_swap_4.S bswap64.c divsi3.S \
|
||||
fabs.c flt_rounds.c fpgetround.c fpsetround.c \
|
||||
fpgetmask.S fpsetmask.S fpgetsticky.S fpsetsticky.S \
|
||||
infinity.c isinf.c isnan.c frexp.c ldexp.c modf.c nanf.c
|
||||
|
||||
SRCS+= setjmp.S __setjmp14.S
|
||||
SRCS+= _setjmp.S
|
||||
SRCS+= sigsetjmp.S __sigsetjmp14.S
|
||||
|
||||
LSRCS+= Lint_bswap16.c Lint_bswap32.c
|
||||
DPSRCS+= Lint_bswap16.c Lint_bswap32.c
|
|
@ -0,0 +1,130 @@
|
|||
/* $NetBSD: __setjmp14.S,v 1.1 2000/05/09 21:55:47 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Mark Brinicombe
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Mark Brinicombe
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include <machine/setjmp.h>
|
||||
|
||||
/*
|
||||
* C library -- setjmp, longjmp
|
||||
*
|
||||
* longjmp(a,v)
|
||||
* will generate a "return(v)" from the last call to
|
||||
* setjmp(a)
|
||||
* by restoring registers from the stack.
|
||||
* The previous signal state is restored.
|
||||
*/
|
||||
|
||||
ENTRY(__setjmp14)
|
||||
/* Get the signal mask. */
|
||||
stmfd r13!, {r0-r2, r14}
|
||||
add r2, r0, #(_JB_SIGMASK * 4)
|
||||
mov r1, #0x00000000
|
||||
mov r0, #0x00000000
|
||||
bl _C_FUNC(__sigprocmask14)
|
||||
ldmfd r13!, {r0-r2, r14}
|
||||
|
||||
ldr r1, Lsetjmp_magic
|
||||
str r1, [r0], #4
|
||||
|
||||
#ifdef SOFTFLOAT
|
||||
add r0, r0, #52
|
||||
#else
|
||||
/* Store fp registers */
|
||||
sfm f4, 4, [r0], #48
|
||||
/* Store fpsr */
|
||||
rfs r1
|
||||
str r1, [r0], #0x0004
|
||||
#endif /*SOFTFLOAT*/
|
||||
/* Store integer registers */
|
||||
stmia r0, {r4-r14}
|
||||
mov r0, #0x00000000
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14
|
||||
#else
|
||||
mov r15, r14
|
||||
#endif
|
||||
|
||||
Lsetjmp_magic:
|
||||
.word _JB_MAGIC_SETJMP
|
||||
|
||||
|
||||
ENTRY(__longjmp14)
|
||||
ldr r2, Lsetjmp_magic
|
||||
ldr r3, [r0]
|
||||
teq r2, r3
|
||||
bne botch
|
||||
|
||||
/* Restore the signal mask. */
|
||||
stmfd r13!, {r0-r2, r14}
|
||||
mov r2, #0x00000000
|
||||
add r1, r0, #(_JB_SIGMASK * 4)
|
||||
mov r0, #3 /* SIG_SETMASK */
|
||||
bl _C_FUNC(__sigprocmask14)
|
||||
ldmfd r13!, {r0-r2, r14}
|
||||
|
||||
add r0, r0, #4
|
||||
#ifdef SOFTFLOAT
|
||||
add r0, r0, #52
|
||||
#else
|
||||
/* Restore fp registers */
|
||||
lfm f4, 4, [r0], #48
|
||||
/* Restore FPSR */
|
||||
ldr r4, [r0], #0x0004
|
||||
wfs r4
|
||||
#endif /* SOFTFLOAT */
|
||||
/* Restore integer registers */
|
||||
ldmia r0, {r4-r14}
|
||||
|
||||
/* Validate r13 and r14 */
|
||||
teq r13, #0
|
||||
beq botch
|
||||
teq r14, #0
|
||||
beq botch
|
||||
|
||||
/* Set return value */
|
||||
|
||||
mov r0, r1
|
||||
teq r0, #0x00000000
|
||||
moveq r0, #0x00000001
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14
|
||||
#else
|
||||
mov r15, r14
|
||||
#endif
|
||||
|
||||
/* validation failed, die die die. */
|
||||
botch:
|
||||
bl _C_FUNC(longjmperror)
|
||||
bl _C_FUNC(abort)
|
||||
b . - 8 /* Cannot get here */
|
|
@ -0,0 +1,61 @@
|
|||
/* $NetBSD: __sigsetjmp14.S,v 1.1 2000/05/09 21:55:47 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Mark Brinicombe
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Mark Brinicombe
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include <machine/setjmp.h>
|
||||
|
||||
/*
|
||||
* C library -- sigsetjmp, siglongjmp
|
||||
*
|
||||
* longjmp(a,v)
|
||||
* will generate a "return(v)" from the last call to
|
||||
* setjmp(a, m)
|
||||
* by restoring registers from the stack.
|
||||
* The previous signal state is restored.
|
||||
*/
|
||||
|
||||
ENTRY(__sigsetjmp14)
|
||||
teq r1, #0
|
||||
beq _C_FUNC(_setjmp)
|
||||
b _C_FUNC(__setjmp14)
|
||||
|
||||
L_setjmp_magic:
|
||||
.word _JB_MAGIC__SETJMP
|
||||
|
||||
ENTRY(__siglongjmp14)
|
||||
ldr r2, L_setjmp_magic
|
||||
ldr r3, [r0]
|
||||
teq r2, r3
|
||||
beq _C_FUNC(_longjmp)
|
||||
b _C_FUNC(__longjmp14)
|
|
@ -0,0 +1,114 @@
|
|||
/* $NetBSD: _setjmp.S,v 1.1 2000/05/09 21:55:47 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Mark Brinicombe
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Mark Brinicombe
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include <machine/setjmp.h>
|
||||
|
||||
/*
|
||||
* C library -- _setjmp, _longjmp
|
||||
*
|
||||
* _longjmp(a,v)
|
||||
* will generate a "return(v)" from the last call to
|
||||
* _setjmp(a)
|
||||
* by restoring registers from the stack.
|
||||
* The previous signal state is NOT restored.
|
||||
*
|
||||
* Note: r0 is the return value
|
||||
* r1-r3 are scratch registers in functions
|
||||
*/
|
||||
|
||||
ENTRY(_setjmp)
|
||||
ldr r1, L_setjmp_magic
|
||||
str r1, [r0], #4
|
||||
#ifdef SOFTFLOAT
|
||||
add r0, r0, #52
|
||||
#else
|
||||
/* Store fp registers */
|
||||
sfm f4, 4, [r0], #48
|
||||
/* Store fpsr */
|
||||
rfs r1
|
||||
str r1, [r0], #0x0004
|
||||
#endif /* SOFTFLOAT */
|
||||
/* Store integer registers */
|
||||
stmia r0, {r4-r14}
|
||||
|
||||
mov r0, #0x00000000
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14
|
||||
#else
|
||||
mov r15, r14
|
||||
#endif
|
||||
|
||||
L_setjmp_magic:
|
||||
.word _JB_MAGIC__SETJMP
|
||||
|
||||
ENTRY(_longjmp)
|
||||
ldr r2, L_setjmp_magic
|
||||
ldr r3, [r0], #4
|
||||
teq r2, r3
|
||||
bne botch
|
||||
|
||||
#ifdef SOFTFLOAT
|
||||
add r0, r0, #52
|
||||
#else
|
||||
/* Restore fp registers */
|
||||
lfm f4, 4, [r0], #48
|
||||
/* Restore fpsr */
|
||||
ldr r4, [r0], #0x0004
|
||||
wfs r4
|
||||
#endif /* SOFTFLOAT */
|
||||
/* Restore integer registers */
|
||||
ldmia r0, {r4-r14}
|
||||
|
||||
/* Validate r13 and r14 */
|
||||
teq r13, #0
|
||||
beq botch
|
||||
teq r14, #0
|
||||
beq botch
|
||||
|
||||
/* Set return value */
|
||||
mov r0, r1
|
||||
teq r0, #0x00000000
|
||||
moveq r0, #0x00000001
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14
|
||||
#else
|
||||
mov r15, r14
|
||||
#endif
|
||||
|
||||
/* validation failed, die die die. */
|
||||
botch:
|
||||
bl _C_FUNC(longjmperror)
|
||||
bl _C_FUNC(abort)
|
||||
b . - 8 /* Cannot get here */
|
|
@ -0,0 +1,48 @@
|
|||
/* $NetBSD: alloca.S,v 1.1 2000/05/09 21:55:47 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Mark Brinicombe
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Mark Brinicombe
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* like alloc, but automatic automatic free in return */
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(alloca)
|
||||
add r0, r0, #0x00000003 /* round up to next word */
|
||||
bic r0, r0, #0x00000003
|
||||
sub r13, r13, r0 /* Adjust the stack pointer */
|
||||
mov r0, r13 /* r0 = base of new space */
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14 /* return */
|
||||
#else
|
||||
mov r15, r14 /* return */
|
||||
#endif
|
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD: byte_swap_2.S,v 1.1 2000/05/09 21:55:47 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Charles M. Hannum.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
_BEGIN_ENTRY;
|
||||
_ENTRY(_C_FUNC(__bswap16));
|
||||
_ENTRY(_C_FUNC(ntohs));
|
||||
_ENTRY(_C_FUNC(htons));
|
||||
_END_ENTRY
|
||||
and r1, r0, #0xFF00
|
||||
mov r0, r0, lsl #8
|
||||
orr r0, r0, r1, lsr #8
|
||||
#ifdef __APCS_26__
|
||||
movs pc, lr
|
||||
#else
|
||||
mov pc, lr
|
||||
#endif
|
|
@ -0,0 +1,54 @@
|
|||
/* $NetBSD: byte_swap_4.S,v 1.1 2000/05/09 21:55:47 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Neil A. Carson
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
_BEGIN_ENTRY;
|
||||
_ENTRY(_C_FUNC(__bswap32));
|
||||
_ENTRY(_C_FUNC(ntohl));
|
||||
_ENTRY(_C_FUNC(htonl));
|
||||
_END_ENTRY
|
||||
eor r1, r0, r0, ror #16
|
||||
bic r1, r1, #0x00FF0000
|
||||
mov r0, r0, ror #8
|
||||
eor r0, r0, r1, lsr #8
|
||||
#ifdef __APCS_26__
|
||||
movs pc,lr
|
||||
#else
|
||||
mov pc, lr
|
||||
#endif
|
|
@ -0,0 +1,398 @@
|
|||
/* $NetBSD: divsi3.S,v 1.1 2000/05/09 21:55:47 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(__umodsi3)
|
||||
stmfd sp!, {lr}
|
||||
bl L_udivide
|
||||
mov r0, r1
|
||||
#ifdef __APCS_26__
|
||||
ldmfd sp!, {pc}^
|
||||
#else /* APCS-32 */
|
||||
ldmfd sp!, {pc}
|
||||
#endif
|
||||
|
||||
ENTRY(__modsi3)
|
||||
stmfd sp!, {lr}
|
||||
bl L_divide
|
||||
mov r0, r1
|
||||
#ifdef __APCS_26__
|
||||
ldmfd sp!, {pc}^
|
||||
#else
|
||||
ldmfd sp!, {pc}
|
||||
#endif
|
||||
|
||||
L_overflow:
|
||||
#if 0 /* FIXME */
|
||||
mov r0, #8 /* SIGFPE */
|
||||
bl _C_FUNC(raise) /* raise it */
|
||||
#endif
|
||||
mov r0, #0
|
||||
#ifdef __APCS_26__
|
||||
movs pc, lr
|
||||
#else
|
||||
mov pc, lr
|
||||
#endif
|
||||
|
||||
ENTRY(__udivsi3)
|
||||
L_udivide: /* r0 = r0 / r1; r1 = r0 % r1 */
|
||||
eor r0, r1, r0
|
||||
eor r1, r0, r1
|
||||
eor r0, r1, r0
|
||||
/* r0 = r1 / r0; r1 = r1 % r0 */
|
||||
cmp r0, #1
|
||||
bcc L_overflow
|
||||
beq L_divide_l0
|
||||
mov ip, #0
|
||||
movs r1, r1
|
||||
bpl L_divide_l1
|
||||
orr ip, ip, #0x20000000 /* ip bit 0x20000000 = -ve r1 */
|
||||
movs r1, r1, lsr #1
|
||||
orrcs ip, ip, #0x10000000 /* ip bit 0x10000000 = bit 0 of r1 */
|
||||
b L_divide_l1
|
||||
|
||||
L_divide_l0: /* r0 == 1 */
|
||||
mov r0, r1
|
||||
mov r1, #0
|
||||
#ifdef __APCS_26__
|
||||
movs pc, lr
|
||||
#else
|
||||
mov pc, lr
|
||||
#endif
|
||||
|
||||
ENTRY(__divsi3)
|
||||
L_divide: /* r0 = r0 / r1; r1 = r0 % r1 */
|
||||
eor r0, r1, r0
|
||||
eor r1, r0, r1
|
||||
eor r0, r1, r0
|
||||
/* r0 = r1 / r0; r1 = r1 % r0 */
|
||||
cmp r0, #1
|
||||
bcc L_overflow
|
||||
beq L_divide_l0
|
||||
ands ip, r0, #0x80000000
|
||||
rsbmi r0, r0, #0
|
||||
ands r2, r1, #0x80000000
|
||||
eor ip, ip, r2
|
||||
rsbmi r1, r1, #0
|
||||
orr ip, r2, ip, lsr #1 /* ip bit 0x40000000 = -ve division */
|
||||
/* ip bit 0x80000000 = -ve remainder */
|
||||
|
||||
L_divide_l1:
|
||||
mov r2, #1
|
||||
mov r3, #0
|
||||
|
||||
/*
|
||||
* If the highest bit of the dividend is set, we have to be
|
||||
* careful when shifting the divisor. Test this.
|
||||
*/
|
||||
movs r1,r1
|
||||
bpl L_old_code
|
||||
|
||||
/*
|
||||
* At this point, the highest bit of r1 is known to be set.
|
||||
* We abuse this below in the tst instructions.
|
||||
*/
|
||||
tst r1, r0 /*, lsl #0 */
|
||||
bmi L_divide_b1
|
||||
tst r1, r0, lsl #1
|
||||
bmi L_divide_b2
|
||||
tst r1, r0, lsl #2
|
||||
bmi L_divide_b3
|
||||
tst r1, r0, lsl #3
|
||||
bmi L_divide_b4
|
||||
tst r1, r0, lsl #4
|
||||
bmi L_divide_b5
|
||||
tst r1, r0, lsl #5
|
||||
bmi L_divide_b6
|
||||
tst r1, r0, lsl #6
|
||||
bmi L_divide_b7
|
||||
tst r1, r0, lsl #7
|
||||
bmi L_divide_b8
|
||||
tst r1, r0, lsl #8
|
||||
bmi L_divide_b9
|
||||
tst r1, r0, lsl #9
|
||||
bmi L_divide_b10
|
||||
tst r1, r0, lsl #10
|
||||
bmi L_divide_b11
|
||||
tst r1, r0, lsl #11
|
||||
bmi L_divide_b12
|
||||
tst r1, r0, lsl #12
|
||||
bmi L_divide_b13
|
||||
tst r1, r0, lsl #13
|
||||
bmi L_divide_b14
|
||||
tst r1, r0, lsl #14
|
||||
bmi L_divide_b15
|
||||
tst r1, r0, lsl #15
|
||||
bmi L_divide_b16
|
||||
tst r1, r0, lsl #16
|
||||
bmi L_divide_b17
|
||||
tst r1, r0, lsl #17
|
||||
bmi L_divide_b18
|
||||
tst r1, r0, lsl #18
|
||||
bmi L_divide_b19
|
||||
tst r1, r0, lsl #19
|
||||
bmi L_divide_b20
|
||||
tst r1, r0, lsl #20
|
||||
bmi L_divide_b21
|
||||
tst r1, r0, lsl #21
|
||||
bmi L_divide_b22
|
||||
tst r1, r0, lsl #22
|
||||
bmi L_divide_b23
|
||||
tst r1, r0, lsl #23
|
||||
bmi L_divide_b24
|
||||
tst r1, r0, lsl #24
|
||||
bmi L_divide_b25
|
||||
tst r1, r0, lsl #25
|
||||
bmi L_divide_b26
|
||||
tst r1, r0, lsl #26
|
||||
bmi L_divide_b27
|
||||
tst r1, r0, lsl #27
|
||||
bmi L_divide_b28
|
||||
tst r1, r0, lsl #28
|
||||
bmi L_divide_b29
|
||||
tst r1, r0, lsl #29
|
||||
bmi L_divide_b30
|
||||
tst r1, r0, lsl #30
|
||||
bmi L_divide_b31
|
||||
/*
|
||||
* instead of:
|
||||
* tst r1, r0, lsl #31
|
||||
* bmi L_divide_b32
|
||||
*/
|
||||
b L_divide_b32
|
||||
|
||||
L_old_code:
|
||||
cmp r1, r0
|
||||
bcc L_divide_b0
|
||||
cmp r1, r0, lsl #1
|
||||
bcc L_divide_b1
|
||||
cmp r1, r0, lsl #2
|
||||
bcc L_divide_b2
|
||||
cmp r1, r0, lsl #3
|
||||
bcc L_divide_b3
|
||||
cmp r1, r0, lsl #4
|
||||
bcc L_divide_b4
|
||||
cmp r1, r0, lsl #5
|
||||
bcc L_divide_b5
|
||||
cmp r1, r0, lsl #6
|
||||
bcc L_divide_b6
|
||||
cmp r1, r0, lsl #7
|
||||
bcc L_divide_b7
|
||||
cmp r1, r0, lsl #8
|
||||
bcc L_divide_b8
|
||||
cmp r1, r0, lsl #9
|
||||
bcc L_divide_b9
|
||||
cmp r1, r0, lsl #10
|
||||
bcc L_divide_b10
|
||||
cmp r1, r0, lsl #11
|
||||
bcc L_divide_b11
|
||||
cmp r1, r0, lsl #12
|
||||
bcc L_divide_b12
|
||||
cmp r1, r0, lsl #13
|
||||
bcc L_divide_b13
|
||||
cmp r1, r0, lsl #14
|
||||
bcc L_divide_b14
|
||||
cmp r1, r0, lsl #15
|
||||
bcc L_divide_b15
|
||||
cmp r1, r0, lsl #16
|
||||
bcc L_divide_b16
|
||||
cmp r1, r0, lsl #17
|
||||
bcc L_divide_b17
|
||||
cmp r1, r0, lsl #18
|
||||
bcc L_divide_b18
|
||||
cmp r1, r0, lsl #19
|
||||
bcc L_divide_b19
|
||||
cmp r1, r0, lsl #20
|
||||
bcc L_divide_b20
|
||||
cmp r1, r0, lsl #21
|
||||
bcc L_divide_b21
|
||||
cmp r1, r0, lsl #22
|
||||
bcc L_divide_b22
|
||||
cmp r1, r0, lsl #23
|
||||
bcc L_divide_b23
|
||||
cmp r1, r0, lsl #24
|
||||
bcc L_divide_b24
|
||||
cmp r1, r0, lsl #25
|
||||
bcc L_divide_b25
|
||||
cmp r1, r0, lsl #26
|
||||
bcc L_divide_b26
|
||||
cmp r1, r0, lsl #27
|
||||
bcc L_divide_b27
|
||||
cmp r1, r0, lsl #28
|
||||
bcc L_divide_b28
|
||||
cmp r1, r0, lsl #29
|
||||
bcc L_divide_b29
|
||||
cmp r1, r0, lsl #30
|
||||
bcc L_divide_b30
|
||||
L_divide_b32:
|
||||
cmp r1, r0, lsl #31
|
||||
subhs r1, r1,r0, lsl #31
|
||||
addhs r3, r3,r2, lsl #31
|
||||
L_divide_b31:
|
||||
cmp r1, r0, lsl #30
|
||||
subhs r1, r1,r0, lsl #30
|
||||
addhs r3, r3,r2, lsl #30
|
||||
L_divide_b30:
|
||||
cmp r1, r0, lsl #29
|
||||
subhs r1, r1,r0, lsl #29
|
||||
addhs r3, r3,r2, lsl #29
|
||||
L_divide_b29:
|
||||
cmp r1, r0, lsl #28
|
||||
subhs r1, r1,r0, lsl #28
|
||||
addhs r3, r3,r2, lsl #28
|
||||
L_divide_b28:
|
||||
cmp r1, r0, lsl #27
|
||||
subhs r1, r1,r0, lsl #27
|
||||
addhs r3, r3,r2, lsl #27
|
||||
L_divide_b27:
|
||||
cmp r1, r0, lsl #26
|
||||
subhs r1, r1,r0, lsl #26
|
||||
addhs r3, r3,r2, lsl #26
|
||||
L_divide_b26:
|
||||
cmp r1, r0, lsl #25
|
||||
subhs r1, r1,r0, lsl #25
|
||||
addhs r3, r3,r2, lsl #25
|
||||
L_divide_b25:
|
||||
cmp r1, r0, lsl #24
|
||||
subhs r1, r1,r0, lsl #24
|
||||
addhs r3, r3,r2, lsl #24
|
||||
L_divide_b24:
|
||||
cmp r1, r0, lsl #23
|
||||
subhs r1, r1,r0, lsl #23
|
||||
addhs r3, r3,r2, lsl #23
|
||||
L_divide_b23:
|
||||
cmp r1, r0, lsl #22
|
||||
subhs r1, r1,r0, lsl #22
|
||||
addhs r3, r3,r2, lsl #22
|
||||
L_divide_b22:
|
||||
cmp r1, r0, lsl #21
|
||||
subhs r1, r1,r0, lsl #21
|
||||
addhs r3, r3,r2, lsl #21
|
||||
L_divide_b21:
|
||||
cmp r1, r0, lsl #20
|
||||
subhs r1, r1,r0, lsl #20
|
||||
addhs r3, r3,r2, lsl #20
|
||||
L_divide_b20:
|
||||
cmp r1, r0, lsl #19
|
||||
subhs r1, r1,r0, lsl #19
|
||||
addhs r3, r3,r2, lsl #19
|
||||
L_divide_b19:
|
||||
cmp r1, r0, lsl #18
|
||||
subhs r1, r1,r0, lsl #18
|
||||
addhs r3, r3,r2, lsl #18
|
||||
L_divide_b18:
|
||||
cmp r1, r0, lsl #17
|
||||
subhs r1, r1,r0, lsl #17
|
||||
addhs r3, r3,r2, lsl #17
|
||||
L_divide_b17:
|
||||
cmp r1, r0, lsl #16
|
||||
subhs r1, r1,r0, lsl #16
|
||||
addhs r3, r3,r2, lsl #16
|
||||
L_divide_b16:
|
||||
cmp r1, r0, lsl #15
|
||||
subhs r1, r1,r0, lsl #15
|
||||
addhs r3, r3,r2, lsl #15
|
||||
L_divide_b15:
|
||||
cmp r1, r0, lsl #14
|
||||
subhs r1, r1,r0, lsl #14
|
||||
addhs r3, r3,r2, lsl #14
|
||||
L_divide_b14:
|
||||
cmp r1, r0, lsl #13
|
||||
subhs r1, r1,r0, lsl #13
|
||||
addhs r3, r3,r2, lsl #13
|
||||
L_divide_b13:
|
||||
cmp r1, r0, lsl #12
|
||||
subhs r1, r1,r0, lsl #12
|
||||
addhs r3, r3,r2, lsl #12
|
||||
L_divide_b12:
|
||||
cmp r1, r0, lsl #11
|
||||
subhs r1, r1,r0, lsl #11
|
||||
addhs r3, r3,r2, lsl #11
|
||||
L_divide_b11:
|
||||
cmp r1, r0, lsl #10
|
||||
subhs r1, r1,r0, lsl #10
|
||||
addhs r3, r3,r2, lsl #10
|
||||
L_divide_b10:
|
||||
cmp r1, r0, lsl #9
|
||||
subhs r1, r1,r0, lsl #9
|
||||
addhs r3, r3,r2, lsl #9
|
||||
L_divide_b9:
|
||||
cmp r1, r0, lsl #8
|
||||
subhs r1, r1,r0, lsl #8
|
||||
addhs r3, r3,r2, lsl #8
|
||||
L_divide_b8:
|
||||
cmp r1, r0, lsl #7
|
||||
subhs r1, r1,r0, lsl #7
|
||||
addhs r3, r3,r2, lsl #7
|
||||
L_divide_b7:
|
||||
cmp r1, r0, lsl #6
|
||||
subhs r1, r1,r0, lsl #6
|
||||
addhs r3, r3,r2, lsl #6
|
||||
L_divide_b6:
|
||||
cmp r1, r0, lsl #5
|
||||
subhs r1, r1,r0, lsl #5
|
||||
addhs r3, r3,r2, lsl #5
|
||||
L_divide_b5:
|
||||
cmp r1, r0, lsl #4
|
||||
subhs r1, r1,r0, lsl #4
|
||||
addhs r3, r3,r2, lsl #4
|
||||
L_divide_b4:
|
||||
cmp r1, r0, lsl #3
|
||||
subhs r1, r1,r0, lsl #3
|
||||
addhs r3, r3,r2, lsl #3
|
||||
L_divide_b3:
|
||||
cmp r1, r0, lsl #2
|
||||
subhs r1, r1,r0, lsl #2
|
||||
addhs r3, r3,r2, lsl #2
|
||||
L_divide_b2:
|
||||
cmp r1, r0, lsl #1
|
||||
subhs r1, r1,r0, lsl #1
|
||||
addhs r3, r3,r2, lsl #1
|
||||
L_divide_b1:
|
||||
cmp r1, r0
|
||||
subhs r1, r1, r0
|
||||
addhs r3, r3, r2
|
||||
L_divide_b0:
|
||||
|
||||
tst ip, #0x20000000
|
||||
bne L_udivide_l1
|
||||
mov r0, r3
|
||||
cmp ip, #0
|
||||
rsbmi r1, r1, #0
|
||||
movs ip, ip, lsl #1
|
||||
bicmi r0, r0, #0x80000000 /* Fix incase we divided 0x80000000 */
|
||||
rsbmi r0, r0, #0
|
||||
#ifdef __APCS_26__
|
||||
movs pc, lr
|
||||
#else
|
||||
mov pc, lr
|
||||
#endif
|
||||
|
||||
L_udivide_l1:
|
||||
tst ip, #0x10000000
|
||||
mov r1, r1, lsl #1
|
||||
orrne r1, r1, #1
|
||||
mov r3, r3, lsl #1
|
||||
cmp r1, r0
|
||||
subhs r1, r1, r0
|
||||
addhs r3, r3, r2
|
||||
mov r0, r3
|
||||
#ifdef __APCS_26__
|
||||
movs pc, lr
|
||||
#else
|
||||
mov pc, lr
|
||||
#endif
|
|
@ -0,0 +1,48 @@
|
|||
/* $NetBSD: fabs.c,v 1.1 2000/05/09 21:55:48 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Mark Brinicombe
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Mark Brinicombe
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* fabs(x) returns the absolute value of x.
|
||||
*/
|
||||
|
||||
#ifdef __STDC__
|
||||
double fabs(double x)
|
||||
#else
|
||||
double fabs(x)
|
||||
double x;
|
||||
#endif
|
||||
{
|
||||
if (x < 0)
|
||||
x = -x;
|
||||
return(x);
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
/* $NetBSD: flt_rounds.c,v 1.1 2000/05/09 21:55:48 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Mark Brinicombe
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Mark Brinicombe
|
||||
* for the NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <ieeefp.h>
|
||||
|
||||
static const int map[] = {
|
||||
1, /* round to nearest */
|
||||
2, /* round to positive infinity */
|
||||
3, /* round to negative infinity */
|
||||
0 /* round to zero */
|
||||
};
|
||||
|
||||
/*
|
||||
* Return the current FP rounding mode
|
||||
*
|
||||
* Returns:
|
||||
* 0 - round to zero
|
||||
* 1 - round to nearest
|
||||
* 2 - round to postive infinity
|
||||
* 3 - round to negative infinity
|
||||
*
|
||||
* ok all we need to do is get the current FP rounding mode
|
||||
* index our map table and return the appropriate value.
|
||||
*
|
||||
* HOWEVER:
|
||||
* The ARM FPA codes the rounding mode into the actual FP instructions
|
||||
* so there is no such thing as a global rounding mode.
|
||||
* The default is round to nearest if rounding is not explictly specified.
|
||||
* FP instructions generated by GCC will not explicitly specify a rounding
|
||||
* mode.
|
||||
*
|
||||
* So the best we can do it to return the rounding mode FP instructions
|
||||
* use if rounding is not specified which is round to nearest.
|
||||
*
|
||||
* This could change in the future with new floating point emulators or
|
||||
* soft float FP libraries.
|
||||
*/
|
||||
|
||||
int __flt_rounds(void);
|
||||
|
||||
int
|
||||
__flt_rounds()
|
||||
{
|
||||
return(map[fpgetround()]);
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/* $NetBSD: fpgetmask.S,v 1.1 2000/05/09 21:55:48 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Mark Brinicombe
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Mark Brinicombe
|
||||
* for the NetBSD project.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
/*
|
||||
* Return the current FP exception enable mask
|
||||
*/
|
||||
|
||||
ENTRY(fpgetmask)
|
||||
#ifdef SOFTFLOAT
|
||||
b _C_FUNC(sfp_getmask)
|
||||
#else
|
||||
rfs r0
|
||||
mov r0, r0, lsr #16
|
||||
and r0, r0, #0x1f
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14 /* return */
|
||||
#else
|
||||
mov r15, r14 /* return */
|
||||
#endif
|
||||
#endif /* SOFTFLOAT */
|
|
@ -0,0 +1,64 @@
|
|||
/* $NetBSD: fpgetround.c,v 1.1 2000/05/09 21:55:48 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Mark Brinicombe
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Mark Brinicombe
|
||||
* for the NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <ieeefp.h>
|
||||
|
||||
/*
|
||||
* Return the current FP rounding mode
|
||||
*
|
||||
* ok all we need to do is return the current FP rounding mode
|
||||
*
|
||||
* HOWEVER:
|
||||
* The ARM FPA codes the rounding mode into the actual FP instructions
|
||||
* so there is no such thing as a global rounding mode.
|
||||
* The default is round to nearest if rounding is not explictly specified.
|
||||
* FP instructions generated by GCC will not explicitly specify a rounding
|
||||
* mode.
|
||||
*
|
||||
* So the best we can do it to return the rounding mode FP instructions
|
||||
* use if rounding is not specified which is round to nearest.
|
||||
*
|
||||
* This could change in the future with new floating point emulators or
|
||||
* soft float FP libraries.
|
||||
*/
|
||||
|
||||
fp_rnd
|
||||
fpgetround()
|
||||
{
|
||||
#ifdef SOFT_FLOAT
|
||||
return(sfp_getround());
|
||||
#else
|
||||
return(FP_RN);
|
||||
#endif
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD: fpgetsticky.S,v 1.1 2000/05/09 21:55:48 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Mark Brinicombe
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Mark Brinicombe
|
||||
* for the NetBSD project.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
/*
|
||||
* Return the current FP cumulative flags
|
||||
*/
|
||||
|
||||
ENTRY(fpgetsticky)
|
||||
#ifdef SOFTFLOAT
|
||||
b _C_FUNC(sfp_getsticky)
|
||||
#else
|
||||
rfs r0
|
||||
and r0, r0, #0x1f
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14 /* return */
|
||||
#else
|
||||
mov r15, r14 /* return */
|
||||
#endif
|
||||
#endif /* SOFTFLOAT */
|
|
@ -0,0 +1,57 @@
|
|||
/* $NetBSD: fpsetmask.S,v 1.1 2000/05/09 21:55:48 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Mark Brinicombe
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Mark Brinicombe
|
||||
* for the NetBSD project.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
/*
|
||||
* Set the current FP exception enable mask
|
||||
*/
|
||||
|
||||
ENTRY(fpsetmask)
|
||||
#ifdef SOFTFLOAT
|
||||
b _C_FUNC(sfp_setmask)
|
||||
#else
|
||||
rfs r1
|
||||
bic r1, r1, #0x001f0000
|
||||
and r0, r0, #0x0000001f
|
||||
orr r0, r1, r0, lsl #16
|
||||
wfs r0
|
||||
mov r0, r1, lsr #16 /* Return old mask */
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14 /* return */
|
||||
#else
|
||||
mov r15, r14 /* return */
|
||||
#endif
|
||||
#endif /* SOFTFLOAT */
|
|
@ -0,0 +1,71 @@
|
|||
/* $NetBSD: fpsetround.c,v 1.1 2000/05/09 21:55:48 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Mark Brinicombe
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Mark Brinicombe
|
||||
* for the NetBSD Project.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <ieeefp.h>
|
||||
|
||||
void sfp_setround __P((fp_rnd));
|
||||
|
||||
/*
|
||||
* Return the current FP rounding mode
|
||||
*
|
||||
* ok all we need to do is return the current FP rounding mode
|
||||
*
|
||||
* HOWEVER:
|
||||
* The ARM FPA codes the rounding mode into the actual FP instructions
|
||||
* so there is no such thing as a global rounding mode.
|
||||
* The default is round to nearest if rounding is not explictly specified.
|
||||
* FP instructions generated by GCC will not explicitly specify a rounding
|
||||
* mode.
|
||||
*
|
||||
* All we can do is abort
|
||||
*
|
||||
* This could change in the future with new floating point emulators or
|
||||
* soft float FP libraries.
|
||||
*/
|
||||
|
||||
fp_rnd
|
||||
fpsetround(rnd_dir)
|
||||
fp_rnd rnd_dir;
|
||||
{
|
||||
fp_rnd old_rnd;
|
||||
|
||||
old_rnd = fpgetround();
|
||||
|
||||
#ifdef SOFTFLOAT
|
||||
sfp_setround(rnd_dir);
|
||||
#else
|
||||
abort();
|
||||
#endif
|
||||
return(old_rnd);
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/* $NetBSD: fpsetsticky.S,v 1.1 2000/05/09 21:55:48 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Mark Brinicombe
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Mark Brinicombe
|
||||
* for the NetBSD project.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
/*
|
||||
* Set the current FP cumulative flags
|
||||
*/
|
||||
|
||||
ENTRY(fpsetsticky)
|
||||
#ifdef SOFTFLOAT
|
||||
b _C_FUNC(sfp_setsticky)
|
||||
#else
|
||||
rfs r1
|
||||
bic r1, r1, #0x1f
|
||||
and r0, r0, #0x1f
|
||||
orr r0, r1, r0
|
||||
wfs r0
|
||||
mov r0, r1 /* Return old mask */
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14 /* return */
|
||||
#else
|
||||
mov r15, r14 /* return */
|
||||
#endif
|
||||
#endif /* SOFTFLOAT */
|
|
@ -0,0 +1,86 @@
|
|||
/* $NetBSD: frexp.c,v 1.1 2000/05/09 21:55:48 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: Header: frexp.c,v 1.1 91/07/07 04:45:01 torek Exp
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)frexp.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: frexp.c,v 1.1 2000/05/09 21:55:48 bjh21 Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/ieee.h>
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
* Split the given value into a fraction in the range [0.5, 1.0) and
|
||||
* an exponent, such that frac * (2^exp) == value. If value is 0,
|
||||
* return 0.
|
||||
*/
|
||||
double
|
||||
frexp(value, eptr)
|
||||
double value;
|
||||
int *eptr;
|
||||
{
|
||||
union {
|
||||
double v;
|
||||
struct ieee_double s;
|
||||
} u;
|
||||
|
||||
if (value) {
|
||||
/*
|
||||
* Fractions in [0.5..1.0) have an exponent of 2^-1.
|
||||
* Leave Inf and NaN alone, however.
|
||||
* WHAT ABOUT DENORMS?
|
||||
*/
|
||||
u.v = value;
|
||||
if (u.s.dbl_exp != DBL_EXP_INFNAN) {
|
||||
*eptr = u.s.dbl_exp - (DBL_EXP_BIAS - 1);
|
||||
u.s.dbl_exp = DBL_EXP_BIAS - 1;
|
||||
}
|
||||
return (u.v);
|
||||
} else {
|
||||
*eptr = 0;
|
||||
return (0.0);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
/* $NetBSD: infinity.c,v 1.1 2000/05/09 21:55:48 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Mark Brinicombe.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Mark Brinicombe
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/* Bytes for +infinity on an arm32 (IEEE double precision) */
|
||||
|
||||
const char __infinity[] __attribute__((__aligned__(4))) = { 0, 0, (char)0xf0, 0x7f, 0, 0, 0, 0 };
|
|
@ -0,0 +1,68 @@
|
|||
/* $NetBSD: isinf.c,v 1.1 2000/05/09 21:55:49 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: isinf.c,v 1.1 2000/05/09 21:55:49 bjh21 Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <machine/ieee.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(isinf,_isinf)
|
||||
#endif
|
||||
|
||||
int
|
||||
isinf(d)
|
||||
double d;
|
||||
{
|
||||
register struct ieee_double *p = (struct ieee_double *)(void *)&d;
|
||||
|
||||
return (p->dbl_exp == DBL_EXP_INFNAN &&
|
||||
(p->dbl_frach == 0 && p->dbl_fracl == 0));
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/* $NetBSD: isnan.c,v 1.1 2000/05/09 21:55:49 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This software was developed by the Computer Systems Engineering group
|
||||
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
|
||||
* contributed to Berkeley.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: Header: isinf.c,v 1.1 91/07/08 19:03:34 torek Exp
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)isinf.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: isnan.c,v 1.1 2000/05/09 21:55:49 bjh21 Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <machine/ieee.h>
|
||||
#include <math.h>
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(isnan,_isnan)
|
||||
#endif
|
||||
|
||||
int
|
||||
isnan(d)
|
||||
double d;
|
||||
{
|
||||
register struct ieee_double *p = (struct ieee_double *)(void *)&d;
|
||||
|
||||
return (p->dbl_exp == DBL_EXP_INFNAN &&
|
||||
(p->dbl_frach != 0 || p->dbl_fracl != 0));
|
||||
}
|
|
@ -0,0 +1,154 @@
|
|||
/* $NetBSD: ldexp.c,v 1.1 2000/05/09 21:55:49 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Charles M. Hannum.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: ldexp.c,v 1.1 2000/05/09 21:55:49 bjh21 Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/ieee.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
* Multiply the given value by 2^exp.
|
||||
*/
|
||||
double
|
||||
ldexp(val, exp)
|
||||
double val;
|
||||
int exp;
|
||||
{
|
||||
register int oldexp, newexp;
|
||||
union {
|
||||
double v;
|
||||
struct ieee_double s;
|
||||
} u, mul;
|
||||
|
||||
u.v = val;
|
||||
oldexp = u.s.dbl_exp;
|
||||
|
||||
/*
|
||||
* If input is zero, Inf or NaN, just return it.
|
||||
*/
|
||||
if (u.v == 0.0 || oldexp == DBL_EXP_INFNAN)
|
||||
return (val);
|
||||
|
||||
if (oldexp == 0) {
|
||||
/*
|
||||
* u.v is denormal. We must adjust it so that the exponent
|
||||
* arithmetic below will work.
|
||||
*/
|
||||
if (exp <= DBL_EXP_BIAS) {
|
||||
/*
|
||||
* Optimization: if the scaling can be done in a single
|
||||
* multiply, or underflows, just do it now.
|
||||
*/
|
||||
if (exp <= -DBL_FRACBITS) {
|
||||
errno = ERANGE;
|
||||
return (0.0);
|
||||
}
|
||||
mul.v = 0.0;
|
||||
mul.s.dbl_exp = exp + DBL_EXP_BIAS;
|
||||
u.v *= mul.v;
|
||||
if (u.v == 0.0) {
|
||||
errno = ERANGE;
|
||||
return (0.0);
|
||||
}
|
||||
return (u.v);
|
||||
} else {
|
||||
/*
|
||||
* We know that exp is very large, and therefore the
|
||||
* result cannot be denormal (though it may be Inf).
|
||||
* Shift u.v by just enough to make it normal.
|
||||
*/
|
||||
mul.v = 0.0;
|
||||
mul.s.dbl_exp = DBL_FRACBITS + DBL_EXP_BIAS;
|
||||
u.v *= mul.v;
|
||||
exp -= DBL_FRACBITS;
|
||||
oldexp = u.s.dbl_exp;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* u.v is now normalized and oldexp has been adjusted if necessary.
|
||||
* Calculate the new exponent and check for underflow and overflow.
|
||||
*/
|
||||
newexp = oldexp + exp;
|
||||
|
||||
if (newexp <= 0) {
|
||||
/*
|
||||
* The output number is either denormal or underflows (see
|
||||
* comments in machine/ieee.h).
|
||||
*/
|
||||
if (newexp <= -DBL_FRACBITS) {
|
||||
errno = ERANGE;
|
||||
return (0.0);
|
||||
}
|
||||
/*
|
||||
* Denormalize the result. We do this with a multiply. If exp
|
||||
* is very large, it won't fit in a double, so we have to
|
||||
* adjust the exponent first. This is safe because we know
|
||||
* that u.v is normal at this point.
|
||||
*/
|
||||
if (exp <= -DBL_EXP_BIAS) {
|
||||
u.s.dbl_exp = 1;
|
||||
exp += oldexp - 1;
|
||||
}
|
||||
mul.v = 0.0;
|
||||
mul.s.dbl_exp = exp + DBL_EXP_BIAS;
|
||||
u.v *= mul.v;
|
||||
return (u.v);
|
||||
} else if (newexp >= DBL_EXP_INFNAN) {
|
||||
/*
|
||||
* The result overflowed; return +/-Inf.
|
||||
*/
|
||||
u.s.dbl_exp = DBL_EXP_INFNAN;
|
||||
u.s.dbl_frach = 0;
|
||||
u.s.dbl_fracl = 0;
|
||||
errno = ERANGE;
|
||||
return (u.v);
|
||||
} else {
|
||||
/*
|
||||
* The result is normal; just replace the old exponent with the
|
||||
* new one.
|
||||
*/
|
||||
u.s.dbl_exp = newexp;
|
||||
return (u.v);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
/* $NetBSD: modf.c,v 1.1 2000/05/09 21:55:49 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Author: Chris G. Demetriou
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and
|
||||
* its documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
|
||||
* FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <machine/ieee.h>
|
||||
#include <errno.h>
|
||||
#include <math.h>
|
||||
|
||||
/*
|
||||
* double modf(double val, double *iptr)
|
||||
* returns: f and i such that |f| < 1.0, (f + i) = val, and
|
||||
* sign(f) == sign(i) == sign(val).
|
||||
*
|
||||
* Beware signedness when doing subtraction, and also operand size!
|
||||
*/
|
||||
double
|
||||
modf(val, iptr)
|
||||
double val, *iptr;
|
||||
{
|
||||
union doub {
|
||||
double v;
|
||||
struct ieee_double s;
|
||||
} u, v;
|
||||
u_int64_t frac;
|
||||
|
||||
/*
|
||||
* If input is Inf or NaN, return it and leave i alone.
|
||||
*/
|
||||
u.v = val;
|
||||
if (u.s.dbl_exp == DBL_EXP_INFNAN)
|
||||
return (u.v);
|
||||
|
||||
/*
|
||||
* If input can't have a fractional part, return
|
||||
* (appropriately signed) zero, and make i be the input.
|
||||
*/
|
||||
if ((int)u.s.dbl_exp - DBL_EXP_BIAS > DBL_FRACBITS - 1) {
|
||||
*iptr = u.v;
|
||||
v.v = 0.0;
|
||||
v.s.dbl_sign = u.s.dbl_sign;
|
||||
return (v.v);
|
||||
}
|
||||
|
||||
/*
|
||||
* If |input| < 1.0, return it, and set i to the appropriately
|
||||
* signed zero.
|
||||
*/
|
||||
if (u.s.dbl_exp < DBL_EXP_BIAS) {
|
||||
v.v = 0.0;
|
||||
v.s.dbl_sign = u.s.dbl_sign;
|
||||
*iptr = v.v;
|
||||
return (u.v);
|
||||
}
|
||||
|
||||
/*
|
||||
* There can be a fractional part of the input.
|
||||
* If you look at the math involved for a few seconds, it's
|
||||
* plain to see that the integral part is the input, with the
|
||||
* low (DBL_FRACBITS - (exponent - DBL_EXP_BIAS)) bits zeroed,
|
||||
* the fractional part is the part with the rest of the
|
||||
* bits zeroed. Just zeroing the high bits to get the
|
||||
* fractional part would yield a fraction in need of
|
||||
* normalization. Therefore, we take the easy way out, and
|
||||
* just use subtraction to get the fractional part.
|
||||
*/
|
||||
v.v = u.v;
|
||||
/* Zero the low bits of the fraction, the sleazy way. */
|
||||
frac = ((u_int64_t)v.s.dbl_frach << 32) + v.s.dbl_fracl;
|
||||
frac >>= DBL_FRACBITS - (u.s.dbl_exp - DBL_EXP_BIAS);
|
||||
frac <<= DBL_FRACBITS - (u.s.dbl_exp - DBL_EXP_BIAS);
|
||||
v.s.dbl_fracl = frac & 0xffffffff;
|
||||
v.s.dbl_frach = frac >> 32;
|
||||
*iptr = v.v;
|
||||
|
||||
u.v -= v.v;
|
||||
u.s.dbl_sign = v.s.dbl_sign;
|
||||
return (u.v);
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
/* $NetBSD: nanf.c,v 1.1 2000/05/09 21:55:49 bjh21 Exp $ */
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: nanf.c,v 1.1 2000/05/09 21:55:49 bjh21 Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
/* nanf.c */
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/* bytes for quiet NaN on an arm32 (IEEE single precision) */
|
||||
const char __nanf[] __attribute__((__aligned__(4))) = { 0, 0, (char)0xc0, 0x7f };
|
|
@ -0,0 +1,137 @@
|
|||
/* $NetBSD: setjmp.S,v 1.1 2000/05/09 21:55:49 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Mark Brinicombe
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Mark Brinicombe
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include <machine/setjmp.h>
|
||||
|
||||
/*
|
||||
* C library -- setjmp, longjmp
|
||||
*
|
||||
* longjmp(a,v)
|
||||
* will generate a "return(v)" from the last call to
|
||||
* setjmp(a)
|
||||
* by restoring registers from the stack.
|
||||
* The previous signal state is restored.
|
||||
*/
|
||||
|
||||
ENTRY(setjmp)
|
||||
/* Block all signals and retrieve the old signal mask */
|
||||
stmfd r13!, {r0, r14}
|
||||
mov r0, #0x00000000
|
||||
|
||||
bl _C_FUNC(sigblock)
|
||||
mov r1, r0
|
||||
|
||||
ldmfd r13!, {r0, r14}
|
||||
|
||||
/* Store signal mask */
|
||||
str r1, [r0, #(25 * 4)]
|
||||
|
||||
ldr r1, Lsetjmp_magic
|
||||
str r1, [r0], #4
|
||||
|
||||
#ifdef SOFTFLOAT
|
||||
add r0, r0, #52
|
||||
#else
|
||||
/* Store fp registers */
|
||||
sfm f4, 4, [r0], #48
|
||||
/* Store fpsr */
|
||||
rfs r1
|
||||
str r1, [r0], #0x0004
|
||||
#endif /*SOFTFLOAT*/
|
||||
/* Store integer registers */
|
||||
stmia r0, {r4-r14}
|
||||
mov r0, #0x00000000
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14
|
||||
#else
|
||||
mov r15, r14
|
||||
#endif
|
||||
|
||||
Lsetjmp_magic:
|
||||
.word _JB_MAGIC_SETJMP
|
||||
|
||||
|
||||
ENTRY(longjmp)
|
||||
ldr r2, Lsetjmp_magic
|
||||
ldr r3, [r0]
|
||||
teq r2, r3
|
||||
bne botch
|
||||
|
||||
/* Fetch signal mask */
|
||||
ldr r2, [r0, #(25 * 4)]
|
||||
|
||||
/* Set signal mask */
|
||||
stmfd r13!, {r0, r1, r14}
|
||||
|
||||
mov r0, r2
|
||||
bl _C_FUNC(sigsetmask)
|
||||
|
||||
ldmfd r13!, {r0, r1, r14}
|
||||
|
||||
add r0, r0, #4
|
||||
#ifdef SOFTFLOAT
|
||||
add r0, r0, #52
|
||||
#else
|
||||
/* Restore fp registers */
|
||||
lfm f4, 4, [r0], #48
|
||||
/* Restore FPSR */
|
||||
ldr r4, [r0], #0x0004
|
||||
wfs r4
|
||||
#endif /* SOFTFLOAT */
|
||||
/* Restore integer registers */
|
||||
ldmia r0, {r4-r14}
|
||||
|
||||
/* Validate r13 and r14 */
|
||||
teq r13, #0
|
||||
beq botch
|
||||
teq r14, #0
|
||||
beq botch
|
||||
|
||||
/* Set return value */
|
||||
|
||||
mov r0, r1
|
||||
teq r0, #0x00000000
|
||||
moveq r0, #0x00000001
|
||||
#ifdef __ARM_26__
|
||||
mov r15, r14
|
||||
#else
|
||||
mov r15, r14
|
||||
#endif
|
||||
|
||||
/* validation failed, die die die. */
|
||||
botch:
|
||||
bl _C_FUNC(longjmperror)
|
||||
bl _C_FUNC(abort)
|
||||
b . - 8 /* Cannot get here */
|
|
@ -0,0 +1,61 @@
|
|||
/* $NetBSD: sigsetjmp.S,v 1.1 2000/05/09 21:55:49 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 Mark Brinicombe
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Mark Brinicombe
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include <machine/setjmp.h>
|
||||
|
||||
/*
|
||||
* C library -- sigsetjmp, siglongjmp
|
||||
*
|
||||
* longjmp(a,v)
|
||||
* will generate a "return(v)" from the last call to
|
||||
* setjmp(a, m)
|
||||
* by restoring registers from the stack.
|
||||
* The previous signal state is restored.
|
||||
*/
|
||||
|
||||
ENTRY(sigsetjmp)
|
||||
teq r1, #0
|
||||
beq _C_FUNC(_setjmp)
|
||||
b _C_FUNC(setjmp)
|
||||
|
||||
L_setjmp_magic:
|
||||
.word _JB_MAGIC__SETJMP
|
||||
|
||||
ENTRY(siglongjmp)
|
||||
ldr r2, L_setjmp_magic
|
||||
ldr r3, [r0]
|
||||
teq r2, r3
|
||||
beq _C_FUNC(_longjmp)
|
||||
b _C_FUNC(longjmp)
|
|
@ -0,0 +1,4 @@
|
|||
# $NetBSD: Makefile.inc,v 1.1 2000/05/09 21:55:49 bjh21 Exp $
|
||||
|
||||
# hton* and nto* functions provided by ../gen/byte_swap_*.S
|
||||
SRCS+=
|
|
@ -0,0 +1,3 @@
|
|||
# $NetBSD: Makefile.inc,v 1.1 2000/05/09 21:55:49 bjh21 Exp $
|
||||
|
||||
SRCS+= abs.c div.c labs.c ldiv.c llabs.c
|
|
@ -0,0 +1,8 @@
|
|||
# $NetBSD: Makefile.inc,v 1.1 2000/05/09 21:55:50 bjh21 Exp $
|
||||
|
||||
SRCS+= memcpy.S _memcpy.S bcopy.S memmove.S memset.S bzero.S
|
||||
SRCS+= bcmp.c ffs.c index.c memchr.c memcmp.c \
|
||||
rindex.c strcat.c strcmp.c strcpy.c strcspn.c strlen.c \
|
||||
strncat.c strncmp.c strncpy.c strpbrk.c strsep.c \
|
||||
strspn.c strstr.c swab.c
|
||||
|
|
@ -0,0 +1,463 @@
|
|||
/* $Id: _memcpy.S,v 1.1 2000/05/09 21:55:50 bjh21 Exp $ */
|
||||
/* $NetBSD: _memcpy.S,v 1.1 2000/05/09 21:55:50 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Neil A. Carson and Mark Brinicombe
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
/*
|
||||
* This is one fun bit of code ...
|
||||
* Some easy listening music is suggested while trying to understand this
|
||||
* code e.g. Iron Maiden
|
||||
*
|
||||
* For anyone attempting to understand it :
|
||||
*
|
||||
* The core code is implemented here with simple stubs for memcpy()
|
||||
* memmove() and bcopy().
|
||||
*
|
||||
* All local labels are prefixed with Lmemcpy_
|
||||
* Following the prefix a label starting f is used in the forward copy code
|
||||
* while a label using b is used in the backwards copy code
|
||||
* The source and destination addresses determine whether a forward or
|
||||
* backward copy is performed.
|
||||
* Separate bits of code are used to deal with the following situations
|
||||
* for both the forward and backwards copy.
|
||||
* unaligned source address
|
||||
* unaligned destination address
|
||||
* Separate copy routines are used to produce an optimised result for each
|
||||
* of these cases.
|
||||
* The copy code will use LDM/STM instructions to copy up to 32 bytes at
|
||||
* a time where possible.
|
||||
*
|
||||
* Note: r12 (aka ip) can be trashed during the function along with
|
||||
* r0-r3 although r0-r2 have defined uses i.e. src, dest, len through out.
|
||||
* Additional registers are preserved prior to use i.e. r4, r5 & lr
|
||||
*
|
||||
* Apologies for the state of the comments ;-)
|
||||
*/
|
||||
|
||||
ENTRY(_memcpy)
|
||||
/* Determine copy direction */
|
||||
cmp r1, r0
|
||||
bcc Lmemcpy_backwards
|
||||
|
||||
moveq r0, #0 /* Quick abort for len=0 */
|
||||
#ifdef __APCS_26__
|
||||
moveqs pc, lr
|
||||
#else
|
||||
moveq pc, lr
|
||||
#endif
|
||||
|
||||
stmdb sp!, {r0, lr} /* memcpy() returns dest addr */
|
||||
subs r2, r2, #4
|
||||
blt Lmemcpy_fl4 /* less than 4 bytes */
|
||||
ands r12, r0, #3
|
||||
bne Lmemcpy_fdestul /* oh unaligned destination addr */
|
||||
ands r12, r1, #3
|
||||
bne Lmemcpy_fsrcul /* oh unaligned source addr */
|
||||
|
||||
Lmemcpy_ft8:
|
||||
/* We have aligned source and destination */
|
||||
subs r2, r2, #8
|
||||
blt Lmemcpy_fl12 /* less than 12 bytes (4 from above) */
|
||||
subs r2, r2, #0x14
|
||||
blt Lmemcpy_fl32 /* less than 32 bytes (12 from above) */
|
||||
stmdb sp!, {r4} /* borrow r4 */
|
||||
|
||||
/* blat 32 bytes at a time */
|
||||
/* XXX for really big copies perhaps we should use more registers */
|
||||
Lmemcpy_floop32:
|
||||
ldmia r1!, {r3, r4, r12, lr}
|
||||
stmia r0!, {r3, r4, r12, lr}
|
||||
ldmia r1!, {r3, r4, r12, lr}
|
||||
stmia r0!, {r3, r4, r12, lr}
|
||||
subs r2, r2, #0x20
|
||||
bge Lmemcpy_floop32
|
||||
|
||||
cmn r2, #0x10
|
||||
ldmgeia r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
|
||||
stmgeia r0!, {r3, r4, r12, lr}
|
||||
subge r2, r2, #0x10
|
||||
ldmia sp!, {r4} /* return r4 */
|
||||
|
||||
Lmemcpy_fl32:
|
||||
adds r2, r2, #0x14
|
||||
|
||||
/* blat 12 bytes at a time */
|
||||
Lmemcpy_floop12:
|
||||
ldmgeia r1!, {r3, r12, lr}
|
||||
stmgeia r0!, {r3, r12, lr}
|
||||
subges r2, r2, #0x0c
|
||||
bge Lmemcpy_floop12
|
||||
|
||||
Lmemcpy_fl12:
|
||||
adds r2, r2, #8
|
||||
blt Lmemcpy_fl4
|
||||
|
||||
subs r2, r2, #4
|
||||
ldrlt r3, [r1], #4
|
||||
strlt r3, [r0], #4
|
||||
ldmgeia r1!, {r3, r12}
|
||||
stmgeia r0!, {r3, r12}
|
||||
subge r2, r2, #4
|
||||
|
||||
Lmemcpy_fl4:
|
||||
/* less than 4 bytes to go */
|
||||
adds r2, r2, #4
|
||||
ldmeqia sp!, {r0, pc} /* done */
|
||||
|
||||
/* copy the crud byte at a time */
|
||||
cmp r2, #2
|
||||
ldrb r3, [r1], #1
|
||||
strb r3, [r0], #1
|
||||
ldrgeb r3, [r1], #1
|
||||
strgeb r3, [r0], #1
|
||||
ldrgtb r3, [r1], #1
|
||||
strgtb r3, [r0], #1
|
||||
#ifdef __APCS_26__
|
||||
ldmia sp!, {r0, pc}^
|
||||
#else
|
||||
ldmia sp!, {r0, pc}
|
||||
#endif
|
||||
|
||||
/* erg - unaligned destination */
|
||||
Lmemcpy_fdestul:
|
||||
rsb r12, r12, #4
|
||||
cmp r12, #2
|
||||
|
||||
/* align destination with byte copies */
|
||||
ldrb r3, [r1], #1
|
||||
strb r3, [r0], #1
|
||||
ldrgeb r3, [r1], #1
|
||||
strgeb r3, [r0], #1
|
||||
ldrgtb r3, [r1], #1
|
||||
strgtb r3, [r0], #1
|
||||
subs r2, r2, r12
|
||||
blt Lmemcpy_fl4 /* less the 4 bytes */
|
||||
|
||||
ands r12, r1, #3
|
||||
beq Lmemcpy_ft8 /* we have an aligned source */
|
||||
|
||||
/* erg - unaligned source */
|
||||
/* This is where it gets nasty ... */
|
||||
Lmemcpy_fsrcul:
|
||||
bic r1, r1, #3
|
||||
ldr lr, [r1], #4
|
||||
cmp r12, #2
|
||||
bgt Lmemcpy_fsrcul3
|
||||
beq Lmemcpy_fsrcul2
|
||||
cmp r2, #0x0c
|
||||
blt Lmemcpy_fsrcul1loop4
|
||||
sub r2, r2, #0x0c
|
||||
stmdb sp!, {r4, r5}
|
||||
|
||||
Lmemcpy_fsrcul1loop16:
|
||||
mov r3, lr, lsr #8
|
||||
ldmia r1!, {r4, r5, r12, lr}
|
||||
orr r3, r3, r4, lsl #24
|
||||
mov r4, r4, lsr #8
|
||||
orr r4, r4, r5, lsl #24
|
||||
mov r5, r5, lsr #8
|
||||
orr r5, r5, r12, lsl #24
|
||||
mov r12, r12, lsr #8
|
||||
orr r12, r12, lr, lsl #24
|
||||
stmia r0!, {r3-r5, r12}
|
||||
subs r2, r2, #0x10
|
||||
bge Lmemcpy_fsrcul1loop16
|
||||
ldmia sp!, {r4, r5}
|
||||
adds r2, r2, #0x0c
|
||||
blt Lmemcpy_fsrcul1l4
|
||||
|
||||
Lmemcpy_fsrcul1loop4:
|
||||
mov r12, lr, lsr #8
|
||||
ldr lr, [r1], #4
|
||||
orr r12, r12, lr, lsl #24
|
||||
str r12, [r0], #4
|
||||
subs r2, r2, #4
|
||||
bge Lmemcpy_fsrcul1loop4
|
||||
|
||||
Lmemcpy_fsrcul1l4:
|
||||
sub r1, r1, #3
|
||||
b Lmemcpy_fl4
|
||||
|
||||
Lmemcpy_fsrcul2:
|
||||
cmp r2, #0x0c
|
||||
blt Lmemcpy_fsrcul2loop4
|
||||
sub r2, r2, #0x0c
|
||||
stmdb sp!, {r4, r5}
|
||||
|
||||
Lmemcpy_fsrcul2loop16:
|
||||
mov r3, lr, lsr #16
|
||||
ldmia r1!, {r4, r5, r12, lr}
|
||||
orr r3, r3, r4, lsl #16
|
||||
mov r4, r4, lsr #16
|
||||
orr r4, r4, r5, lsl #16
|
||||
mov r5, r5, lsr #16
|
||||
orr r5, r5, r12, lsl #16
|
||||
mov r12, r12, lsr #16
|
||||
orr r12, r12, lr, lsl #16
|
||||
stmia r0!, {r3-r5, r12}
|
||||
subs r2, r2, #0x10
|
||||
bge Lmemcpy_fsrcul2loop16
|
||||
ldmia sp!, {r4, r5}
|
||||
adds r2, r2, #0x0c
|
||||
blt Lmemcpy_fsrcul2l4
|
||||
|
||||
Lmemcpy_fsrcul2loop4:
|
||||
mov r12, lr, lsr #16
|
||||
ldr lr, [r1], #4
|
||||
orr r12, r12, lr, lsl #16
|
||||
str r12, [r0], #4
|
||||
subs r2, r2, #4
|
||||
bge Lmemcpy_fsrcul2loop4
|
||||
|
||||
Lmemcpy_fsrcul2l4:
|
||||
sub r1, r1, #2
|
||||
b Lmemcpy_fl4
|
||||
|
||||
Lmemcpy_fsrcul3:
|
||||
cmp r2, #0x0c
|
||||
blt Lmemcpy_fsrcul3loop4
|
||||
sub r2, r2, #0x0c
|
||||
stmdb sp!, {r4, r5}
|
||||
|
||||
Lmemcpy_fsrcul3loop16:
|
||||
mov r3, lr, lsr #24
|
||||
ldmia r1!, {r4, r5, r12, lr}
|
||||
orr r3, r3, r4, lsl #8
|
||||
mov r4, r4, lsr #24
|
||||
orr r4, r4, r5, lsl #8
|
||||
mov r5, r5, lsr #24
|
||||
orr r5, r5, r12, lsl #8
|
||||
mov r12, r12, lsr #24
|
||||
orr r12, r12, lr, lsl #8
|
||||
stmia r0!, {r3-r5, r12}
|
||||
subs r2, r2, #0x10
|
||||
bge Lmemcpy_fsrcul3loop16
|
||||
ldmia sp!, {r4, r5}
|
||||
adds r2, r2, #0x0c
|
||||
blt Lmemcpy_fsrcul3l4
|
||||
|
||||
Lmemcpy_fsrcul3loop4:
|
||||
mov r12, lr, lsr #24
|
||||
ldr lr, [r1], #4
|
||||
orr r12, r12, lr, lsl #8
|
||||
str r12, [r0], #4
|
||||
subs r2, r2, #4
|
||||
bge Lmemcpy_fsrcul3loop4
|
||||
|
||||
Lmemcpy_fsrcul3l4:
|
||||
sub r1, r1, #1
|
||||
b Lmemcpy_fl4
|
||||
|
||||
Lmemcpy_backwards:
|
||||
add r1, r1, r2
|
||||
add r0, r0, r2
|
||||
subs r2, r2, #4
|
||||
blt Lmemcpy_bl4 /* less than 4 bytes */
|
||||
ands r12, r0, #3
|
||||
bne Lmemcpy_bdestul /* oh unaligned destination addr */
|
||||
ands r12, r1, #3
|
||||
bne Lmemcpy_bsrcul /* oh unaligned source addr */
|
||||
|
||||
Lmemcpy_bt8:
|
||||
/* We have aligned source and destination */
|
||||
subs r2, r2, #8
|
||||
blt Lmemcpy_bl12 /* less than 12 bytes (4 from above) */
|
||||
stmdb sp!, {r4, lr}
|
||||
subs r2, r2, #0x14 /* less than 32 bytes (12 from above) */
|
||||
blt Lmemcpy_bl32
|
||||
|
||||
/* blat 32 bytes at a time */
|
||||
/* XXX for really big copies perhaps we should use more registers */
|
||||
Lmemcpy_bloop32:
|
||||
ldmdb r1!, {r3, r4, r12, lr}
|
||||
stmdb r0!, {r3, r4, r12, lr}
|
||||
ldmdb r1!, {r3, r4, r12, lr}
|
||||
stmdb r0!, {r3, r4, r12, lr}
|
||||
subs r2, r2, #0x20
|
||||
bge Lmemcpy_bloop32
|
||||
|
||||
Lmemcpy_bl32:
|
||||
cmn r2, #0x10
|
||||
ldmgedb r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */
|
||||
stmgedb r0!, {r3, r4, r12, lr}
|
||||
subge r2, r2, #0x10
|
||||
adds r2, r2, #0x14
|
||||
ldmgedb r1!, {r3, r12, lr} /* blat a remaining 12 bytes */
|
||||
stmgedb r0!, {r3, r12, lr}
|
||||
subge r2, r2, #0x0c
|
||||
ldmia sp!, {r4, lr}
|
||||
|
||||
Lmemcpy_bl12:
|
||||
adds r2, r2, #8
|
||||
blt Lmemcpy_bl4
|
||||
subs r2, r2, #4
|
||||
ldrlt r3, [r1, #-4]!
|
||||
strlt r3, [r0, #-4]!
|
||||
ldmgedb r1!, {r3, r12}
|
||||
stmgedb r0!, {r3, r12}
|
||||
subge r2, r2, #4
|
||||
|
||||
Lmemcpy_bl4:
|
||||
/* less than 4 bytes to go */
|
||||
adds r2, r2, #4
|
||||
moveq pc, lr /* done */
|
||||
|
||||
/* copy the crud byte at a time */
|
||||
cmp r2, #2
|
||||
ldrb r3, [r1, #-1]!
|
||||
strb r3, [r0, #-1]!
|
||||
ldrgeb r3, [r1, #-1]!
|
||||
strgeb r3, [r0, #-1]!
|
||||
ldrgtb r3, [r1, #-1]!
|
||||
strgtb r3, [r0, #-1]!
|
||||
#ifdef __APCS_26__
|
||||
movs pc, lr
|
||||
#else
|
||||
mov pc, lr
|
||||
#endif
|
||||
|
||||
/* erg - unaligned destination */
|
||||
Lmemcpy_bdestul:
|
||||
cmp r12, #2
|
||||
|
||||
/* align destination with byte copies */
|
||||
ldrb r3, [r1, #-1]!
|
||||
strb r3, [r0, #-1]!
|
||||
ldrgeb r3, [r1, #-1]!
|
||||
strgeb r3, [r0, #-1]!
|
||||
ldrgtb r3, [r1, #-1]!
|
||||
strgtb r3, [r0, #-1]!
|
||||
subs r2, r2, r12
|
||||
blt Lmemcpy_bl4 /* less than 4 bytes to go */
|
||||
ands r12, r1, #3
|
||||
beq Lmemcpy_bt8 /* we have an aligned source */
|
||||
|
||||
/* erg - unaligned source */
|
||||
/* This is where it gets nasty ... */
|
||||
Lmemcpy_bsrcul:
|
||||
bic r1, r1, #3
|
||||
ldr r3, [r1, #0]
|
||||
cmp r12, #2
|
||||
blt Lmemcpy_bsrcul1
|
||||
beq Lmemcpy_bsrcul2
|
||||
cmp r2, #0x0c
|
||||
blt Lmemcpy_bsrcul3loop4
|
||||
sub r2, r2, #0x0c
|
||||
stmdb sp!, {r4, r5, lr}
|
||||
|
||||
Lmemcpy_bsrcul3loop16:
|
||||
mov lr, r3, lsl #8
|
||||
ldmdb r1!, {r3-r5, r12}
|
||||
orr lr, lr, r12, lsr #24
|
||||
mov r12, r12, lsl #8
|
||||
orr r12, r12, r5, lsr #24
|
||||
mov r5, r5, lsl #8
|
||||
orr r5, r5, r4, lsr #24
|
||||
mov r4, r4, lsl #8
|
||||
orr r4, r4, r3, lsr #24
|
||||
stmdb r0!, {r4, r5, r12, lr}
|
||||
subs r2, r2, #0x10
|
||||
bge Lmemcpy_bsrcul3loop16
|
||||
ldmia sp!, {r4, r5, lr}
|
||||
adds r2, r2, #0x0c
|
||||
blt Lmemcpy_bsrcul3l4
|
||||
|
||||
Lmemcpy_bsrcul3loop4:
|
||||
mov r12, r3, lsl #8
|
||||
ldr r3, [r1, #-4]!
|
||||
orr r12, r12, r3, lsr #24
|
||||
str r12, [r0, #-4]!
|
||||
subs r2, r2, #4
|
||||
bge Lmemcpy_bsrcul3loop4
|
||||
|
||||
Lmemcpy_bsrcul3l4:
|
||||
add r1, r1, #3
|
||||
b Lmemcpy_bl4
|
||||
|
||||
Lmemcpy_bsrcul2:
|
||||
cmp r2, #0x0c
|
||||
blt Lmemcpy_bsrcul2loop4
|
||||
sub r2, r2, #0x0c
|
||||
stmdb sp!, {r4, r5, lr}
|
||||
|
||||
Lmemcpy_bsrcul2loop16:
|
||||
mov lr, r3, lsl #16
|
||||
ldmdb r1!, {r3-r5, r12}
|
||||
orr lr, lr, r12, lsr #16
|
||||
mov r12, r12, lsl #16
|
||||
orr r12, r12, r5, lsr #16
|
||||
mov r5, r5, lsl #16
|
||||
orr r5, r5, r4, lsr #16
|
||||
mov r4, r4, lsl #16
|
||||
orr r4, r4, r3, lsr #16
|
||||
stmdb r0!, {r4, r5, r12, lr}
|
||||
subs r2, r2, #0x10
|
||||
bge Lmemcpy_bsrcul2loop16
|
||||
ldmia sp!, {r4, r5, lr}
|
||||
adds r2, r2, #0x0c
|
||||
blt Lmemcpy_bsrcul2l4
|
||||
|
||||
Lmemcpy_bsrcul2loop4:
|
||||
mov r12, r3, lsl #16
|
||||
ldr r3, [r1, #-4]!
|
||||
orr r12, r12, r3, lsr #16
|
||||
str r12, [r0, #-4]!
|
||||
subs r2, r2, #4
|
||||
bge Lmemcpy_bsrcul2loop4
|
||||
|
||||
Lmemcpy_bsrcul2l4:
|
||||
add r1, r1, #2
|
||||
b Lmemcpy_bl4
|
||||
|
||||
Lmemcpy_bsrcul1:
|
||||
cmp r2, #0x0c
|
||||
blt Lmemcpy_bsrcul1loop4
|
||||
sub r2, r2, #0x0c
|
||||
stmdb sp!, {r4, r5, lr}
|
||||
|
||||
Lmemcpy_bsrcul1loop32:
|
||||
mov lr, r3, lsl #24
|
||||
ldmdb r1!, {r3-r5, r12}
|
||||
orr lr, lr, r12, lsr #8
|
||||
mov r12, r12, lsl #24
|
||||
orr r12, r12, r5, lsr #8
|
||||
mov r5, r5, lsl #24
|
||||
orr r5, r5, r4, lsr #8
|
||||
mov r4, r4, lsl #24
|
||||
orr r4, r4, r3, lsr #8
|
||||
stmdb r0!, {r4, r5, r12, lr}
|
||||
subs r2, r2, #0x10
|
||||
bge Lmemcpy_bsrcul1loop32
|
||||
ldmia sp!, {r4, r5, lr}
|
||||
adds r2, r2, #0x0c
|
||||
blt Lmemcpy_bsrcul1l4
|
||||
|
||||
Lmemcpy_bsrcul1loop4:
|
||||
mov r12, r3, lsl #24
|
||||
ldr r3, [r1, #-4]!
|
||||
orr r12, r12, r3, lsr #8
|
||||
str r12, [r0, #-4]!
|
||||
subs r2, r2, #4
|
||||
bge Lmemcpy_bsrcul1loop4
|
||||
|
||||
Lmemcpy_bsrcul1l4:
|
||||
add r1, r1, #1
|
||||
b Lmemcpy_bl4
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/* $NetBSD: bcopy.S,v 1.1 2000/05/09 21:55:50 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Neil A. Carson and Mark Brinicombe
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
/* bcopy = memcpy/memmove with arguments reversed. */
|
||||
|
||||
TWOENTRY(bcopy,ovbcopy)
|
||||
/* switch the source and destination registers */
|
||||
eor r0, r1, r0
|
||||
eor r1, r0, r1
|
||||
eor r0, r1, r0
|
||||
b _C_FUNC(_memcpy)
|
|
@ -0,0 +1,44 @@
|
|||
/* $NetBSD: bzero.S,v 1.1 2000/05/09 21:55:50 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Neil A. Carson and Mark Brinicombe
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(bzero)
|
||||
mov r2, r1
|
||||
mov r1, #0
|
||||
b _C_FUNC(memset)
|
|
@ -0,0 +1,48 @@
|
|||
/* $NetBSD: memcpy.S,v 1.1 2000/05/09 21:55:50 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Neil A. Carson and Mark Brinicombe
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(memcpy)
|
||||
stmfd sp!, {r0, lr}
|
||||
bl _C_FUNC(_memcpy)
|
||||
#ifdef __APCS_26__
|
||||
ldmfd sp!, {r0, pc}^
|
||||
#else
|
||||
ldmfd sp!, {r0, pc}
|
||||
#endif
|
|
@ -0,0 +1,48 @@
|
|||
/* $NetBSD: memmove.S,v 1.1 2000/05/09 21:55:50 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Neil A. Carson and Mark Brinicombe
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
ENTRY(memmove)
|
||||
stmfd sp!, {r0, lr}
|
||||
bl _C_FUNC(_memcpy)
|
||||
#ifdef __APCS_26__
|
||||
ldmfd sp!, {r0, pc}^
|
||||
#else
|
||||
ldmfd sp!, {r0, pc}
|
||||
#endif
|
|
@ -0,0 +1,134 @@
|
|||
/* $NetBSD: memset.S,v 1.1 2000/05/09 21:55:50 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Mark Brinicombe.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Mark Brinicombe.
|
||||
* 4. The name of the company nor the name of the author may be used to
|
||||
* endorse or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
/*
|
||||
* Sets a block of memory to the specified value
|
||||
*
|
||||
* On entry:
|
||||
* r0 - dest address
|
||||
* r1 - byte to write
|
||||
* r2 - number of bytes to write
|
||||
*
|
||||
* On exit:
|
||||
* r0 - dest address
|
||||
*/
|
||||
|
||||
ENTRY(memset)
|
||||
stmfd sp!, {r0} /* Remember address for return value */
|
||||
and r1, r1, #0x000000ff /* We write bytes */
|
||||
|
||||
cmp r2, #0x00000004 /* Do we have less than 4 bytes */
|
||||
blt Lmemset_lessthanfour
|
||||
|
||||
/* Ok first we will word align the address */
|
||||
|
||||
ands r3, r0, #0x00000003 /* Get the bottom two bits */
|
||||
beq Lmemset_addraligned /* The address is word aligned */
|
||||
|
||||
rsb r3, r3, #0x00000004
|
||||
sub r2, r2, r3
|
||||
cmp r3, #0x00000002
|
||||
strb r1, [r0], #0x0001 /* Set 1 byte */
|
||||
strgeb r1, [r0], #0x0001 /* Set another byte */
|
||||
strgtb r1, [r0], #0x0001 /* and a third */
|
||||
|
||||
cmp r2, #0x00000004
|
||||
blt Lmemset_lessthanfour
|
||||
|
||||
/* Now we must be word aligned */
|
||||
|
||||
Lmemset_addraligned:
|
||||
|
||||
orr r3, r1, r1, lsl #8 /* Repeat the byte into a word */
|
||||
orr r3, r3, r3, lsl #16
|
||||
|
||||
/* We know we have at least 4 bytes ... */
|
||||
|
||||
cmp r2, #0x00000020 /* If less than 32 then use words */
|
||||
blt Lmemset_lessthan32
|
||||
|
||||
/* We have at least 32 so lets use quad words */
|
||||
|
||||
stmfd sp!, {r4-r6} /* Store registers */
|
||||
mov r4, r3 /* Duplicate data */
|
||||
mov r5, r3
|
||||
mov r6, r3
|
||||
|
||||
Lmemset_loop16:
|
||||
stmia r0!, {r3-r6} /* Store 16 bytes */
|
||||
sub r2, r2, #0x00000010 /* Adjust count */
|
||||
cmp r2, #0x00000010 /* Still got at least 16 bytes ? */
|
||||
bgt Lmemset_loop16
|
||||
|
||||
ldmfd sp!, {r4-r6} /* Restore registers */
|
||||
|
||||
/* Do we need to set some words as well ? */
|
||||
|
||||
cmp r2, #0x00000004
|
||||
blt Lmemset_lessthanfour
|
||||
|
||||
/* Have either less than 16 or less than 32 depending on route taken */
|
||||
|
||||
Lmemset_lessthan32:
|
||||
|
||||
/* We have at least 4 bytes so copy as words */
|
||||
|
||||
Lmemset_loop4:
|
||||
str r3, [r0], #0x0004
|
||||
sub r2, r2, #0x0004
|
||||
cmp r2, #0x00000004
|
||||
bge Lmemset_loop4
|
||||
|
||||
Lmemset_lessthanfour:
|
||||
cmp r2, #0x00000000
|
||||
ldmeqfd sp!, {r0}
|
||||
#ifdef __APCS_26__
|
||||
moveqs pc, lr /* Zero length so exit */
|
||||
#else
|
||||
moveq pc, lr /* Zero length so exit */
|
||||
#endif
|
||||
|
||||
cmp r2, #0x00000002
|
||||
strb r1, [r0], #0x0001 /* Set 1 byte */
|
||||
strgeb r1, [r0], #0x0001 /* Set another byte */
|
||||
strgtb r1, [r0], #0x0001 /* and a third */
|
||||
|
||||
ldmfd sp!, {r0}
|
||||
#ifdef __APCS_26__
|
||||
movs pc, lr /* Exit */
|
||||
#else
|
||||
mov pc, lr /* Exit */
|
||||
#endif
|
|
@ -0,0 +1,59 @@
|
|||
/* $NetBSD: Ovfork.S,v 1.1 2000/05/09 21:55:50 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)Ovfork.s 5.1 (Berkeley) 4/23/90
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
WARN_REFERENCES(vfork, \
|
||||
"warning: reference to compatibility vfork(); include <unistd.h> for correct reference")
|
||||
|
||||
/*
|
||||
* pid = vfork();
|
||||
*/
|
||||
.text
|
||||
.align 0
|
||||
|
||||
ENTRY(vfork)
|
||||
mov r2, r14
|
||||
swi SYS_vfork
|
||||
bcs cerror
|
||||
sub r1, r1, #0x00000001
|
||||
and r0, r0, r1
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r2
|
||||
#else
|
||||
mov r15, r2
|
||||
#endif
|
|
@ -0,0 +1,42 @@
|
|||
/* $NetBSD: __semctl.S,v 1.1 2000/05/09 21:55:50 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
|
||||
* NASA Ames Research Center.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
PSEUDO(__semctl,compat_14___semctl)
|
|
@ -0,0 +1,49 @@
|
|||
/* $NetBSD: __sigreturn14.S,v 1.1 2000/05/09 21:55:50 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)sigreturn.s 5.2 (Berkeley) 12/17/90"
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
/*
|
||||
* We must preserve the state of the registers as the user has set them up.
|
||||
*/
|
||||
|
||||
SYSCALL(__sigreturn14)
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14
|
||||
#else
|
||||
mov r15, r14
|
||||
#endif
|
|
@ -0,0 +1,56 @@
|
|||
/* $NetBSD: __vfork14.S,v 1.1 2000/05/09 21:55:50 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)Ovfork.s 5.1 (Berkeley) 4/23/90
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
/*
|
||||
* pid = vfork();
|
||||
*/
|
||||
.text
|
||||
.align 0
|
||||
|
||||
ENTRY(__vfork14)
|
||||
mov r2, r14
|
||||
swi SYS___vfork14
|
||||
bcs cerror
|
||||
sub r1, r1, #0x00000001
|
||||
and r0, r0, r1
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r2
|
||||
#else
|
||||
mov r15, r2
|
||||
#endif
|
|
@ -0,0 +1,102 @@
|
|||
/* $NetBSD: brk.S,v 1.1 2000/05/09 21:55:51 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)brk.s 5.2 (Berkeley) 12/17/90
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
.globl _end
|
||||
.globl curbrk
|
||||
|
||||
.data
|
||||
.align 0
|
||||
.globl _C_LABEL(__minbrk)
|
||||
.type _C_LABEL(__minbrk),#object
|
||||
_C_LABEL(__minbrk):
|
||||
.word _end
|
||||
|
||||
/*
|
||||
* Change the data segment size
|
||||
*/
|
||||
ENTRY(brk)
|
||||
#ifdef PIC
|
||||
/* Setup the GOT */
|
||||
ldr r3, Lgot
|
||||
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
|
||||
|
||||
#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 success */
|
||||
mov r0, #0x00000000
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14
|
||||
#else
|
||||
mov r15, r14
|
||||
#endif
|
||||
|
||||
.align 0
|
||||
#ifdef PIC
|
||||
Lgot:
|
||||
.word __GLOBAL_OFFSET_TABLE_+. - (L1+4)
|
||||
#endif
|
||||
Lminbrk:
|
||||
.word _C_LABEL(__minbrk)
|
||||
Lcurbrk:
|
||||
.word curbrk
|
|
@ -0,0 +1,83 @@
|
|||
/* $NetBSD: cerror.S,v 1.1 2000/05/09 21:55:51 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)cerror.s 5.1 (Berkeley) 4/23/90
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
ASENTRY(cerror)
|
||||
#ifdef _REENTRANT
|
||||
stmfd sp!, {r4, lr}
|
||||
mov r4, r0
|
||||
bl _C_LABEL(__errno)
|
||||
str r4, [r0]
|
||||
mvn r0, #0x00000000
|
||||
mvn r1, #0x00000000
|
||||
#ifdef __APCS_26__
|
||||
ldmfd sp!, {r4, pc}^
|
||||
#else
|
||||
ldmfd sp!, {r4, pc}
|
||||
#endif
|
||||
#else
|
||||
#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 /* PIC */
|
||||
str r0, [r1]
|
||||
mvn r0, #0x00000000
|
||||
mvn r1, #0x00000000
|
||||
#ifdef __APCS_26__
|
||||
movs pc, lr
|
||||
#else
|
||||
mov pc, lr
|
||||
#endif
|
||||
|
||||
#ifdef PIC
|
||||
.align 0
|
||||
got:
|
||||
.word __GLOBAL_OFFSET_TABLE_ + (. - (L1+4))
|
||||
#endif /* PIC */
|
||||
|
||||
.globl _C_LABEL(errno)
|
||||
|
||||
Lerrno:
|
||||
.word _C_LABEL(errno)
|
||||
#endif /* _REENTRANT */
|
|
@ -0,0 +1,47 @@
|
|||
/* $NetBSD: exect.S,v 1.1 2000/05/09 21:55:51 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)exect.s 5.1 (Berkeley) 4/23/90
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
ENTRY(exect)
|
||||
swi SYS_execve
|
||||
bcs cerror
|
||||
#ifdef __APCS_26__
|
||||
mov r15, r14
|
||||
#else
|
||||
mov r15, r14
|
||||
#endif
|
|
@ -0,0 +1,47 @@
|
|||
/* $NetBSD: fork.S,v 1.1 2000/05/09 21:55:51 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)fork.s 5.1 (Berkeley) 4/23/90
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
SYSCALL(fork)
|
||||
sub r1, r1, #0x00000001
|
||||
and r0, r0, r1
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14
|
||||
#else
|
||||
mov r15, r14
|
||||
#endif
|
|
@ -0,0 +1,45 @@
|
|||
/* $NetBSD: msgctl.S,v 1.1 2000/05/09 21:55:51 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
|
||||
* NASA Ames Research Center.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
WARN_REFERENCES(msgctl, \
|
||||
"warning: reference to compatibility msgctl(); include <sys/msg.h> for correct reference")
|
||||
|
||||
PSEUDO(msgctl,compat_14_msgctl)
|
|
@ -0,0 +1,51 @@
|
|||
/* $NetBSD: pipe.S,v 1.1 2000/05/09 21:55:51 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)pipe.s 5.1 (Berkeley) 4/23/90
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
ENTRY(pipe)
|
||||
mov r2, r0
|
||||
swi SYS_pipe
|
||||
bcs cerror
|
||||
str r0, [r2, #0x0000]
|
||||
str r1, [r2, #0x0004]
|
||||
mov r0, #0x00000000
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14
|
||||
#else
|
||||
mov r15, r14
|
||||
#endif
|
|
@ -0,0 +1,81 @@
|
|||
/* $NetBSD: ptrace.S,v 1.1 2000/05/09 21:55:51 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)ptrace.s 5.1 (Berkeley) 4/23/90
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
ENTRY(ptrace)
|
||||
#ifdef _REENTRANT
|
||||
stmfd sp!, {r0-r3, lr}
|
||||
bl _C_LABEL(__errno)
|
||||
mov r1, #0x00000000
|
||||
str r1, [r0]
|
||||
ldmfd sp!, {r0-r3, lr}
|
||||
#else
|
||||
stmfd sp!, {r0, r1}
|
||||
#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 /* PIC */
|
||||
mov r0, #0x00000000
|
||||
str r0, [r1]
|
||||
ldmfd sp!, {r0, r1}
|
||||
#endif /* _REENTRANT */
|
||||
|
||||
swi SYS_ptrace
|
||||
bcs cerror
|
||||
#ifdef __APCS_26__
|
||||
movs pc, lr
|
||||
#else
|
||||
mov pc, lr
|
||||
#endif
|
||||
|
||||
#ifndef _REENTRANT
|
||||
#ifdef PIC
|
||||
.align 0
|
||||
got:
|
||||
.word __GLOBAL_OFFSET_TABLE_ + (. - (L1+4))
|
||||
#endif /* PIC */
|
||||
|
||||
Lerrno:
|
||||
.word _C_LABEL(errno)
|
||||
#endif /* !_REENTRANT */
|
|
@ -0,0 +1,90 @@
|
|||
/* $NetBSD: sbrk.S,v 1.1 2000/05/09 21:55:51 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)sbrk.s 5.1 (Berkeley) 4/23/90
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
.globl _C_LABEL(end)
|
||||
|
||||
.data
|
||||
.align 0
|
||||
.globl curbrk
|
||||
.type curbrk,#object
|
||||
curbrk:
|
||||
.word _C_LABEL(end)
|
||||
|
||||
/*
|
||||
* Change the data segment size
|
||||
*/
|
||||
ENTRY(sbrk)
|
||||
#ifdef PIC
|
||||
/* Setup the GOT */
|
||||
ldr r3, Lgot
|
||||
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]
|
||||
|
||||
/* Return old curbrk value */
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14
|
||||
#else
|
||||
mov r15, r14
|
||||
#endif
|
||||
|
||||
.align 0
|
||||
#ifdef PIC
|
||||
Lgot:
|
||||
.word __GLOBAL_OFFSET_TABLE_+. - (L1+4)
|
||||
#endif
|
||||
Lcurbrk:
|
||||
.word curbrk
|
|
@ -0,0 +1,69 @@
|
|||
/* $NetBSD: setlogin.S,v 1.1 2000/05/09 21:55:51 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)setlogin.s 5.2 (Berkeley) 4/12/91
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
#include "SYS.h"
|
||||
|
||||
.globl _C_LABEL(__logname_valid) /* in getlogin() */
|
||||
|
||||
SYSCALL(setlogin)
|
||||
#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]
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14
|
||||
#else
|
||||
mov r15, r14
|
||||
#endif
|
||||
|
||||
#ifdef PIC
|
||||
.align 0
|
||||
got:
|
||||
.word __GLOBAL_OFFSET_TABLE_ + (. - (L1+4))
|
||||
#endif
|
||||
|
||||
Llogname:
|
||||
.word _C_LABEL(__logname_valid)
|
|
@ -0,0 +1,45 @@
|
|||
/* $NetBSD: shmctl.S,v 1.1 2000/05/09 21:55:51 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
|
||||
* NASA Ames Research Center.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
WARN_REFERENCES(shmctl, \
|
||||
"warning: reference to compatibility shmctl(); include <sys/shm.h> for correct reference")
|
||||
|
||||
PSEUDO(shmctl,compat_14_shmctl)
|
|
@ -0,0 +1,45 @@
|
|||
/* $NetBSD: sigaction.S,v 1.1 2000/05/09 21:55:51 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
|
||||
* NASA Ames Research Center.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the NetBSD
|
||||
* Foundation, Inc. and its contributors.
|
||||
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
WARN_REFERENCES(sigaction, \
|
||||
"warning: reference to compatibility sigaction(); include <signal.h> for correct reference")
|
||||
|
||||
PSEUDO(sigaction,compat_13_sigaction13)
|
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD: sigpending.S,v 1.1 2000/05/09 21:55:51 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)sigpending.s 5.1 (Berkeley) 7/1/90
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
WARN_REFERENCES(sigpending, \
|
||||
"warning: reference to compatibility sigpending(); include <signal.h> for correct reference")
|
||||
|
||||
ENTRY(sigpending)
|
||||
mov r2, r0
|
||||
swi SYS_compat_13_sigpending13
|
||||
bcs cerror
|
||||
str r0, [r2]
|
||||
mov r0, #0x00000000
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14
|
||||
#else
|
||||
mov r15, r14
|
||||
#endif
|
|
@ -0,0 +1,57 @@
|
|||
/* $NetBSD: sigprocmask.S,v 1.1 2000/05/09 21:55:52 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)sigprocmask.s 5.2 (Berkeley) 12/17/90
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
WARN_REFERENCES(sigprocmask, \
|
||||
"warning: reference to compatibility sigprocmask(); include <signal.h> for correct reference")
|
||||
|
||||
ENTRY(sigprocmask)
|
||||
teq r1, #0x00000000
|
||||
moveq r0, #0x00000001
|
||||
moveq r1, #0x00000000
|
||||
ldrne r1, [r1]
|
||||
swi SYS_compat_13_sigprocmask13
|
||||
bcs cerror
|
||||
teq r2, #0x00000000
|
||||
strne r0, [r2]
|
||||
mov r0, #0x00000000
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14
|
||||
#else
|
||||
mov r15, r14
|
||||
#endif
|
|
@ -0,0 +1,47 @@
|
|||
/* $NetBSD: sigreturn.S,v 1.1 2000/05/09 21:55:52 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)sigreturn.s 5.2 (Berkeley) 12/17/90"
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
/*
|
||||
* We must preserve the state of the registers as the user has set them up.
|
||||
*/
|
||||
|
||||
WARN_REFERENCES(sigreturn, \
|
||||
"warning: reference to compatibility sigreturn(); include <signal.h> for correct reference")
|
||||
|
||||
PSEUDO(sigreturn,compat_13_sigreturn13)
|
|
@ -0,0 +1,52 @@
|
|||
/* $NetBSD: sigsuspend.S,v 1.1 2000/05/09 21:55:52 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)sigsuspend.s 5.2 (Berkeley) 12/17/90
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
WARN_REFERENCES(sigsuspend, \
|
||||
"warning: reference to compatibility sigsuspend(); include <signal.h> for correct reference")
|
||||
|
||||
ENTRY(sigsuspend)
|
||||
ldr r0, [r0]
|
||||
swi SYS_compat_13_sigsuspend13
|
||||
bcs cerror
|
||||
mov r0, #0x00000000
|
||||
#ifdef __APCS_26__
|
||||
mov r15, r14
|
||||
#else
|
||||
movs r15, r14
|
||||
#endif
|
|
@ -0,0 +1,47 @@
|
|||
/* $NetBSD: syscall.S,v 1.1 2000/05/09 21:55:52 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)syscall.s 5.1 (Berkeley) 4/23/90
|
||||
*/
|
||||
|
||||
#include "SYS.h"
|
||||
|
||||
ENTRY(syscall)
|
||||
swi 0x00000000
|
||||
bcs cerror
|
||||
#ifdef __APCS_26__
|
||||
movs r15, r14
|
||||
#else
|
||||
mov r15, r14
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nlist_private.h,v 1.7 2000/01/03 02:13:32 msaitoh Exp $ */
|
||||
/* $NetBSD: nlist_private.h,v 1.8 2000/05/09 21:55:52 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -33,6 +33,8 @@
|
|||
#if defined(__alpha__)
|
||||
# define NLIST_ECOFF
|
||||
# define NLIST_ELF64
|
||||
#elif defined(__arm26__)
|
||||
# define NLIST_ELF32
|
||||
#elif defined(__mips__)
|
||||
# define NLIST_AOUT
|
||||
# define NLIST_ECOFF
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: xdr_float.c,v 1.20 2000/01/22 22:19:18 mycroft Exp $ */
|
||||
/* $NetBSD: xdr_float.c,v 1.21 2000/05/09 21:55:52 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -35,7 +35,7 @@
|
|||
static char *sccsid = "@(#)xdr_float.c 1.12 87/08/11 Copyr 1984 Sun Micro";
|
||||
static char *sccsid = "@(#)xdr_float.c 2.1 88/07/29 4.0 RPCSRC";
|
||||
#else
|
||||
__RCSID("$NetBSD: xdr_float.c,v 1.20 2000/01/22 22:19:18 mycroft Exp $");
|
||||
__RCSID("$NetBSD: xdr_float.c,v 1.21 2000/05/09 21:55:52 bjh21 Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -71,7 +71,8 @@ __weak_alias(xdr_float,_xdr_float)
|
|||
|
||||
#if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \
|
||||
defined(__mips__) || defined(__ns32k__) || defined(__alpha__) || \
|
||||
defined(__arm32__) || defined(__powerpc__) || defined(__sh3__)
|
||||
defined(__arm32__) || defined(__powerpc__) || defined(__sh3__) || \
|
||||
defined(__arm26__)
|
||||
#include <machine/endian.h>
|
||||
#define IEEEFP
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: strtod.c,v 1.33 1999/11/26 07:39:45 msaitoh Exp $ */
|
||||
/* $NetBSD: strtod.c,v 1.34 2000/05/09 21:55:53 bjh21 Exp $ */
|
||||
|
||||
/****************************************************************
|
||||
*
|
||||
|
@ -93,7 +93,7 @@
|
|||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: strtod.c,v 1.33 1999/11/26 07:39:45 msaitoh Exp $");
|
||||
__RCSID("$NetBSD: strtod.c,v 1.34 2000/05/09 21:55:53 bjh21 Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#define Unsigned_Shifts
|
||||
|
@ -108,7 +108,7 @@ __RCSID("$NetBSD: strtod.c,v 1.33 1999/11/26 07:39:45 msaitoh Exp $");
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __arm32__
|
||||
#if defined(__arm32__) || defined(__arm26__)
|
||||
/*
|
||||
* Although the CPU is little endian the FP has different
|
||||
* byte and word endianness. The byte order is still little endian
|
||||
|
@ -245,7 +245,8 @@ typedef union {
|
|||
* An alternative that might be better on some machines is
|
||||
* #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff)
|
||||
*/
|
||||
#if defined(IEEE_LITTLE_ENDIAN) + defined(VAX) + defined(__arm32__)
|
||||
#if defined(IEEE_LITTLE_ENDIAN) + defined(VAX) + defined(__arm32__) + \
|
||||
defined(__arm26__)
|
||||
#define Storeinc(a,b,c) \
|
||||
(((u_short *)(void *)a)[1] = \
|
||||
(u_short)b, ((u_short *)(void *)a)[0] = (u_short)c, a++)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.30 1999/09/12 01:19:24 chs Exp $
|
||||
# $NetBSD: Makefile,v 1.31 2000/05/09 21:55:53 bjh21 Exp $
|
||||
# from: @(#)Makefile 8.1 (Berkeley) 6/4/93
|
||||
|
||||
LIB= kvm
|
||||
|
@ -13,6 +13,8 @@ SRCS= kvm.c kvm_file.c kvm_getloadavg.c kvm_proc.c
|
|||
|
||||
.if ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb"
|
||||
SRCS+= kvm_mips.c
|
||||
.elif ${MACHINE_ARCH} == "arm26"
|
||||
SRCS+= kvm_arm32.c
|
||||
.else
|
||||
SRCS+= kvm_${MACHINE_ARCH}.c
|
||||
.endif
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
/*
|
||||
* from: @(#)fdlibm.h 5.1 93/09/24
|
||||
* $NetBSD: math_private.h,v 1.8 1999/07/02 15:37:42 simonb Exp $
|
||||
* $NetBSD: math_private.h,v 1.9 2000/05/09 21:55:53 bjh21 Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MATH_PRIVATE_H_
|
||||
|
@ -34,11 +34,11 @@
|
|||
ints. */
|
||||
|
||||
/*
|
||||
* The arm32 port is little endian except for the FP word order which is
|
||||
* The ARM ports are little endian except for the FP word order which is
|
||||
* big endian.
|
||||
*/
|
||||
|
||||
#if (BYTE_ORDER == BIG_ENDIAN) || defined(__arm32__)
|
||||
#if (BYTE_ORDER == BIG_ENDIAN) || defined(__arm32__) || defined(__arm26__)
|
||||
|
||||
typedef union
|
||||
{
|
||||
|
@ -52,7 +52,7 @@ typedef union
|
|||
|
||||
#endif
|
||||
|
||||
#if (BYTE_ORDER == LITTLE_ENDIAN) && !defined(__arm32__)
|
||||
#if (BYTE_ORDER == LITTLE_ENDIAN) && !defined(__arm32__) && !defined(__arm26__)
|
||||
|
||||
typedef union
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: paths.c,v 1.10 2000/01/15 01:03:45 christos Exp $ */
|
||||
/* $NetBSD: paths.c,v 1.11 2000/05/09 21:55:53 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 1996 Matt Thomas <matt@3am-software.com>
|
||||
|
@ -148,7 +148,9 @@ struct list {
|
|||
int numentries;
|
||||
};
|
||||
|
||||
#ifdef CTL_MACHDEP_NAMES
|
||||
static struct sysctldesc ctl_machdep[] = CTL_MACHDEP_NAMES;
|
||||
#endif
|
||||
static struct sysctldesc ctl_toplvl[] = CTL_NAMES;
|
||||
|
||||
struct list toplevel[] = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.152 2000/05/08 16:40:42 joda Exp $
|
||||
# $NetBSD: Makefile,v 1.153 2000/05/09 21:55:54 bjh21 Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/18/93
|
||||
|
||||
MAN= adv.4 adw.4 ahb.4 ahc.4 aria.4 atalk.4 audio.4 auvia.4 awi.4 bba.4 \
|
||||
|
@ -72,7 +72,7 @@ MLINKS+=pcppi.4 sysbeep.4
|
|||
MLINKS+=pss.4 sp.4
|
||||
MLINKS+=viaenv.4 viapm.4
|
||||
|
||||
SUBDIR= man4.amiga man4.arm32 man4.atari man4.hp300 man4.i386 \
|
||||
SUBDIR= man4.amiga man4.arm26 man4.arm32 man4.atari man4.hp300 man4.i386 \
|
||||
man4.mac68k man4.mvme68k man4.pc532 man4.pmax man4.sparc \
|
||||
man4.sun3 man4.vax man4.x68k
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# from: @(#)Makefile 5.1 (Berkeley) 2/12/91
|
||||
# $NetBSD: Makefile,v 1.1 2000/05/09 21:55:54 bjh21 Exp $
|
||||
|
||||
MAN= arckbd.4 cpu.4 dtide.4 ei.4
|
||||
|
||||
MLINKS= arckbd.4 arcwskbd.4 arckbd.4 arcwsmouse.4
|
||||
MANSUBDIR=/arm26
|
||||
|
||||
.include <bsd.man.mk>
|
|
@ -0,0 +1,80 @@
|
|||
.\" $NetBSD: arckbd.4,v 1.1 2000/05/09 21:55:54 bjh21 Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2000 Ben Harris
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. The name of the author may not be used to endorse or promote products
|
||||
.\" derived from this software without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd April 1, 2000
|
||||
.Os "NetBSD experimental"
|
||||
.Dt ARCKBD 4 arm26
|
||||
.Sh NAME
|
||||
.Nm arckbd , arcwskbd , arcwsmouse
|
||||
.Nd Archimedes keyboard/mouse driver
|
||||
.Sh SYNOPSIS
|
||||
.Cd "arckbd0 at ioc0 bank 0 offset 0x04"
|
||||
.Cd "arcwskbd0 at arckbd0"
|
||||
.Cd "wskbd0 at arcwskbd0"
|
||||
.Cd "arcwsmouse0 at arckbd0"
|
||||
.Cd "wsmouse0 at arcwsmouse0"
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver controls the keyboard on systems supported by
|
||||
.Nx Ns /arm26
|
||||
and interfaces it to the
|
||||
.Nm wscons
|
||||
system. All communication between user programs and the
|
||||
.Nm
|
||||
driver goes through the
|
||||
.Nm wskbd
|
||||
and
|
||||
.Nm wsmouse
|
||||
drivers.
|
||||
|
||||
Because of the architecture of
|
||||
.Nm wscons ,
|
||||
it's impossible to have a device at which both
|
||||
.Nm wskbd
|
||||
and
|
||||
.Nm wsmouse
|
||||
devices attach. The
|
||||
.Nm
|
||||
driver works around this by having dummy
|
||||
.Nm arcwskbd
|
||||
and
|
||||
.Nm arcwsmouse
|
||||
drivers which interpose between itself and the
|
||||
.Nm wscons
|
||||
drivers.
|
||||
.Sh SEE ALSO
|
||||
.Xr wscons 4 ,
|
||||
.Xr wskbd 4 ,
|
||||
.Xr wsmouse 4
|
||||
.Sh BUGS
|
||||
The
|
||||
.Nm
|
||||
driver is capable of determining the layout of the keyboard, and noticing when
|
||||
it changes (if a different keyboard is connected, for instance), but doesn't
|
||||
know how to pass this information on to
|
||||
.Nm wscons .
|
|
@ -0,0 +1,36 @@
|
|||
.\" $NetBSD: cpu.4,v 1.1 2000/05/09 21:55:54 bjh21 Exp $
|
||||
.\"
|
||||
.\" Copyright notice...
|
||||
.\"
|
||||
.Dd March 29, 2000
|
||||
.Os "NetBSD experimental"
|
||||
.Dt CPU 4 arm26
|
||||
.Sh NAME
|
||||
.Nm cpu
|
||||
.Nd Device driver for CPU-specific features
|
||||
.Sh SYNOPSIS
|
||||
.Cd cpu0 at root
|
||||
.Cd options CPU_ARM2
|
||||
.Cd options CPU_ARM250
|
||||
.Cd options CPU_ARM3
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver provides a convenient hook for identifying the system's CPU and setting
|
||||
various parameters relating to it.
|
||||
|
||||
The following options are available relating to the
|
||||
.Nm
|
||||
driver:
|
||||
.Bl -ohang
|
||||
.It Cd options CPU_ARM2
|
||||
Enables support for ARM2 CPUs. This includes inserting NOPs after
|
||||
processor mode changes.
|
||||
.It Cd options CPU_ARM250
|
||||
Enables support for ARM2as CPUs (as found in the ARM250).
|
||||
.It Cd options CPU_ARM3
|
||||
Enables support for ARM3 CPUs. This currently does nothing.
|
||||
.El
|
||||
.Sh BUGS
|
||||
The cache on ARM3s isn't currently enabled.
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
.\" $NetBSD: dtide.4,v 1.1 2000/05/09 21:55:54 bjh21 Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2000 Ben Harris
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. The name of the author may not be used to endorse or promote products
|
||||
.\" derived from this software without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd April 2, 2000
|
||||
.Os "NetBSD experimental"
|
||||
.Dt DTIDE 4 arm26
|
||||
.Sh NAME
|
||||
.Nm dtide
|
||||
.Nd D.T. Software IDE interface driver
|
||||
.Sh SYNOPSIS
|
||||
.Cd dtide* at podulebus0 slot ?
|
||||
.Cd wd* at dtide? channel ? drive ?
|
||||
.Cd atapibus* at dtide? channel ?
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver handles a D.T. Software IDE interface plugged into an Acorn expansion
|
||||
slot. It uses the standard
|
||||
.Nx
|
||||
IDE controller driver, and hence can use the standard
|
||||
.Nm wd
|
||||
and
|
||||
.Nm atapibus
|
||||
drivers.
|
||||
|
||||
The card provides two IDE channels. The external IDE connector is channel 0,
|
||||
while the internal connector is channel 1.
|
||||
.Sh SEE ALSO
|
||||
.Xr atapibus 4 ,
|
||||
.Xr podulebus 4 ,
|
||||
.Xr wd 4.
|
||||
.Sh BUGS
|
||||
The
|
||||
.Nm atapibus
|
||||
attachment has not been tested.
|
||||
|
||||
Interrupts are currently buggered.
|
||||
|
||||
The driver was derived by reverse-engineering the card and its
|
||||
.Tn RISC OS
|
||||
driver, so it may not handle the card entirely optimally.
|
||||
|
||||
Detection of missing devices is slow. Empty channels take a minute to scan.
|
|
@ -0,0 +1,57 @@
|
|||
.\" $NetBSD: ei.4,v 1.1 2000/05/09 21:55:54 bjh21 Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2000 Ben Harris
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. The name of the author may not be used to endorse or promote products
|
||||
.\" derived from this software without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd April 8, 2000
|
||||
.Os "NetBSD experimental"
|
||||
.Dt EI 4 arm26
|
||||
.Sh NAME
|
||||
.Nm ei
|
||||
.Nd Acorn
|
||||
.Tn AKA25
|
||||
(Ether1) Ethernet driver
|
||||
.Sh SYNOPSIS
|
||||
.Cd ei* at podulebus0 slot ?
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver provides access to a 10 Mb/s Ethernet network through an
|
||||
Acorn
|
||||
.Tn AKA25
|
||||
Ethernet card (also known as
|
||||
.Dq Ether1
|
||||
after its
|
||||
.Tn RISC OS
|
||||
driver). The card is based on the Intel 82586.
|
||||
|
||||
Media selection on the
|
||||
.Tn AKA25
|
||||
is through links on the board (LK3--LK8 and LK10), so there are no media
|
||||
options available through the driver.
|
||||
.Sh SEE ALSO
|
||||
.Xr ifconfig 8 ,
|
||||
.Xr netintro 4 ,
|
||||
.Xr podulebus 4
|
|
@ -0,0 +1,74 @@
|
|||
.\" $NetBSD: podulebus.4,v 1.1 2000/05/09 21:55:54 bjh21 Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2000 Ben Harris
|
||||
.\" All rights reserved.
|
||||
.\"
|
||||
.\" Redistribution and use in source and binary forms, with or without
|
||||
.\" modification, are permitted provided that the following conditions
|
||||
.\" are met:
|
||||
.\" 1. Redistributions of source code must retain the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer.
|
||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||
.\" notice, this list of conditions and the following disclaimer in the
|
||||
.\" documentation and/or other materials provided with the distribution.
|
||||
.\" 3. The name of the author may not be used to endorse or promote products
|
||||
.\" derived from this software without specific prior written permission.
|
||||
.\"
|
||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd April 1, 2000
|
||||
.Os "NetBSD experimental"
|
||||
.Dt PODULEBUS 4 arm26
|
||||
.Sh NAME
|
||||
.Nm podulebus
|
||||
.Nd Acorn Expansion Card bus driver
|
||||
.Sh SYNOPSIS
|
||||
.Cd podulebus0 at ioc0 bank 4
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
driver handles the expansion-card interface in Archimedes machines and their
|
||||
successors. This includes conventional expansion cards, mini expansion cards
|
||||
(as introduced in the A3000) and network expansion cards (as introduced in
|
||||
the A3020). Drivers for individual cards attach as children of the
|
||||
.Nm
|
||||
device.
|
||||
.Sh SUPPORTED DEVICES
|
||||
Expansion cards are identified by a manufacturer and product identifier.
|
||||
These are listed against each card in the table in the form
|
||||
.Sm off
|
||||
.No < Ar manu : prod No > .
|
||||
.Sm on
|
||||
.Bl -tag -width Nm
|
||||
.It Nm et
|
||||
Acorn
|
||||
.Tn AKA25
|
||||
Ethernet card (Ether1)
|
||||
.Sm off
|
||||
.No < Li 0000 : 0003 No >
|
||||
.Sm on
|
||||
.It Nm dtide
|
||||
D.T. Software IDE interface
|
||||
.Sm off
|
||||
.No < Li 0037 : 0055 No >
|
||||
.Sm on
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr dtide 4 ,
|
||||
.Xr et 4 .
|
||||
.Sh BUGS
|
||||
The
|
||||
.Nx Ns /arm26
|
||||
.Nm
|
||||
driver is not compatible with the
|
||||
.Nx Ns /arm32
|
||||
one.
|
|
@ -0,0 +1,33 @@
|
|||
# $NetBSD: Makefile,v 1.1 2000/05/09 21:55:54 bjh21 Exp $
|
||||
|
||||
# Makefile for arm26 tags file and boot blocks
|
||||
|
||||
TARM26= ../arm26/tags
|
||||
SARM26= ../arm26/arm26/*.[ch] ../arm26/include/*.h \
|
||||
../arm26/iobus/*.[ch] ../arm26/ioc/*.[ch] ../arm32/mainbus/*.[ch] \
|
||||
../arm26/vidc/*.[ch]
|
||||
AARM26= ../arm26/arm26/*.S ../arm26/iobus/*.S
|
||||
|
||||
# Directories in which to place tags links
|
||||
DARM26= arm26 include iobus ioc mainbus vidc
|
||||
|
||||
.include "../../kern/Make.tags.inc"
|
||||
|
||||
tags: TAGS
|
||||
-ctags -wdtf ${TARM26} ${SARM26} ${COMM}
|
||||
egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AARM26} | \
|
||||
sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \
|
||||
>> ${TARM26}
|
||||
sort -o ${TARM26} ${TARM26}
|
||||
|
||||
TAGS:
|
||||
etags ${SARM26} ${COMM} ${AARM26}
|
||||
|
||||
links:
|
||||
-for i in ${DARM26}; do \
|
||||
cd $$i && rm -f tags; ln -s ../tags tags; done
|
||||
|
||||
|
||||
SUBDIR= include
|
||||
|
||||
.include <bsd.subdir.mk>
|
|
@ -0,0 +1,151 @@
|
|||
/* $NetBSD: Locore.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Ben Harris.
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
* Copyright (C) 1995, 1996 TooLs GmbH.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by TooLs GmbH.
|
||||
* 4. The name of TooLs GmbH may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Some additional routines that happened to be in locore.S traditionally,
|
||||
* but have no need to be coded in assembly.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
__RCSID("$NetBSD: Locore.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $");
|
||||
|
||||
#include <sys/proc.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/user.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
|
||||
#include <machine/machdep.h>
|
||||
|
||||
static void idle(void);
|
||||
|
||||
volatile int whichqs;
|
||||
|
||||
/*
|
||||
* Put process p on the run queue indicated by its priority.
|
||||
* Calls should be made at splstatclock(), and p->p_stat should be SRUN.
|
||||
*/
|
||||
void
|
||||
setrunqueue(struct proc *p)
|
||||
{
|
||||
struct prochd *q;
|
||||
struct proc *oldlast;
|
||||
int which = p->p_priority >> 2;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (p->p_back)
|
||||
panic("setrunqueue");
|
||||
#endif
|
||||
q = &qs[which];
|
||||
whichqs |= 1 << which;
|
||||
p->p_forw = (struct proc *)q;
|
||||
p->p_back = oldlast = q->ph_rlink;
|
||||
q->ph_rlink = p;
|
||||
oldlast->p_forw = p;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove process p from its run queue, which should be the one
|
||||
* indicated by its priority.
|
||||
* Calls should be made at splstatclock().
|
||||
*/
|
||||
void
|
||||
remrunqueue(struct proc *p)
|
||||
{
|
||||
int which = p->p_priority >> 2;
|
||||
struct prochd *q;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (!(whichqs & (1 << which)))
|
||||
panic("remrunqueue");
|
||||
#endif
|
||||
p->p_forw->p_back = p->p_back;
|
||||
p->p_back->p_forw = p->p_forw;
|
||||
p->p_back = NULL;
|
||||
q = &qs[which];
|
||||
if (q->ph_link == (struct proc *)q)
|
||||
whichqs &= ~(1 << which);
|
||||
}
|
||||
|
||||
/*
|
||||
* Idle
|
||||
*/
|
||||
static void
|
||||
idle()
|
||||
{
|
||||
|
||||
spl0();
|
||||
while (whichqs == 0)
|
||||
continue;
|
||||
splhigh();
|
||||
}
|
||||
|
||||
extern int want_resched; /* XXX should be in <machine/cpu.h> */
|
||||
|
||||
/*
|
||||
* Find the highest-priority runnable process and switch to it.
|
||||
*/
|
||||
void
|
||||
cpu_switch(struct proc *p1)
|
||||
{
|
||||
int which;
|
||||
int s;
|
||||
struct prochd *q;
|
||||
struct proc *p2;
|
||||
|
||||
#if 0
|
||||
printf("cpu_switch: %p ->", p1);
|
||||
#endif
|
||||
curproc = NULL;
|
||||
s = splhigh();
|
||||
while (whichqs == 0)
|
||||
idle();
|
||||
which = ffs(whichqs) - 1;
|
||||
q = &qs[which];
|
||||
p2 = q->ph_link;
|
||||
remrunqueue(p2);
|
||||
want_resched = 0;
|
||||
curproc = p2;
|
||||
#if 0
|
||||
printf(" %p\n", p2);
|
||||
#endif
|
||||
if (p2 == p1)
|
||||
return;
|
||||
pmap_deactivate(p1);
|
||||
pmap_activate(p2);
|
||||
cpu_loswitch(&p1->p_addr->u_pcb.pcb_sf, p2->p_addr->u_pcb.pcb_sf);
|
||||
/* We only get back here after the other process has run. */
|
||||
splx(s);
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
/* $NetBSD: aout_machdep.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2000 Ben Harris
|
||||
* Copyright (c) 1993, 1994 Christopher G. Demetriou
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Christopher G. Demetriou.
|
||||
* 4. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* This file is part of NetBSD/arm26 -- a port of NetBSD to ARM2/3 machines. */
|
||||
/*
|
||||
* aout_machdep.c - odd a.out executable formats
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
__RCSID("$NetBSD: aout_machdep.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $");
|
||||
|
||||
#include <sys/exec.h>
|
||||
#include <sys/exec_aout.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <machine/aout_machdep.h>
|
||||
#include <vm/vm.h>
|
||||
|
||||
int cpu_exec_aout_prep_ozmagic(struct proc *, struct exec_package *);
|
||||
|
||||
int
|
||||
cpu_exec_aout_makecmds(struct proc *p, struct exec_package *epp)
|
||||
{
|
||||
struct exec *execp = epp->ep_hdr;
|
||||
|
||||
if (execp->a_midmag == ZMAGIC)
|
||||
/* GNU binutils arm-acorn-aout format */
|
||||
return cpu_exec_aout_prep_ozmagic(p, epp);
|
||||
return ENOEXEC;
|
||||
}
|
||||
|
||||
|
||||
int cpu_exec_aout_prep_ozmagic(struct proc *p, struct exec_package *epp)
|
||||
{
|
||||
struct exec *execp = epp->ep_hdr;
|
||||
|
||||
epp->ep_taddr = USRTEXT;
|
||||
epp->ep_tsize = execp->a_text;
|
||||
epp->ep_daddr = epp->ep_taddr + execp->a_text;
|
||||
epp->ep_dsize = execp->a_data + execp->a_bss;
|
||||
epp->ep_entry = execp->a_entry;
|
||||
|
||||
/*
|
||||
* check if vnode is in open for writing, because we want to
|
||||
* demand-page out of it. if it is, don't do it, for various
|
||||
* reasons
|
||||
*/
|
||||
if ((execp->a_text != 0 || execp->a_data != 0) &&
|
||||
epp->ep_vp->v_writecount != 0) {
|
||||
#ifdef DIAGNOSTIC
|
||||
if (epp->ep_vp->v_flag & VTEXT)
|
||||
panic("exec: a VTEXT vnode has writecount != 0\n");
|
||||
#endif
|
||||
return ETXTBSY;
|
||||
}
|
||||
epp->ep_vp->v_flag |= VTEXT;
|
||||
|
||||
/* set up command for text segment */
|
||||
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, execp->a_text,
|
||||
epp->ep_taddr, epp->ep_vp, __LDPGSZ, VM_PROT_READ|VM_PROT_EXECUTE);
|
||||
|
||||
/* set up command for data segment */
|
||||
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_pagedvn, execp->a_data,
|
||||
epp->ep_daddr, epp->ep_vp, __LDPGSZ + execp->a_text,
|
||||
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
|
||||
|
||||
/* set up command for bss segment */
|
||||
NEW_VMCMD(&epp->ep_vmcmds, vmcmd_map_zero, execp->a_bss,
|
||||
epp->ep_daddr + execp->a_data, NULLVP, 0,
|
||||
VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE);
|
||||
|
||||
return exec_aout_setup_stack(p, epp);
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
/* $NetBSD: autoconf.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1998, 1999 Ben Harris
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* This file is part of NetBSD/arm26 -- a port of NetBSD to ARM2/3 machines. */
|
||||
/*
|
||||
* autoconf.c - top level device-finding code
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
__RCSID("$NetBSD: autoconf.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $");
|
||||
|
||||
#include <sys/conf.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <machine/irq.h>
|
||||
#include <machine/machdep.h>
|
||||
|
||||
void
|
||||
cpu_configure()
|
||||
{
|
||||
|
||||
irq_init();
|
||||
config_rootfound("cpu", NULL);
|
||||
config_rootfound("iobus", NULL);
|
||||
config_rootfound("arcvideo", NULL);
|
||||
spl0();
|
||||
}
|
||||
|
||||
void
|
||||
cpu_rootconf()
|
||||
{
|
||||
|
||||
/* XXX This could actually do something */
|
||||
setroot(NULL, 0);
|
||||
}
|
||||
|
||||
void
|
||||
cpu_dumpconf()
|
||||
{
|
||||
|
||||
printf("cpu_dumpconf: Doing something here would be useful\n");
|
||||
}
|
|
@ -0,0 +1,220 @@
|
|||
/* $NetBSD: bus.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1999, 2000 Ben Harris
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* This file is part of NetBSD/arm26 -- a port of NetBSD to ARM2/3 machines. */
|
||||
/*
|
||||
* bus.c - bus space functions for Archimedes I/O bus
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
__RCSID("$NetBSD: bus.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $");
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/memcreg.h>
|
||||
|
||||
int
|
||||
bus_space_map(bus_space_tag_t bst, bus_addr_t addr, bus_size_t size,
|
||||
int flags, bus_space_handle_t *bshp)
|
||||
{
|
||||
|
||||
if (flags & BUS_SPACE_MAP_LINEAR)
|
||||
return -1;
|
||||
*bshp = (bus_space_handle_t)(MEMC_IO_BASE + addr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bus_space_subregion(bus_space_tag_t bst, bus_space_handle_t bsh,
|
||||
bus_size_t offset, bus_size_t size,
|
||||
bus_space_handle_t *nbshp)
|
||||
{
|
||||
|
||||
*nbshp = bsh + (offset << bst);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bus_space_shift(bus_space_tag_t bst, bus_space_handle_t bsh, int shift,
|
||||
bus_space_tag_t *nbstp, bus_space_handle_t *nbshp)
|
||||
{
|
||||
|
||||
*nbstp = shift;
|
||||
*nbshp = bsh;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_read_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh,
|
||||
bus_size_t offset, u_int8_t *datap, bus_size_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
datap[i] = bus_space_read_1(bst, bsh, offset);
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_read_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh,
|
||||
bus_size_t offset, u_int16_t *datap, bus_size_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
datap[i] = bus_space_read_2(bst, bsh, offset);
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_write_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh,
|
||||
bus_size_t offset, u_int8_t const *datap,
|
||||
bus_size_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
bus_space_write_1(bst, bsh, offset, datap[i]);
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_write_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh,
|
||||
bus_size_t offset, u_int16_t const *datap,
|
||||
bus_size_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
bus_space_write_2(bst, bsh, offset, datap[i]);
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_set_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh,
|
||||
bus_size_t offset, u_int8_t value, bus_size_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
bus_space_write_1(bst, bsh, offset, value);
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_set_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh,
|
||||
bus_size_t offset, u_int16_t value, bus_size_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
bus_space_write_2(bst, bsh, offset, value);
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_read_region_1(bus_space_tag_t bst, bus_space_handle_t bsh,
|
||||
bus_size_t offset, u_int8_t *datap, bus_size_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
datap[i] = bus_space_read_1(bst, bsh, offset + i);
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_read_region_2(bus_space_tag_t bst, bus_space_handle_t bsh,
|
||||
bus_size_t offset, u_int16_t *datap, bus_size_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
datap[i] = bus_space_read_2(bst, bsh, offset + i);
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_write_region_1(bus_space_tag_t bst, bus_space_handle_t bsh,
|
||||
bus_size_t offset, u_int8_t const *datap,
|
||||
bus_size_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
bus_space_write_1(bst, bsh, offset + i, datap[i]);
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_write_region_2(bus_space_tag_t bst, bus_space_handle_t bsh,
|
||||
bus_size_t offset, u_int16_t const *datap,
|
||||
bus_size_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
bus_space_write_2(bst, bsh, offset + i, datap[i]);
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_set_region_1(bus_space_tag_t bst, bus_space_handle_t bsh,
|
||||
bus_size_t offset, u_int8_t value, bus_size_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
bus_space_write_1(bst, bsh, offset + i, value);
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_set_region_2(bus_space_tag_t bst, bus_space_handle_t bsh,
|
||||
bus_size_t offset, u_int16_t value, bus_size_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
bus_space_write_2(bst, bsh, offset + i, value);
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_copy_1(bus_space_tag_t bst,
|
||||
bus_space_handle_t bsh1, bus_size_t offset1,
|
||||
bus_space_handle_t bsh2, bus_size_t offset2, bus_size_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
bus_space_write_1(bst, bsh2, offset2 + 1,
|
||||
bus_space_read_1(bst, bsh1, offset1 + i));
|
||||
}
|
||||
|
||||
void
|
||||
bus_space_copy_2(bus_space_tag_t bst,
|
||||
bus_space_handle_t bsh1, bus_size_t offset1,
|
||||
bus_space_handle_t bsh2, bus_size_t offset2, bus_size_t count)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
bus_space_write_2(bst, bsh2, offset2 + 1,
|
||||
bus_space_read_1(bst, bsh1, offset1 + i));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,193 @@
|
|||
/* $NetBSD: conf.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1998, 2000 Ben Harris
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* This file is part of NetBSD/arm26 -- a port of NetBSD to ARM2/3 machines. */
|
||||
/*
|
||||
* conf.c -- Device switch tables and related gumf.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <dev/cons.h>
|
||||
|
||||
#define mmread mmrw
|
||||
#define mmwrite mmrw
|
||||
cdev_decl(mm);
|
||||
bdev_decl(sw);
|
||||
cdev_decl(sw);
|
||||
#include "pty.h"
|
||||
#include "md.h"
|
||||
#include "vnd.h"
|
||||
#include "ccd.h"
|
||||
#include "wd.h"
|
||||
bdev_decl(wd);
|
||||
cdev_decl(wd);
|
||||
#include "sd.h"
|
||||
#include "cd.h"
|
||||
#include "bpfilter.h"
|
||||
#include "tun.h"
|
||||
#include "ipfilter.h"
|
||||
#include "rnd.h"
|
||||
#include "rs.h"
|
||||
#include "wsdisplay.h"
|
||||
cdev_decl(wsdisplay);
|
||||
#include "wskbd.h"
|
||||
cdev_decl(wskbd);
|
||||
#include "wsmouse.h"
|
||||
cdev_decl(wsmouse);
|
||||
#include "wsmux.h"
|
||||
cdev_decl(wsmux);
|
||||
|
||||
cons_decl(rs);
|
||||
|
||||
struct bdevsw bdevsw[] = {
|
||||
bdev_swap_init(1, sw), /* 0: swap pseudo-device */
|
||||
bdev_disk_init(NMD, md), /* 1: memory "disk" */
|
||||
bdev_disk_init(NVND, vnd), /* 2: vnode "disk" */
|
||||
bdev_disk_init(NCCD, ccd), /* 3: concatenated disks */
|
||||
bdev_disk_init(NWD, wd), /* 4: IDE disks */
|
||||
bdev_disk_init(NSD, sd), /* 5: SCSI disks */
|
||||
bdev_disk_init(NCD, cd), /* 6: SCSI CD-ROMs */
|
||||
};
|
||||
|
||||
int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
|
||||
|
||||
struct cdevsw cdevsw[] = {
|
||||
/* First seven are standard across most ports */
|
||||
cdev_cn_init(1, cn), /* 0: /dev/console */
|
||||
cdev_ctty_init(1, ctty), /* 1: /dev/tty */
|
||||
cdev_mm_init(1, mm), /* 2: /dev/{null,mem,kmem,zero} */
|
||||
cdev_swap_init(1, sw), /* 3: /dev/drum */
|
||||
cdev_tty_init(NPTY, pts), /* 4: pseudo-tty slave */
|
||||
cdev_ptc_init(NPTY, ptc), /* 5: pseudo-tty master */
|
||||
cdev_log_init(1, log), /* 6: /dev/klog */
|
||||
cdev_fd_init(1, filedesc), /* 7: file descriptors */
|
||||
|
||||
cdev_disk_init(NMD, md), /* 8: memory "disk" */
|
||||
cdev_disk_init(NVND, vnd), /* 9: vnode "disk" */
|
||||
cdev_disk_init(NCCD, ccd), /* 10: concatenated disks */
|
||||
cdev_mouse_init(NWSKBD, wskbd), /* 11: keyboards */
|
||||
cdev_mouse_init(NWSMOUSE, wsmouse),
|
||||
/* 12: mice */
|
||||
cdev_mouse_init(NWSMUX, wsmux), /* 13: keyboard/mouse multiplexor */
|
||||
cdev_wsdisplay_init(NWSDISPLAY, wsdisplay),
|
||||
/* 14: console display */
|
||||
cdev_disk_init(NWD, wd), /* 15: IDE disks */
|
||||
cdev_disk_init(NSD, sd), /* 16: SCSI disks */
|
||||
cdev_disk_init(NCD, cd), /* 17: SCSI CD-ROMs */
|
||||
};
|
||||
|
||||
int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
|
||||
|
||||
|
||||
int mem_no = 2; /* major device number of memory special file */
|
||||
|
||||
/*
|
||||
* Swapdev is a fake device implemented
|
||||
* in sw.c used only internally to get to swstrategy.
|
||||
* It cannot be provided to the users, because the
|
||||
* swstrategy routine munches the b_dev and b_blkno entries
|
||||
* before calling the appropriate driver. This would horribly
|
||||
* confuse, e.g. the hashing routines. Instead, /dev/drum is
|
||||
* provided as a character (raw) device.
|
||||
*/
|
||||
dev_t swapdev = makedev(1, 0);
|
||||
|
||||
/*
|
||||
* Returns true if dev is /dev/mem or /dev/kmem.
|
||||
*/
|
||||
int
|
||||
iskmemdev(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
return (major(dev) == mem_no && minor(dev) < 2);
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns true if dev is /dev/zero.
|
||||
*/
|
||||
int
|
||||
iszerodev(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
return (major(dev) == mem_no && minor(dev) == 3);
|
||||
}
|
||||
|
||||
|
||||
static int chrtoblktbl[] = {
|
||||
/* XXXX This needs to be dynamic for LKMs. */
|
||||
/*VCHR*/ /*VBLK*/
|
||||
/* 0 */ NODEV,
|
||||
/* 1 */ NODEV,
|
||||
/* 2 */ NODEV,
|
||||
/* 3 */ NODEV,
|
||||
/* 4 */ NODEV,
|
||||
/* 5 */ NODEV,
|
||||
/* 6 */ NODEV,
|
||||
/* 7 */ NODEV,
|
||||
/* 8 */ 1, /* md */
|
||||
/* 9 */ 2, /* vnd */
|
||||
/* 10 */ 3, /* ccd */
|
||||
/* 11 */ NODEV,
|
||||
/* 12 */ NODEV,
|
||||
/* 13 */ NODEV,
|
||||
/* 14 */ NODEV,
|
||||
/* 15 */ 4, /* wd */
|
||||
/* 16 */ 5, /* sd */
|
||||
/* 17 */ 6, /* cd */
|
||||
};
|
||||
|
||||
/*
|
||||
* Convert a character device number to a block device number.
|
||||
*/
|
||||
|
||||
dev_t
|
||||
chrtoblk(dev)
|
||||
dev_t dev;
|
||||
{
|
||||
int blkmaj;
|
||||
|
||||
if (major(dev) >= nchrdev)
|
||||
return (NODEV);
|
||||
|
||||
blkmaj = chrtoblktbl[major(dev)];
|
||||
if (blkmaj == NODEV)
|
||||
return (NODEV);
|
||||
return (makedev(blkmaj, minor(dev)));
|
||||
}
|
||||
|
||||
struct consdev constab[] = {
|
||||
#if NRS > 0
|
||||
cons_init(rs),
|
||||
#endif
|
||||
{ 0 }
|
||||
};
|
|
@ -0,0 +1,71 @@
|
|||
/* $NetBSD: cons_machdep.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1998 Ben Harris
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* This file is part of NetBSD/arm26 -- a port of NetBSD to ARM2/3 machines. */
|
||||
/*
|
||||
* cons_machdep.c -- machine dependent console routines
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
__RCSID("$NetBSD: cons_machdep.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $");
|
||||
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
#include "arcvideo.h"
|
||||
#include "opt_ddb.h"
|
||||
|
||||
#ifdef DDB
|
||||
#include <machine/db_machdep.h>
|
||||
#include <ddb/db_extern.h>
|
||||
#include <ddb/db_interface.h>
|
||||
|
||||
#include <machine/boot.h>
|
||||
#include <machine/memcreg.h>
|
||||
#endif
|
||||
|
||||
extern void arccons_init __P((void));
|
||||
|
||||
void
|
||||
consinit()
|
||||
{
|
||||
|
||||
#if NARCVIDEO > 0
|
||||
arccons_init();
|
||||
#endif
|
||||
/* cninit();*/
|
||||
|
||||
#ifdef DDB
|
||||
db_machine_init();
|
||||
ddb_init(bootconfig.esym - bootconfig.ssym,
|
||||
MEMC_PHYS_BASE + bootconfig.ssym,
|
||||
MEMC_PHYS_BASE + bootconfig.esym);
|
||||
#endif /* DDB */
|
||||
}
|
|
@ -0,0 +1,177 @@
|
|||
/* $NetBSD: copyinout.S,v 1.1 2000/05/09 21:55:55 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Ben Harris
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* This file is part of NetBSD/arm26 -- a port of NetBSD to ARM2/3 machines. */
|
||||
/*
|
||||
* copyinout.S - copy data between user and kernel space
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
RCSID("$NetBSD: copyinout.S,v 1.1 2000/05/09 21:55:55 bjh21 Exp $")
|
||||
|
||||
#include <sys/errno.h>
|
||||
#include "assym.h"
|
||||
|
||||
/*
|
||||
* Note that most of these need special handling on data aborts. I
|
||||
* haven't coded that bit yet.
|
||||
*/
|
||||
|
||||
/*
|
||||
* int copyin(const void *ua, void *ka, size_t len);
|
||||
* int copyout(const void *ka, void *ua, size_t len);
|
||||
* int kcopy(const void *src, void *dst, size_t len);
|
||||
*/
|
||||
|
||||
/*
|
||||
* memcpy isn't currently data-abort-safe (it uses R14). This is much
|
||||
* slower, but safer.
|
||||
*/
|
||||
|
||||
ENTRY(copyin)
|
||||
mov ip, sp
|
||||
stmfd sp!, {r4, fp, ip, lr, pc}
|
||||
sub fp, ip, #4
|
||||
adr r3, Lcopyfault
|
||||
ldr r4, Lcurproc
|
||||
ldr r4, [r4]
|
||||
ldr r4, [r4, #P_ADDR]
|
||||
str r3, [r4, #(U_PCB + PCB_ONFAULT)]
|
||||
Lcopyinloop:
|
||||
ldrbt r3, [r0], #1
|
||||
strb r3, [r1], #1
|
||||
subs r2, r2, #1
|
||||
bne Lcopyinloop
|
||||
mov r0, #0
|
||||
str r0, [r4, #(U_PCB + PCB_ONFAULT)]
|
||||
ldmdb fp, {r4, fp, sp, pc}^
|
||||
|
||||
ENTRY(copyout)
|
||||
mov ip, sp
|
||||
stmfd sp!, {r4, fp, ip, lr, pc}
|
||||
sub fp, ip, #4
|
||||
adr r3, Lcopyfault
|
||||
ldr r4, Lcurproc
|
||||
ldr r4, [r4]
|
||||
ldr r4, [r4, #P_ADDR]
|
||||
str r3, [r4, #(U_PCB + PCB_ONFAULT)]
|
||||
Lcopyoutloop:
|
||||
ldrb r3, [r0], #1
|
||||
strbt r3, [r1], #1
|
||||
subs r2, r2, #1
|
||||
bne Lcopyoutloop
|
||||
mov r0, #0
|
||||
str r0, [r4, #(U_PCB + PCB_ONFAULT)]
|
||||
ldmdb fp, {r4, fp, sp, pc}^
|
||||
|
||||
ENTRY(kcopy)
|
||||
mov ip, sp
|
||||
stmfd sp!, {r4, fp, ip, lr, pc}
|
||||
sub fp, ip, #4
|
||||
adr r3, Lcopyfault
|
||||
ldr r4, Lcurproc
|
||||
ldr r4, [r4]
|
||||
ldr r4, [r4, #P_ADDR]
|
||||
str r3, [r4, #(U_PCB + PCB_ONFAULT)]
|
||||
Lkcopyloop:
|
||||
ldrb r3, [r0], #1
|
||||
strb r3, [r1], #1
|
||||
subs r2, r2, #1
|
||||
bne Lkcopyloop
|
||||
mov r0, #0
|
||||
str r0, [r4, #(U_PCB + PCB_ONFAULT)]
|
||||
ldmdb fp, {r4, fp, sp, pc}^
|
||||
|
||||
Lcopyfault:
|
||||
mov r0, #0
|
||||
str r0, [r4, #(U_PCB + PCB_ONFAULT)]
|
||||
mov r0, #EFAULT
|
||||
ldmdb fp, {r4, fp, sp, pc}^
|
||||
|
||||
/* int fubyte(void *base); */
|
||||
ENTRY(fubyte)
|
||||
mov ip, lr /* data-abort safety */
|
||||
adr r1, Lfusufault
|
||||
ldr r2, Lcurproc
|
||||
ldr r2, [r2]
|
||||
ldr r2, [r2, #P_ADDR]
|
||||
str r1, [r2, #(U_PCB + PCB_ONFAULT)]
|
||||
ldrbt r0, [r0]
|
||||
mov r1, #0
|
||||
str r1, [r2, #(U_PCB + PCB_ONFAULT)]
|
||||
movs pc, ip
|
||||
|
||||
/* int fuword(void *base); */
|
||||
ENTRY(fuword)
|
||||
mov ip, lr
|
||||
adr r1, Lfusufault
|
||||
ldr r2, Lcurproc
|
||||
ldr r2, [r2]
|
||||
ldr r2, [r2, #P_ADDR]
|
||||
str r1, [r2, #(U_PCB + PCB_ONFAULT)]
|
||||
ldrt r0, [r0]
|
||||
mov r1, #0
|
||||
str r1, [r2, #(U_PCB + PCB_ONFAULT)]
|
||||
movs pc, lr
|
||||
|
||||
/* int subyte(void *base, int c); */
|
||||
ENTRY(subyte)
|
||||
mov ip, lr
|
||||
adr r3, Lfusufault
|
||||
ldr r2, Lcurproc
|
||||
ldr r2, [r2]
|
||||
ldr r2, [r2, #P_ADDR]
|
||||
str r3, [r2, #(U_PCB + PCB_ONFAULT)]
|
||||
strbt r1, [r0]
|
||||
mov r0, #0
|
||||
str r0, [r2, #(U_PCB + PCB_ONFAULT)]
|
||||
movs pc, ip
|
||||
|
||||
/* int suword(void *base, long c); */
|
||||
ENTRY(suword)
|
||||
mov ip, lr
|
||||
adr r3, Lfusufault
|
||||
ldr r2, Lcurproc
|
||||
ldr r2, [r2]
|
||||
ldr r2, [r2, #P_ADDR]
|
||||
str r3, [r2, #(U_PCB + PCB_ONFAULT)]
|
||||
strt r1, [r0]
|
||||
mov r0, #0
|
||||
str r0, [r2, #(U_PCB + PCB_ONFAULT)]
|
||||
movs pc, ip
|
||||
|
||||
Lfusufault:
|
||||
mov r0, #0
|
||||
str r0, [r2, #(U_PCB + PCB_ONFAULT)]
|
||||
mvn r0, #0
|
||||
movs pc, ip
|
||||
|
||||
Lcurproc:
|
||||
.word _C_LABEL(curproc)
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
/* $NetBSD: copyinoutstr.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Ben Harris
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* This file is part of NetBSD/arm26 -- a port of NetBSD to ARM2/3 machines. */
|
||||
/*
|
||||
* copyinoutstr.c -- copy strings with sanity checking
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
__RCSID("$NetBSD: copyinoutstr.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $");
|
||||
|
||||
#include <sys/proc.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/user.h>
|
||||
#include <machine/pcb.h>
|
||||
#include <vm/vm_param.h>
|
||||
|
||||
/*
|
||||
* FIXME: These are bogus. They should use LDRT and friends for user
|
||||
* accesses.
|
||||
*/
|
||||
|
||||
int copyinstr(const void *uaddr, void *kaddr, size_t len, size_t *done)
|
||||
{
|
||||
int err;
|
||||
|
||||
/* Check if this is an easy case */
|
||||
if (uaddr < (void *)VM_MIN_ADDRESS ||
|
||||
uaddr >= (void *)VM_MAXUSER_ADDRESS)
|
||||
return EFAULT;
|
||||
if (uaddr + len < (void *)VM_MAXUSER_ADDRESS)
|
||||
return copystr(uaddr, kaddr, len, done);
|
||||
err = copystr(uaddr, kaddr, (void *)VM_MAXUSER_ADDRESS - uaddr, done);
|
||||
if (err == ENAMETOOLONG)
|
||||
return EFAULT;
|
||||
return err;
|
||||
}
|
||||
|
||||
int copyoutstr(const void *kaddr, void *uaddr, size_t len, size_t *done)
|
||||
{
|
||||
int err;
|
||||
|
||||
/* Check if this is an easy case */
|
||||
if (uaddr < (void *)VM_MIN_ADDRESS ||
|
||||
uaddr > (void *)VM_MAXUSER_ADDRESS)
|
||||
return EFAULT;
|
||||
if (uaddr + len < (void *)VM_MAXUSER_ADDRESS)
|
||||
return copystr(kaddr, uaddr, len, done);
|
||||
err = copystr(kaddr, uaddr, (void *)VM_MAXUSER_ADDRESS - uaddr, done);
|
||||
if (err == ENAMETOOLONG)
|
||||
return EFAULT;
|
||||
return err;
|
||||
}
|
||||
|
||||
int copystr(const void *src, void *dest, size_t len, size_t *done)
|
||||
{
|
||||
label_t here;
|
||||
size_t count;
|
||||
int c;
|
||||
char const *s;
|
||||
char *d;
|
||||
|
||||
if (setjmp(&here) == 0) {
|
||||
s = src; d = dest;
|
||||
curproc->p_addr->u_pcb.pcb_onfault = &here;
|
||||
c = -1;
|
||||
*done = count = 0;
|
||||
while (count < len) {
|
||||
c = d[count] = s[count];
|
||||
*done = ++count;
|
||||
if (c == 0)
|
||||
break;
|
||||
}
|
||||
curproc->p_addr->u_pcb.pcb_onfault = NULL;
|
||||
if (c == 0)
|
||||
return 0;
|
||||
return ENAMETOOLONG;
|
||||
} else {
|
||||
curproc->p_addr->u_pcb.pcb_onfault = NULL;
|
||||
return EFAULT;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,206 @@
|
|||
/* $NetBSD: cpu.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 Ben Harris
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* This file is part of NetBSD/arm26 -- a port of NetBSD to ARM2/3 machines. */
|
||||
/*
|
||||
* cpu.c - high-level CPU detection etc
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $");
|
||||
|
||||
#include <sys/device.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/user.h>
|
||||
#include <machine/armreg.h>
|
||||
#include <machine/machdep.h>
|
||||
#include <machine/pcb.h>
|
||||
|
||||
#include <arch/arm26/arm26/cpuvar.h>
|
||||
|
||||
#include "opt_cputypes.h"
|
||||
|
||||
static int cpu_match(struct device *, struct cfdata *, void *);
|
||||
static void cpu_attach(struct device *, struct device *, void *);
|
||||
static register_t cpu_identify(void);
|
||||
#ifdef CPU_ARM3
|
||||
static void cpu_arm3_setup(struct device *);
|
||||
#endif
|
||||
static void cpu_delay_calibrate(struct device *);
|
||||
|
||||
register_t cpu_type;
|
||||
|
||||
struct cpu_softc {
|
||||
struct device sc_dev;
|
||||
};
|
||||
|
||||
struct cfattach cpu_ca = {
|
||||
sizeof(struct cpu_softc), cpu_match, cpu_attach
|
||||
};
|
||||
|
||||
static int
|
||||
cpu_match(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
|
||||
if (cf->cf_unit == 0)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
cpu_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
int supported;
|
||||
|
||||
printf(": ");
|
||||
cpu_type = cpu_identify();
|
||||
supported = 0;
|
||||
switch (cpu_type & CPU_ID_CPU_MASK) {
|
||||
case CPU_ID_ARM2:
|
||||
printf("ARM2");
|
||||
#ifdef CPU_ARM2
|
||||
supported = 1;
|
||||
#endif
|
||||
break;
|
||||
case CPU_ID_ARM250:
|
||||
printf("ARM250");
|
||||
#ifdef CPU_ARM250
|
||||
supported = 1;
|
||||
#endif
|
||||
break;
|
||||
case CPU_ID_ARM3:
|
||||
printf("ARM3 (rev. %d)", cpu_type & CPU_ID_REVISION_MASK);
|
||||
#ifdef CPU_ARM3
|
||||
supported = 1;
|
||||
cpu_arm3_setup(self);
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
printf("Unknown type, ID=0x%08x", cpu_type);
|
||||
break;
|
||||
}
|
||||
printf("\n");
|
||||
if (!supported)
|
||||
printf("%s: WARNING: CPU type not supported by kernel\n",
|
||||
self->dv_xname);
|
||||
config_interrupts(self, cpu_delay_calibrate);
|
||||
}
|
||||
|
||||
static register_t
|
||||
cpu_identify()
|
||||
{
|
||||
label_t here;
|
||||
register_t dummy;
|
||||
volatile register_t id;
|
||||
|
||||
if (setjmp(&here) == 0) {
|
||||
curproc->p_addr->u_pcb.pcb_onundef_lj = &here;
|
||||
id = CPU_ID_ARM2;
|
||||
/* ARM250 and ARM3 support SWP. */
|
||||
asm volatile ("swp r0, r0, [%0]" : : "r" (&dummy) : "r0");
|
||||
id = CPU_ID_ARM250;
|
||||
/* ARM3 has an internal coprocessor 15 with an ID register. */
|
||||
asm volatile ("mrc 15, 0, %0, cr0, cr0" : "=r" (id));
|
||||
}
|
||||
curproc->p_addr->u_pcb.pcb_onundef_lj = NULL;
|
||||
return id;
|
||||
}
|
||||
|
||||
#ifdef CPU_ARM3
|
||||
|
||||
#define ARM3_READ(reg, var) \
|
||||
asm ("mrc 15, 0, %0, cr" __STRING(reg) ", cr0" : "=r" (var))
|
||||
#define ARM3_WRITE(reg, val) \
|
||||
asm ("mcr 15, 0, %0, cr" __STRING(reg) ", cr0" : : "r" (val))
|
||||
|
||||
static void
|
||||
cpu_arm3_setup(struct device *self)
|
||||
{
|
||||
int oldctl;
|
||||
|
||||
/*
|
||||
* We decide whether to enable the cache based on its current
|
||||
* state. This is very dodgy, since the bootloader really
|
||||
* _should_ disable it for us, but currently BBBB doesn't. In
|
||||
* future, this should probably be a flag in the cpu
|
||||
* attachment.
|
||||
*/
|
||||
ARM3_READ(ARM3_CP15_CONTROL, oldctl);
|
||||
if (oldctl & ARM3_CTL_CACHE_ON) {
|
||||
/* Disable the cache while we set things up. */
|
||||
ARM3_WRITE(ARM3_CP15_CONTROL, ARM3_CTL_SHARED);
|
||||
/* All RAM and ROM is cacheable. */
|
||||
ARM3_WRITE(ARM3_CP15_CACHEABLE, 0xfcffffff);
|
||||
/* All RAM is updateable. */
|
||||
ARM3_WRITE(ARM3_CP15_UPDATEABLE, 0x00ffffff);
|
||||
/* Nothing is disruptive. We'll do cache flushing manually. */
|
||||
ARM3_WRITE(ARM3_CP15_DISRUPTIVE, 0x00000000);
|
||||
/* Flush the cache and turn it on. */
|
||||
ARM3_WRITE(ARM3_CP15_FLUSH, 0);
|
||||
ARM3_WRITE(ARM3_CP15_CONTROL,
|
||||
ARM3_CTL_CACHE_ON | ARM3_CTL_SHARED);
|
||||
printf(", cache enabled");
|
||||
cpu_delay_factor = 8;
|
||||
} else {
|
||||
ARM3_WRITE(ARM3_CP15_CONTROL, ARM3_CTL_SHARED);
|
||||
printf(", cache disabled");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* XXX This should be inlined. */
|
||||
void
|
||||
cpu_cache_flush(void)
|
||||
{
|
||||
|
||||
#ifdef CPU_ARM3
|
||||
#if defined(CPU_ARM2) || defined(CPU_ARM250)
|
||||
if ((cpu_type & CPU_ID_CPU_MASK) == CPU_ID_ARM3)
|
||||
#endif
|
||||
ARM3_WRITE(ARM3_CP15_FLUSH, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
int cpu_delay_factor = 1;
|
||||
|
||||
static void
|
||||
cpu_delay_calibrate(struct device *self)
|
||||
{
|
||||
struct timeval start, end, diff;
|
||||
|
||||
microtime(&start);
|
||||
cpu_delayloop(10000);
|
||||
microtime(&end);
|
||||
timersub(&end, &start, &diff);
|
||||
cpu_delay_factor = 10000 / diff.tv_usec + 1;
|
||||
printf("%s: 10000 loops in %ld microseconds, delay factor = %d\n",
|
||||
self->dv_xname, diff.tv_usec, cpu_delay_factor);
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/* $NetBSD: cpuvar.h,v 1.1 2000/05/09 21:55:55 bjh21 Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 2000 Ben Harris
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* This file is part of NetBSD/arm26 -- a port of NetBSD to ARM2/3 machines. */
|
||||
|
||||
#ifndef _ARM26_CPUVAR_H_
|
||||
#define _ARM26_CPUVAR_H_
|
||||
|
||||
extern register_t cpu_type;
|
||||
extern int cpu_delay_factor;
|
||||
|
||||
/* Fixed code sequence for reliability */
|
||||
#define cpu_delayloop(loops) \
|
||||
asm volatile ("1:subs %0, %0, #1; bne 1b" : : "r" (loops) : "cc")
|
||||
|
||||
extern void cpu_cache_flush(void);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,75 @@
|
|||
/* $NetBSD: db_disasm.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Mark Brinicombe.
|
||||
* Copyright (c) 1996 Brini.
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by Brini.
|
||||
* 4. The name of the company nor the name of the author may be used to
|
||||
* endorse or promote products derived from this software without specific
|
||||
* prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <machine/db_machdep.h>
|
||||
#include <ddb/db_sym.h>
|
||||
#include <ddb/db_output.h>
|
||||
#include <ddb/db_access.h>
|
||||
|
||||
#include <arm32/arm32/disassem.h>
|
||||
|
||||
/* Glue code to interface db_disasm to the generic ARM disassembler */
|
||||
|
||||
static u_int db_disasm_read_word(u_int);
|
||||
static void db_disasm_printaddr(u_int);
|
||||
|
||||
static disasm_interface_t db_disasm_interface = {
|
||||
db_disasm_read_word, db_disasm_printaddr, db_printf
|
||||
};
|
||||
|
||||
static u_int
|
||||
db_disasm_read_word(u_int address)
|
||||
{
|
||||
|
||||
return db_get_value(address, 4, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
db_disasm_printaddr(u_int address)
|
||||
{
|
||||
|
||||
db_printsym((db_addr_t)address, DB_STGY_ANY);
|
||||
}
|
||||
|
||||
vm_offset_t
|
||||
db_disasm(vm_offset_t loc, boolean_t altfmt)
|
||||
{
|
||||
|
||||
return disasm(&db_disasm_interface, loc, altfmt);
|
||||
}
|
||||
|
||||
/* End of db_disasm.c */
|
|
@ -0,0 +1,345 @@
|
|||
/* $NetBSD: db_interface.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Scott K. Stevens
|
||||
*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* From: db_interface.c,v 2.4 1991/02/05 17:11:13 mrt (CMU)
|
||||
*/
|
||||
|
||||
/*
|
||||
* Interface to new debugger.
|
||||
*/
|
||||
#include "opt_ddb.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/systm.h> /* just for boothowto */
|
||||
#include <sys/exec.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
|
||||
#include <machine/db_machdep.h>
|
||||
#include <ddb/db_access.h>
|
||||
#include <ddb/db_command.h>
|
||||
#include <ddb/db_output.h>
|
||||
#include <ddb/db_interface.h>
|
||||
#include <ddb/db_variables.h>
|
||||
#include <ddb/db_sym.h>
|
||||
#include <ddb/db_extern.h>
|
||||
#include <dev/cons.h>
|
||||
|
||||
static int nil;
|
||||
|
||||
int db_access_und_sp __P((struct db_variable *, db_expr_t *, int));
|
||||
int db_access_abt_sp __P((struct db_variable *, db_expr_t *, int));
|
||||
int db_access_irq_sp __P((struct db_variable *, db_expr_t *, int));
|
||||
u_int db_fetch_reg __P((int, db_regs_t *));
|
||||
|
||||
static int db_validate_address __P((vm_offset_t));
|
||||
static void db_write_text __P((unsigned char *, int ch));
|
||||
|
||||
struct db_variable db_regs[] = {
|
||||
{ "r0", (long *)&DDB_TF->tf_r0, FCN_NULL },
|
||||
{ "r1", (long *)&DDB_TF->tf_r1, FCN_NULL },
|
||||
{ "r2", (long *)&DDB_TF->tf_r2, FCN_NULL },
|
||||
{ "r3", (long *)&DDB_TF->tf_r3, FCN_NULL },
|
||||
{ "r4", (long *)&DDB_TF->tf_r4, FCN_NULL },
|
||||
{ "r5", (long *)&DDB_TF->tf_r5, FCN_NULL },
|
||||
{ "r6", (long *)&DDB_TF->tf_r6, FCN_NULL },
|
||||
{ "r7", (long *)&DDB_TF->tf_r7, FCN_NULL },
|
||||
{ "r8", (long *)&DDB_TF->tf_r8, FCN_NULL },
|
||||
{ "r9", (long *)&DDB_TF->tf_r9, FCN_NULL },
|
||||
{ "r10", (long *)&DDB_TF->tf_r10, FCN_NULL },
|
||||
{ "r11", (long *)&DDB_TF->tf_r11, FCN_NULL },
|
||||
{ "r12", (long *)&DDB_TF->tf_r12, FCN_NULL },
|
||||
{ "r13", (long *)&DDB_TF->tf_r13, FCN_NULL },
|
||||
{ "r14", (long *)&DDB_TF->tf_r14, FCN_NULL },
|
||||
{ "r15", (long *)&DDB_TF->tf_r15, FCN_NULL },
|
||||
};
|
||||
|
||||
struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
|
||||
|
||||
extern label_t *db_recover;
|
||||
|
||||
int db_active = 0;
|
||||
|
||||
/*
|
||||
* kdb_trap - field a TRACE or BPT trap
|
||||
*/
|
||||
int
|
||||
kdb_trap(type, regs)
|
||||
int type;
|
||||
db_regs_t *regs;
|
||||
{
|
||||
int s;
|
||||
|
||||
switch (type) {
|
||||
case T_BREAKPOINT: /* breakpoint */
|
||||
case -1: /* keyboard interrupt */
|
||||
break;
|
||||
default:
|
||||
if (db_recover != 0) {
|
||||
db_error("Faulted in DDB; continuing...\n");
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
}
|
||||
|
||||
/* Should switch to kdb`s own stack here. */
|
||||
|
||||
ddb_regs = *regs;
|
||||
|
||||
s = splhigh();
|
||||
db_active++;
|
||||
cnpollc(TRUE);
|
||||
db_trap(type, 0/*code*/);
|
||||
cnpollc(FALSE);
|
||||
db_active--;
|
||||
splx(s);
|
||||
|
||||
*regs = ddb_regs;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
db_validate_address(addr)
|
||||
vm_offset_t addr;
|
||||
{
|
||||
|
||||
/* FIXME */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Read bytes from kernel address space for debugger.
|
||||
*/
|
||||
void
|
||||
db_read_bytes(addr, size, data)
|
||||
vm_offset_t addr;
|
||||
size_t size;
|
||||
char *data;
|
||||
{
|
||||
char *src;
|
||||
|
||||
src = (char *)addr;
|
||||
for (; size > 0; size--) {
|
||||
if (db_validate_address((u_int)src)) {
|
||||
db_printf("address %p is invalid\n", src);
|
||||
return;
|
||||
}
|
||||
*data++ = *src++;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
db_write_text(dst, ch)
|
||||
unsigned char *dst;
|
||||
int ch;
|
||||
{
|
||||
|
||||
if (db_validate_address((u_int)dst)) {
|
||||
db_printf(" address %p not a valid page\n", dst);
|
||||
return;
|
||||
}
|
||||
|
||||
*dst = (unsigned char)ch;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write bytes to kernel address space for debugger.
|
||||
*/
|
||||
void
|
||||
db_write_bytes(addr, size, data)
|
||||
vm_offset_t addr;
|
||||
size_t size;
|
||||
char *data;
|
||||
{
|
||||
#if 0
|
||||
extern char _stext_[], _etext[];
|
||||
#endif
|
||||
char *dst;
|
||||
int loop;
|
||||
|
||||
dst = (char *)addr;
|
||||
loop = size;
|
||||
while (--loop >= 0) {
|
||||
#if 0 /* FIXME */
|
||||
if ((dst >= _stext_) && (dst < _etext))
|
||||
#endif
|
||||
db_write_text(dst, *data);
|
||||
#if 0
|
||||
else {
|
||||
if (db_validate_address((u_int)dst)) {
|
||||
db_printf("address %p is invalid\n", dst);
|
||||
return;
|
||||
}
|
||||
*dst = *data;
|
||||
}
|
||||
#endif
|
||||
dst++, data++;
|
||||
}
|
||||
}
|
||||
|
||||
void db_show_vmstat_cmd __P((db_expr_t addr, int have_addr, db_expr_t count, char *modif));
|
||||
void db_show_vnode_cmd __P((db_expr_t addr, int have_addr, db_expr_t count, char *modif));
|
||||
void db_show_intrchain_cmd __P((db_expr_t addr, int have_addr, db_expr_t count, char *modif));
|
||||
void db_show_panic_cmd __P((db_expr_t addr, int have_addr, db_expr_t count, char *modif));
|
||||
void db_show_frame_cmd __P((db_expr_t addr, int have_addr, db_expr_t count, char *modif));
|
||||
|
||||
struct db_command arm26_db_command_table[] = {
|
||||
{ "frame", db_show_frame_cmd, 0, NULL },
|
||||
#if 0
|
||||
{ "intrchain", db_show_intrchain_cmd, 0, NULL },
|
||||
#endif
|
||||
{ "panic", db_show_panic_cmd, 0, NULL },
|
||||
{ "vmstat", db_show_vmstat_cmd, 0, NULL },
|
||||
{ "vnode", db_show_vnode_cmd, 0, NULL },
|
||||
{ NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
int
|
||||
db_trapper(addr, inst, frame, fault_code)
|
||||
u_int addr;
|
||||
u_int inst;
|
||||
trapframe_t *frame;
|
||||
int fault_code;
|
||||
{
|
||||
if (fault_code == 0) {
|
||||
if ((inst & ~0xf0000000) == (BKPT_INST & ~0xf0000000))
|
||||
kdb_trap(T_BREAKPOINT, frame);
|
||||
else
|
||||
kdb_trap(-1, frame);
|
||||
} else
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern u_int esym;
|
||||
extern u_int end;
|
||||
|
||||
void
|
||||
db_machine_init()
|
||||
{
|
||||
|
||||
db_machine_commands_install(arm26_db_command_table);
|
||||
}
|
||||
|
||||
u_int
|
||||
db_fetch_reg(reg, db_regs)
|
||||
int reg;
|
||||
db_regs_t *db_regs;
|
||||
{
|
||||
|
||||
switch (reg) {
|
||||
case 0:
|
||||
return (db_regs->ddb_tf.tf_r0);
|
||||
case 1:
|
||||
return (db_regs->ddb_tf.tf_r1);
|
||||
case 2:
|
||||
return (db_regs->ddb_tf.tf_r2);
|
||||
case 3:
|
||||
return (db_regs->ddb_tf.tf_r3);
|
||||
case 4:
|
||||
return (db_regs->ddb_tf.tf_r4);
|
||||
case 5:
|
||||
return (db_regs->ddb_tf.tf_r5);
|
||||
case 6:
|
||||
return (db_regs->ddb_tf.tf_r6);
|
||||
case 7:
|
||||
return (db_regs->ddb_tf.tf_r7);
|
||||
case 8:
|
||||
return (db_regs->ddb_tf.tf_r8);
|
||||
case 9:
|
||||
return (db_regs->ddb_tf.tf_r9);
|
||||
case 10:
|
||||
return (db_regs->ddb_tf.tf_r10);
|
||||
case 11:
|
||||
return (db_regs->ddb_tf.tf_r11);
|
||||
case 12:
|
||||
return (db_regs->ddb_tf.tf_r12);
|
||||
case 13:
|
||||
return (db_regs->ddb_tf.tf_r13);
|
||||
case 14:
|
||||
return (db_regs->ddb_tf.tf_r14);
|
||||
case 15:
|
||||
return (db_regs->ddb_tf.tf_r15);
|
||||
default:
|
||||
panic("db_fetch_reg: botch");
|
||||
}
|
||||
}
|
||||
|
||||
u_int
|
||||
branch_taken(insn, pc, db_regs)
|
||||
u_int insn;
|
||||
u_int pc;
|
||||
db_regs_t *db_regs;
|
||||
{
|
||||
u_int addr, nregs;
|
||||
|
||||
switch ((insn >> 24) & 0xf) {
|
||||
case 0xa: /* b ... */
|
||||
case 0xb: /* bl ... */
|
||||
addr = ((insn << 2) & 0x03ffffff);
|
||||
if (addr & 0x02000000)
|
||||
addr |= 0xfc000000;
|
||||
return (pc + 8 + addr);
|
||||
case 0x7: /* ldr pc, [pc, reg, lsl #2] */
|
||||
addr = db_fetch_reg(insn & 0xf, db_regs);
|
||||
addr = pc + 8 + (addr << 2);
|
||||
db_read_bytes(addr, 4, (char *)&addr);
|
||||
return (addr);
|
||||
case 0x1: /* mov pc, reg */
|
||||
addr = db_fetch_reg(insn & 0xf, db_regs);
|
||||
return (addr);
|
||||
case 0x8: /* ldmxx reg, {..., pc} */
|
||||
case 0x9:
|
||||
addr = db_fetch_reg((insn >> 16) & 0xf, db_regs);
|
||||
nregs = (insn & 0x5555) + ((insn >> 1) & 0x5555);
|
||||
nregs = (nregs & 0x3333) + ((nregs >> 2) & 0x3333);
|
||||
nregs = (nregs + (nregs >> 4)) & 0x0f0f;
|
||||
nregs = (nregs + (nregs >> 8)) & 0x001f;
|
||||
switch ((insn >> 23) & 0x3) {
|
||||
case 0x0: /* ldmda */
|
||||
addr = addr - 0;
|
||||
break;
|
||||
case 0x1: /* ldmia */
|
||||
addr = addr + 0 + ((nregs - 1) << 2);
|
||||
break;
|
||||
case 0x2: /* ldmdb */
|
||||
addr = addr - 4;
|
||||
break;
|
||||
case 0x3: /* ldmib */
|
||||
addr = addr + 4 + ((nregs - 1) << 2);
|
||||
break;
|
||||
}
|
||||
db_read_bytes(addr, 4, (char *)&addr);
|
||||
return (addr);
|
||||
default:
|
||||
panic("branch_taken: botch");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,227 @@
|
|||
/* $NetBSD: db_machdep.c,v 1.1 2000/05/09 21:55:55 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Mark Brinicombe
|
||||
*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <machine/db_machdep.h>
|
||||
|
||||
#include <ddb/db_access.h>
|
||||
#include <ddb/db_sym.h>
|
||||
#include <ddb/db_output.h>
|
||||
|
||||
/*
|
||||
* Print out a description of a vnode.
|
||||
* Some parts borrowed from kern/vfs_subr.c
|
||||
*/
|
||||
|
||||
static char *typename[] =
|
||||
{ "VNON", "VREG", "VDIR", "VBLK", "VCHR", "VLNK", "VSOCK", "VFIFO", "VBAD" };
|
||||
|
||||
void
|
||||
db_show_vnode_cmd(addr, have_addr, count, modif)
|
||||
db_expr_t addr;
|
||||
int have_addr;
|
||||
db_expr_t count;
|
||||
char *modif;
|
||||
{
|
||||
char buf[64];
|
||||
struct vnode *vp;
|
||||
|
||||
if (!have_addr) {
|
||||
db_printf("vnode address must be specified\n");
|
||||
return;
|
||||
}
|
||||
|
||||
vp = (struct vnode *)addr;
|
||||
|
||||
/* Decode the one argument */
|
||||
|
||||
db_printf("vp : %08x\n", (u_int)vp);
|
||||
db_printf("vp->v_type = %d\n", vp->v_type);
|
||||
db_printf("vp->v_flag = %ld\n", vp->v_flag);
|
||||
db_printf("vp->v_numoutput = %ld\n", vp->v_numoutput);
|
||||
|
||||
db_printf("type %s, usecount %ld, writecount %ld, refcount %ld,",
|
||||
typename[vp->v_type], vp->v_usecount, vp->v_writecount,
|
||||
vp->v_holdcnt);
|
||||
buf[0] = '\0';
|
||||
if (vp->v_flag & VROOT)
|
||||
strcat(buf, "|VROOT");
|
||||
if (vp->v_flag & VTEXT)
|
||||
strcat(buf, "|VTEXT");
|
||||
if (vp->v_flag & VSYSTEM)
|
||||
strcat(buf, "|VSYSTEM");
|
||||
if (vp->v_flag & VXLOCK)
|
||||
strcat(buf, "|VXLOCK");
|
||||
if (vp->v_flag & VXWANT)
|
||||
strcat(buf, "|VXWANT");
|
||||
if (vp->v_flag & VBWAIT)
|
||||
strcat(buf, "|VBWAIT");
|
||||
if (vp->v_flag & VALIASED)
|
||||
strcat(buf, "|VALIASED");
|
||||
if (buf[0] != '\0')
|
||||
db_printf(" flags (%s)", &buf[1]);
|
||||
db_printf("\n");
|
||||
if (vp->v_data != NULL) {
|
||||
db_printf("data=%08x\n", (u_int)vp->v_data);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
db_show_vmstat_cmd(addr, have_addr, count, modif)
|
||||
db_expr_t addr;
|
||||
int have_addr;
|
||||
db_expr_t count;
|
||||
char *modif;
|
||||
{
|
||||
|
||||
db_printf("Current UVM status:\n");
|
||||
db_printf(" pagesize=%d (0x%x), pagemask=0x%x, pageshift=%d\n",
|
||||
uvmexp.pagesize, uvmexp.pagesize, uvmexp.pagemask,
|
||||
uvmexp.pageshift);
|
||||
db_printf(" %d VM pages: %d active, %d inactive, %d wired, %d free\n",
|
||||
uvmexp.npages, uvmexp.active, uvmexp.inactive, uvmexp.wired,
|
||||
uvmexp.free);
|
||||
db_printf(" freemin=%d, free-target=%d, inactive-target=%d, "
|
||||
"wired-max=%d\n", uvmexp.freemin, uvmexp.freetarg, uvmexp.inactarg,
|
||||
uvmexp.wiredmax);
|
||||
db_printf(" faults=%d, traps=%d, intrs=%d, ctxswitch=%d\n",
|
||||
uvmexp.faults, uvmexp.traps, uvmexp.intrs, uvmexp.swtch);
|
||||
db_printf(" softint=%d, syscalls=%d, swapins=%d, swapouts=%d\n",
|
||||
uvmexp.softs, uvmexp.syscalls, uvmexp.swapins, uvmexp.swapouts);
|
||||
|
||||
db_printf(" fault counts:\n");
|
||||
db_printf(" noram=%d, noanon=%d, pgwait=%d, pgrele=%d\n",
|
||||
uvmexp.fltnoram, uvmexp.fltnoanon, uvmexp.fltpgwait,
|
||||
uvmexp.fltpgrele);
|
||||
db_printf(" ok relocks(total)=%d(%d), anget(retrys)=%d(%d), "
|
||||
"amapcopy=%d\n", uvmexp.fltrelckok, uvmexp.fltrelck,
|
||||
uvmexp.fltanget, uvmexp.fltanretry, uvmexp.fltamcopy);
|
||||
db_printf(" neighbor anon/obj pg=%d/%d, gets(lock/unlock)=%d/%d\n",
|
||||
uvmexp.fltnamap, uvmexp.fltnomap, uvmexp.fltlget, uvmexp.fltget);
|
||||
db_printf(" cases: anon=%d, anoncow=%d, obj=%d, prcopy=%d, przero=%d\n",
|
||||
uvmexp.flt_anon, uvmexp.flt_acow, uvmexp.flt_obj, uvmexp.flt_prcopy,
|
||||
uvmexp.flt_przero);
|
||||
|
||||
db_printf(" daemon and swap counts:\n");
|
||||
db_printf(" woke=%d, revs=%d, scans=%d, swout=%d\n", uvmexp.pdwoke,
|
||||
uvmexp.pdrevs, uvmexp.pdscans, uvmexp.pdswout);
|
||||
db_printf(" busy=%d, freed=%d, reactivate=%d, deactivate=%d\n",
|
||||
uvmexp.pdbusy, uvmexp.pdfreed, uvmexp.pdreact, uvmexp.pddeact);
|
||||
db_printf(" pageouts=%d, pending=%d, nswget=%d\n", uvmexp.pdpageouts,
|
||||
uvmexp.pdpending, uvmexp.nswget);
|
||||
db_printf(" nswapdev=%d, nanon=%d, nfreeanon=%d\n", uvmexp.nswapdev,
|
||||
uvmexp.nanon, uvmexp.nfreeanon);
|
||||
|
||||
db_printf(" kernel pointers:\n");
|
||||
db_printf(" objs(kmem/mb)=%p/%p\n", uvmexp.kmem_object,
|
||||
uvmexp.mb_object);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
db_show_intrchain_cmd(addr, have_addr, count, modif)
|
||||
db_expr_t addr;
|
||||
int have_addr;
|
||||
db_expr_t count;
|
||||
char *modif;
|
||||
{
|
||||
int loop;
|
||||
irqhandler_t *ptr;
|
||||
char *name;
|
||||
db_expr_t offset;
|
||||
|
||||
for (loop = 0; loop < NIRQS; ++loop) {
|
||||
ptr = irqhandlers[loop];
|
||||
if (ptr) {
|
||||
db_printf("IRQ %d\n", loop);
|
||||
|
||||
while (ptr) {
|
||||
db_printf(" %-13s %d ", ptr->ih_name, ptr->ih_level);
|
||||
db_find_sym_and_offset((u_int)ptr->ih_func, &name, &offset);
|
||||
if (name == NULL)
|
||||
name = "?";
|
||||
|
||||
db_printf("%s(", name);
|
||||
db_printsym((u_int)ptr->ih_func, DB_STGY_PROC);
|
||||
db_printf(") %08x\n", (u_int)ptr->ih_arg);
|
||||
ptr = ptr->ih_next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
db_show_panic_cmd(addr, have_addr, count, modif)
|
||||
db_expr_t addr;
|
||||
int have_addr;
|
||||
db_expr_t count;
|
||||
char *modif;
|
||||
{
|
||||
int s;
|
||||
|
||||
s = splhigh();
|
||||
|
||||
db_printf("Panic string: %s\n", panicstr);
|
||||
|
||||
(void)splx(s);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
db_show_frame_cmd(addr, have_addr, count, modif)
|
||||
db_expr_t addr;
|
||||
int have_addr;
|
||||
db_expr_t count;
|
||||
char *modif;
|
||||
{
|
||||
struct trapframe *frame;
|
||||
|
||||
if (!have_addr) {
|
||||
db_printf("frame address must be specified\n");
|
||||
return;
|
||||
}
|
||||
|
||||
frame = (struct trapframe *)addr;
|
||||
|
||||
db_printf("frame address = %08x ", (u_int)frame);
|
||||
db_printf("r0 =%08x r1 =%08x r2 =%08x r3 =%08x\n",
|
||||
frame->tf_r0, frame->tf_r1, frame->tf_r2, frame->tf_r3);
|
||||
db_printf("r4 =%08x r5 =%08x r6 =%08x r7 =%08x\n",
|
||||
frame->tf_r4, frame->tf_r5, frame->tf_r6, frame->tf_r7);
|
||||
db_printf("r8 =%08x r9 =%08x r10=%08x r11=%08x\n",
|
||||
frame->tf_r8, frame->tf_r9, frame->tf_r10, frame->tf_r11);
|
||||
db_printf("r12=%08x r13=%08x r14=%08x r15=%08x\n",
|
||||
frame->tf_r12, frame->tf_r13, frame->tf_r14, frame->tf_r15);
|
||||
}
|
|
@ -0,0 +1,150 @@
|
|||
/* $NetBSD: db_trace.c,v 1.1 2000/05/09 21:55:56 bjh21 Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Scott K. Stevens
|
||||
*
|
||||
* Mach Operating System
|
||||
* Copyright (c) 1991,1990 Carnegie Mellon University
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission to use, copy, modify and distribute this software and its
|
||||
* documentation is hereby granted, provided that both the copyright
|
||||
* notice and this permission notice appear in all copies of the
|
||||
* software, derivative works or modified versions, and any portions
|
||||
* thereof, and that both notices appear in supporting documentation.
|
||||
*
|
||||
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
|
||||
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
|
||||
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
|
||||
*
|
||||
* Carnegie Mellon requests users of this software to return to
|
||||
*
|
||||
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
|
||||
* School of Computer Science
|
||||
* Carnegie Mellon University
|
||||
* Pittsburgh PA 15213-3890
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/user.h>
|
||||
#include <machine/armreg.h>
|
||||
#include <machine/db_machdep.h>
|
||||
|
||||
#include <ddb/db_access.h>
|
||||
#include <ddb/db_interface.h>
|
||||
#include <ddb/db_sym.h>
|
||||
#include <ddb/db_output.h>
|
||||
|
||||
#define INKERNEL(va) (((vm_offset_t)(va)) >= VM_MIN_KERNEL_ADDRESS)
|
||||
|
||||
void
|
||||
db_stack_trace_cmd(addr, have_addr, count, modif)
|
||||
db_expr_t addr;
|
||||
int have_addr;
|
||||
db_expr_t count;
|
||||
char *modif;
|
||||
{
|
||||
struct frame *frame, *lastframe;
|
||||
char c, *cp = modif;
|
||||
boolean_t kernel_only = TRUE;
|
||||
boolean_t trace_thread = FALSE;
|
||||
|
||||
while ((c = *cp++) != 0) {
|
||||
if (c == 'u')
|
||||
kernel_only = FALSE;
|
||||
if (c == 't')
|
||||
trace_thread = TRUE;
|
||||
}
|
||||
|
||||
if (count == -1)
|
||||
count = 65535;
|
||||
|
||||
/*
|
||||
* The frame pointer points to the top word of the stack frame so we
|
||||
* need to adjust it by sizeof(struct frame) - sizeof(u_int))
|
||||
* to get the address of the start of the frame structure.
|
||||
*/
|
||||
|
||||
if (!have_addr)
|
||||
frame = (struct frame *)(DDB_TF->tf_r11
|
||||
- (sizeof(struct frame) - sizeof(u_int)));
|
||||
else {
|
||||
if (trace_thread) {
|
||||
struct proc *p;
|
||||
struct user *u;
|
||||
db_printf ("trace: pid %d ", (int)addr);
|
||||
p = pfind(addr);
|
||||
if (p == NULL) {
|
||||
db_printf("not found\n");
|
||||
return;
|
||||
}
|
||||
if (!(p->p_flag & P_INMEM)) {
|
||||
db_printf("swapped out\n");
|
||||
return;
|
||||
}
|
||||
u = p->p_addr;
|
||||
frame = (struct frame *) (u->u_pcb.pcb_sf->sf_r11
|
||||
- (sizeof(struct frame) - sizeof(u_int)));
|
||||
db_printf("at %p\n", frame);
|
||||
} else
|
||||
frame = (struct frame *)(addr - (sizeof(struct frame)
|
||||
- sizeof(u_int)));
|
||||
}
|
||||
lastframe = NULL;
|
||||
|
||||
while (count--) {
|
||||
db_expr_t offset;
|
||||
char *name;
|
||||
db_addr_t pc;
|
||||
|
||||
/* db_printf("fp=%08x: fp=%08x sp=%08x lr=%08x pc=%08x\n",
|
||||
(u_int)frame, frame->fr_fp, frame->fr_sp, frame->fr_lr,
|
||||
frame->fr_r15);*/
|
||||
|
||||
pc = frame->fr_r15 & R15_PC;
|
||||
if (!INKERNEL(pc))
|
||||
break;
|
||||
|
||||
db_find_sym_and_offset(pc, &name, &offset);
|
||||
if (name == NULL)
|
||||
name = "?";
|
||||
|
||||
db_printf("%s(", name);
|
||||
db_printsym(pc, DB_STGY_PROC);
|
||||
db_printf(")");
|
||||
db_printf("\n");
|
||||
|
||||
/*
|
||||
* Switch to next frame up
|
||||
*/
|
||||
if (frame->fr_fp == 0)
|
||||
break; /* Top of stack */
|
||||
|
||||
lastframe = frame;
|
||||
frame = (struct frame *)(frame->fr_fp - (sizeof(struct frame)
|
||||
- sizeof(u_int)));
|
||||
|
||||
if (INKERNEL((int)frame)) {
|
||||
/* staying in kernel */
|
||||
if (frame <= lastframe) {
|
||||
db_printf("Bad frame pointer: %p\n", frame);
|
||||
break;
|
||||
}
|
||||
} else if (INKERNEL((int)lastframe)) {
|
||||
/* switch from user to kernel */
|
||||
if (kernel_only)
|
||||
break; /* kernel stack only */
|
||||
} else {
|
||||
/* in user */
|
||||
if (frame <= lastframe) {
|
||||
db_printf("Bad user frame pointer: %p\n",
|
||||
frame);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue