Clean up deleted files.

This commit is contained in:
mycroft 1994-01-08 11:11:50 +00:00
parent 0e515ae1bd
commit 150f1034c9
4 changed files with 0 additions and 571 deletions

View File

@ -1,100 +0,0 @@
/*
* Copyright (c) 1988, 1990 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: Utah Hdr: in_cksum.c 1.1 90/07/09
* from: @(#)in_cksum.c 7.3 (Berkeley) 12/16/90
* $Id: in_cksum.c,v 1.3 1993/08/01 19:24:43 mycroft Exp $
*/
/*
* in_cksum - checksum routine for the Internet Protocol family.
*/
#include "sys/param.h"
#include "sys/mbuf.h"
#include "netinet/in.h"
#include "netinet/in_systm.h"
extern int oc_cksum();
/*
* Checksum routine for the Internet Protocol family.
*
* This isn't as bad as it looks. For ip headers the "while" isn't
* executed and we just drop through to the return statement at the
* end. For the usual tcp or udp packet (a single header mbuf
* chained onto a cluster of data, we make exactly one trip through
* the while (for the header mbuf) and never do the hairy code
* inside the "if". If fact, if m_copydata & sb_compact are doing
* their job, we should never do the hairy code inside the "if".
*/
in_cksum(m, len)
register struct mbuf *m;
register int len;
{
register int sum = 0;
register int i;
while (len > m->m_len) {
sum = oc_cksum(mtod(m, u_char *), i = m->m_len, sum);
m = m->m_next;
len -= i;
if (i & 1) {
/*
* ouch - we ended on an odd byte with more
* to do. This xfer is obviously not interested
* in performance so finish things slowly.
*/
register u_char *cp;
while (len > m->m_len) {
cp = mtod(m, u_char *);
if (i & 1) {
i = m->m_len - 1;
--len;
sum += *cp++;
} else
i = m->m_len;
sum = oc_cksum(cp, i, sum);
m = m->m_next;
len -= i;
}
if (i & 1) {
cp = mtod(m, u_char *);
sum += *cp++;
return (0xffff & ~oc_cksum(cp, len - 1, sum));
}
}
}
return (0xffff & ~oc_cksum(mtod(m, u_char *), len, sum));
}

View File

