Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
itojun
committed
Jan 19, 2001
1 parent
54ffc96
commit d223459
Showing
49 changed files
with
3,894 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,58 @@ | |||
/*- | |||
* 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. | |||
* | |||
* $FreeBSD: src/sys/libkern/adddi3.c,v 1.5 1999/08/28 00:46:30 peter Exp $ | |||
*/ | |||
|
|||
#include "quad.h" | |||
|
|||
/* | |||
* Add two quads. This is trivial since a one-bit carry from a single | |||
* u_long addition x+y occurs if and only if the sum x+y is less than | |||
* either x or y (the choice to compare with x or y is arbitrary). | |||
*/ | |||
quad_t | |||
__adddi3(a, b) | |||
quad_t a, b; | |||
{ | |||
union uu aa, bb, sum; | |||
|
|||
aa.q = a; | |||
bb.q = b; | |||
sum.ul[L] = aa.ul[L] + bb.ul[L]; | |||
sum.ul[H] = aa.ul[H] + bb.ul[H] + (sum.ul[L] < bb.ul[L]); | |||
return (sum.q); | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,47 @@ | |||
/* $NetBSD: byte_swap_2.S,v 1.2 1996/10/17 03:08:08 cgd Exp $ */ | |||
|
|||
/* | |||
* Copyright (c) 1996 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 <machine/asm.h> | |||
|
|||
#ifndef NAME | |||
#define NAME byte_swap_2 | |||
#endif | |||
|
|||
/* | |||
* Byte-swap a 2-byte quantity. (Convert 0x0123 to 0x2301.) | |||
* | |||
* Argument is an unsigned 2-byte integer (u_int16_t). | |||
*/ | |||
LEAF(NAME, 1) /* a0 contains 0x0123 */ | |||
extbl a0, 0, t0 /* t0 = 0x 23 */ | |||
extbl a0, 1, t1 /* t1 = 0x 01 */ | |||
sll t0, 8, t0 /* t1 = 0x23 */ | |||
or t0, t1, v0 /* v0 = 0x2301 */ | |||
RET | |||
END(NAME) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,53 @@ | |||
/* $NetBSD: byte_swap_4.S,v 1.2 1996/10/17 03:08:09 cgd Exp $ */ | |||
|
|||
/* | |||
* Copyright (c) 1996 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 <machine/asm.h> | |||
|
|||
#ifndef NAME | |||
#define NAME byte_swap_4 | |||
#endif | |||
|
|||
/* | |||
* Byte-swap a 4-byte quantity. (Convert 0x01234567 to 0x67452301.) | |||
* | |||
* Argument is an unsigned 4-byte integer (u_int32_t). | |||
*/ | |||
LEAF(NAME, 1) /* a0 contains 0x01234567 */ | |||
extbl a0, 0, t0 /* t0 = 0x 67 */ | |||
extbl a0, 1, t1 /* t1 = 0x 45 */ | |||
extbl a0, 2, t2 /* t2 = 0x 23 */ | |||
extbl a0, 3, t3 /* t3 = 0x 01 */ | |||
sll t0, 24, t0 /* t0 = 0x67 */ | |||
sll t1, 16, t1 /* t1 = 0x 45 */ | |||
sll t2, 8, t2 /* t2 = 0x 23 */ | |||
or t3, t0, v0 /* v0 = 0x67 01 */ | |||
or t1, t2, t1 /* t1 = 0x 4523 */ | |||
or t1, v0, v0 /* v0 = 0x67452301 */ | |||
RET | |||
END(NAME) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,32 @@ | |||
/* $NetBSD: htonl.S,v 1.1 1996/04/17 22:36:52 cgd Exp $ */ | |||
|
|||
/* | |||
* Copyright (c) 1996 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. | |||
*/ | |||
|
|||
#define NAME htonl | |||
|
|||
#include <libkern/alpha/byte_swap_4.S> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,32 @@ | |||
/* $NetBSD: htons.S,v 1.1 1996/04/17 22:36:54 cgd Exp $ */ | |||
|
|||
/* | |||
* Copyright (c) 1996 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. | |||
*/ | |||
|
|||
#define NAME htons | |||
|
|||
#include <libkern/alpha/byte_swap_2.S> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,32 @@ | |||
/* $NetBSD: ntohl.S,v 1.1 1996/04/17 22:36:57 cgd Exp $ */ | |||
|
|||
/* | |||
* Copyright (c) 1996 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. | |||
*/ | |||
|
|||
#define NAME ntohl | |||
|
|||
#include <libkern/alpha/byte_swap_4.S> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,32 @@ | |||
/* $NetBSD: ntohs.S,v 1.1 1996/04/17 22:37:02 cgd Exp $ */ | |||
|
|||
/* | |||
* Copyright (c) 1996 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. | |||
*/ | |||
|
|||
#define NAME ntohs | |||
|
|||
#include <libkern/alpha/byte_swap_2.S> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,56 @@ | |||
/*- | |||
* 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. | |||
* | |||
* $FreeBSD: src/sys/libkern/anddi3.c,v 1.5 1999/08/28 00:46:30 peter Exp $ | |||
*/ | |||
|
|||
#include "quad.h" | |||
|
|||
/* | |||
* Return a & b, in quad. | |||
*/ | |||
quad_t | |||
__anddi3(a, b) | |||
quad_t a, b; | |||
{ | |||
union uu aa, bb; | |||
|
|||
aa.q = a; | |||
bb.q = b; | |||
aa.ul[0] &= bb.ul[0]; | |||
aa.ul[1] &= bb.ul[1]; | |||
return (aa.q); | |||
} |
Oops, something went wrong.