@ -1,205 +0,0 @@
/*
* Copyright (c) 1982, 1988 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: @(#)ns_cksum.c 7.7 (Berkeley) 4/29/91
* $Id: ns_cksum.c,v 1.2 1993/05/22 07:57:36 cgd Exp $
*/
#include "sys/param.h"
#include "sys/mbuf.h"
/*
* Checksum routine for Network Systems Protocol Packets (Big-Endian).
*
* This routine is very heavily used in the network
* code and should be modified for each CPU to be as fast as possible.
*/
#define ADDCARRY(x) { if ((x) > 65535) (x) -= 65535; }
#define FOLD(x) {l_util.l = (x); (x) = l_util.s[0] + l_util.s[1]; ADDCARRY(x);}
u_short
ns_cksum(m, len)
register struct mbuf *m;
register int len;
{
register u_short *w;
register int sum = 0;
register int mlen = 0;
register int sum2;
union {
u_short s[2];
long l;
} l_util;
for (;m && len; m = m->m_next) {
if (m->m_len == 0)
continue;
/*
* Each trip around loop adds in
* word from one mbuf segment.
*/
w = mtod(m, u_short *);
if (mlen == -1) {
/*
* There is a byte left from the last segment;
* ones-complement add it into the checksum.
*/
#if BYTE_ORDER == BIG_ENDIAN
sum += *(u_char *)w;
#else
sum += *(u_char *)w << 8;
#endif
sum += sum;
w = (u_short *)(1 + (char *)w);
mlen = m->m_len - 1;
len--;
FOLD(sum);
} else
mlen = m->m_len;
if (len < mlen)
mlen = len;
len -= mlen;
/*
* We can do a 16 bit ones complement sum using
* 32 bit arithmetic registers for adding,
* with carries from the low added
* into the high (by normal carry-chaining)
* so long as we fold back before 16 carries have occured.
*/
if (1 & (int) w)
goto uuuuglyy;
#ifndef TINY
/* -DTINY reduces the size from 1250 to 550, but slows it down by 22% */
while ((mlen -= 32) >= 0) {
sum += w[0]; sum += sum; sum += w[1]; sum += sum;
sum += w[2]; sum += sum; sum += w[3]; sum += sum;
sum += w[4]; sum += sum; sum += w[5]; sum += sum;
sum += w[6]; sum += sum; sum += w[7]; sum += sum;
FOLD(sum);
sum += w[8]; sum += sum; sum += w[9]; sum += sum;
sum += w[10]; sum += sum; sum += w[11]; sum += sum;
sum += w[12]; sum += sum; sum += w[13]; sum += sum;
sum += w[14]; sum += sum; sum += w[15]; sum += sum;
FOLD(sum);
w += 16;
}
mlen += 32;
#endif
while ((mlen -= 8) >= 0) {
sum += w[0]; sum += sum; sum += w[1]; sum += sum;
sum += w[2]; sum += sum; sum += w[3]; sum += sum;
FOLD(sum);
w += 4;
}
mlen += 8;
while ((mlen -= 2) >= 0) {
sum += *w++; sum += sum;
}
goto commoncase;
uuuuglyy:
#if BYTE_ORDER == BIG_ENDIAN
#define ww(n) (((u_char *)w)[n + n + 1])
#define vv(n) (((u_char *)w)[n + n])
#else
#if BYTE_ORDER == LITTLE_ENDIAN
#define vv(n) (((u_char *)w)[n + n + 1])
#define ww(n) (((u_char *)w)[n + n])
#endif
#endif
sum2 = 0;
#ifndef TINY
while ((mlen -= 32) >= 0) {
sum += ww(0); sum += sum; sum += ww(1); sum += sum;
sum += ww(2); sum += sum; sum += ww(3); sum += sum;
sum += ww(4); sum += sum; sum += ww(5); sum += sum;
sum += ww(6); sum += sum; sum += ww(7); sum += sum;
FOLD(sum);
sum += ww(8); sum += sum; sum += ww(9); sum += sum;
sum += ww(10); sum += sum; sum += ww(11); sum += sum;
sum += ww(12); sum += sum; sum += ww(13); sum += sum;
sum += ww(14); sum += sum; sum += ww(15); sum += sum;
FOLD(sum);
sum2 += vv(0); sum2 += sum2; sum2 += vv(1); sum2 += sum2;
sum2 += vv(2); sum2 += sum2; sum2 += vv(3); sum2 += sum2;
sum2 += vv(4); sum2 += sum2; sum2 += vv(5); sum2 += sum2;
sum2 += vv(6); sum2 += sum2; sum2 += vv(7); sum2 += sum2;
FOLD(sum2);
sum2 += vv(8); sum2 += sum2; sum2 += vv(9); sum2 += sum2;
sum2 += vv(10); sum2 += sum2; sum2 += vv(11); sum2 += sum2;
sum2 += vv(12); sum2 += sum2; sum2 += vv(13); sum2 += sum2;
sum2 += vv(14); sum2 += sum2; sum2 += vv(15); sum2 += sum2;
FOLD(sum2);
w += 16;
}
mlen += 32;
#endif
while ((mlen -= 8) >= 0) {
sum += ww(0); sum += sum; sum += ww(1); sum += sum;
sum += ww(2); sum += sum; sum += ww(3); sum += sum;
FOLD(sum);
sum2 += vv(0); sum2 += sum2; sum2 += vv(1); sum2 += sum2;
sum2 += vv(2); sum2 += sum2; sum2 += vv(3); sum2 += sum2;
FOLD(sum2);
w += 4;
}
mlen += 8;
while ((mlen -= 2) >= 0) {
sum += ww(0); sum += sum;
sum2 += vv(0); sum2 += sum2;
w++;
}
sum += (sum2 << 8);
commoncase:
if (mlen == -1) {
#if BYTE_ORDER == BIG_ENDIAN
sum += *(u_char *)w << 8;
#else
sum += *(u_char *)w;
#endif
}
FOLD(sum);
}
if (mlen == -1) {
/* We had an odd number of bytes to sum; assume a garbage
byte of zero and clean up */
sum += sum;
FOLD(sum);
}
/*
* sum has already been kept to low sixteen bits.
* just examine result and exit.
*/
if(sum==0xffff) sum = 0;
return (sum);
}

View File

@ -1,186 +0,0 @@
| Copyright (c) 1988 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: @(#)oc_cksum.s 7.2 (Berkeley) 11/3/90
| $Id: oc_cksum.s,v 1.2 1993/05/22 07:57:37 cgd Exp $
|
|
| oc_cksum: ones complement 16 bit checksum for MC68020.
|
| oc_cksum (buffer, count, strtval)
|
| Do a 16 bit one's complement sum of 'count' bytes from 'buffer'.
| 'strtval' is the starting value of the sum (usually zero).
|
| It simplifies life in in_cksum if strtval can be >= 2^16.
| This routine will work as long as strtval is < 2^31.
|
| Performance
| -----------
| This routine is intended for MC 68020s but should also work
| for 68030s. It (deliberately) doesn't worry about the alignment
| of the buffer so will only work on a 68010 if the buffer is
| aligned on an even address. (Also, a routine written to use
| 68010 "loop mode" would almost certainly be faster than this
| code on a 68010).
|
| We don't worry about alignment because this routine is frequently
| called with small counts: 20 bytes for IP header checksums and 40
| bytes for TCP ack checksums. For these small counts, testing for
| bad alignment adds ~10% to the per-call cost. Since, by the nature
| of the kernel's allocator, the data we're called with is almost
| always longword aligned, there is no benefit to this added cost
| and we're better off letting the loop take a big performance hit
| in the rare cases where we're handed an unaligned buffer.
|
| Loop unrolling constants of 2, 4, 8, 16, 32 and 64 times were
| tested on random data on four different types of processors (see
| list below -- 64 was the largest unrolling because anything more
| overflows the 68020 Icache). On all the processors, the
| throughput asymptote was located between 8 and 16 (closer to 8).
| However, 16 was substantially better than 8 for small counts.
| (It's clear why this happens for a count of 40: unroll-8 pays a
| loop branch cost and unroll-16 doesn't. But the tests also showed
| that 16 was better than 8 for a count of 20. It's not obvious to
| me why.) So, since 16 was good for both large and small counts,
| the loop below is unrolled 16 times.
|
| The processors tested and their average time to checksum 1024 bytes
| of random data were:
| Sun 3/50 (15MHz) 190 us/KB
| Sun 3/180 (16.6MHz) 175 us/KB
| Sun 3/60 (20MHz) 134 us/KB
| Sun 3/280 (25MHz) 95 us/KB
|
| The cost of calling this routine was typically 10% of the per-
| kilobyte cost. E.g., checksumming zero bytes on a 3/60 cost 9us
| and each additional byte cost 125ns. With the high fixed cost,
| it would clearly be a gain to "inline" this routine -- the
| subroutine call adds 400% overhead to an IP header checksum.
| However, in absolute terms, inlining would only gain 10us per
| packet -- a 1% effect for a 1ms ethernet packet. This is not
| enough gain to be worth the effort.
.even
.text
.globl _oc_cksum
_oc_cksum:
movl sp@(4),a0 | get buffer ptr
movl sp@(8),d1 | get byte count
movl sp@(12),d0 | get starting value
movl d2,sp@- | free a reg
| test for possible 1, 2 or 3 bytes of excess at end
| of buffer. The usual case is no excess (the usual
| case is header checksums) so we give that the faster
| 'not taken' leg of the compare. (We do the excess
| first because we're about the trash the low order
| bits of the count in d1.)
btst #0,d1
jne L5 | if one or three bytes excess
btst #1,d1
jne L7 | if two bytes excess
L1:
movl d1,d2
lsrl #6,d1 | make cnt into # of 64 byte chunks
andl #0x3c,d2 | then find fractions of a chunk
negl d2
andb #0xf,cc | clear X
jmp pc@(L3-.-2:b,d2)
L2:
movl a0@+,d2
addxl d2,d0
movl a0@+,d2
addxl d2,d0
movl a0@+,d2
addxl d2,d0
movl a0@+,d2
addxl d2,d0
movl a0@+,d2
addxl d2,d0
movl a0@+,d2
addxl d2,d0
movl a0@+,d2
addxl d2,d0
movl a0@+,d2
addxl d2,d0
movl a0@+,d2
addxl d2,d0
movl a0@+,d2
addxl d2,d0
movl a0@+,d2
addxl d2,d0
movl a0@+,d2
addxl d2,d0
movl a0@+,d2
addxl d2,d0
movl a0@+,d2
addxl d2,d0
movl a0@+,d2
addxl d2,d0
movl a0@+,d2
addxl d2,d0
L3:
dbra d1,L2 | (NB- dbra doesn't affect X)
movl d0,d1 | fold 32 bit sum to 16 bits
swap d1 | (NB- swap doesn't affect X)
addxw d1,d0
jcc L4
addw #1,d0
L4:
andl #0xffff,d0
movl sp@+,d2
rts
L5: | deal with 1 or 3 excess bytes at the end of the buffer.
btst #1,d1
jeq L6 | if 1 excess
| 3 bytes excess
clrl d2
movw a0@(-3,d1:l),d2 | add in last full word then drop
addl d2,d0 | through to pick up last byte
L6: | 1 byte excess
clrl d2
movb a0@(-1,d1:l),d2
lsll #8,d2
addl d2,d0
jra L1
L7: | 2 bytes excess
clrl d2
movw a0@(-2,d1:l),d2
addl d2,d0
jra L1

View File

@ -1,80 +0,0 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/proc.h>
#include <sys/user.h>
#include <sys/vnode.h>
#include <machine/psl.h>
#include <machine/reg.h>
#include <miscfs/procfs/procfs.h>
extern char kstack[]; /* XXX */
int
procfs_sstep(p)
struct proc *p;
{
struct frame *frame;
if ((p->p_flag & SLOAD) == 0)
return EIO;
frame = (struct frame *)
((char *)p->p_addr + ((char *)p->p_regs - (char *)kstack));
frame->f_sr |= PSL_T;
return 0;
}
int
procfs_fix_sstep(p)
struct proc *p;
{
return 0;
}
int
procfs_read_regs(p, regs)
struct proc *p;
struct reg *regs;
{
struct frame *frame;
if ((p->p_flag & SLOAD) == 0)
return EIO;
frame = (struct frame *)
((char *)p->p_addr + ((char *)p->p_regs - (char *)kstack));
bcopy(frame->f_regs, regs->r_regs, sizeof(frame->f_regs));
regs->r_sr = frame->f_sr;
regs->r_pc = frame->f_pc;
return 0;
}
int
procfs_write_regs(p, regs)
struct proc *p;
struct reg *regs;
{
struct frame *frame;
if ((p->p_flag & SLOAD) == 0)
return EIO;
frame = (struct frame *)
((char *)p->p_addr + ((char *)p->p_regs - (char *)kstack));
if ((regs->r_sr & PSL_USERCLR) != 0 ||
(regs->r_sr & PSL_USERSET) != PSL_USERSET)
return EPERM;
bcopy(regs->r_regs, frame->f_regs, sizeof(frame->f_regs));
frame->f_sr = regs->r_sr;
frame->f_pc = regs->r_pc;
return 0;
}