Skip to content

Commit

Permalink
Init.
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoffrey Challen committed Jan 24, 2012
0 parents commit 82b65d2
Show file tree
Hide file tree
Showing 607 changed files with 61,985 additions and 0 deletions.
424 changes: 424 additions & 0 deletions CHANGES

Large diffs are not rendered by default.

71 changes: 71 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#
# Toplevel makefile for OS/161.
#
#
# Main rules:
# all (default): depend and compile system; install into staging area
# rebuild: likewise, but start with a clean slate.
# fullrebuild: likewise, but start with a very clean slate.
#
# What all does, in order:
# tools: depend and compile the tools used in build.
# includes: install header files.
# build: depend and compile the system.
#
# Other targets:
# depend: just update make dependency information.
# tags: generate/regenerate "tags" files.
# install: install into $(OSTREE).
# clean: remove generated files.
# distclean: remove all generated files.
#

TOP=.
.include "$(TOP)/mk/os161.config.mk"

all:; # make this first

MKDIRS=$(OSTREE)

.include "$(TOP)/mk/os161.mkdirs.mk"

all: tools .WAIT includes .WAIT build

rebuild:
$(MAKE) clean
$(MAKE) all

fullrebuild:
$(MAKE) distclean
$(MAKE) all

# currently no tools required, hence no tools/ dir or work to do
tools:
@true

build:
(cd user && $(MAKE) build)
(cd man && $(MAKE) install-staging)

includes tags depend:
(cd kern && $(MAKE) $@)
(cd user && $(MAKE) $@)

clean:
(cd kern && $(MAKE) $@)
(cd user && $(MAKE) $@)
rm -rf $(INSTALLTOP)

distclean: clean
rm -rf $(WORKDIR)

install: $(OSTREE)
(cd $(INSTALLTOP) && tar -cf - .) | (cd $(OSTREE) && tar -xvf -)


.PHONY: all rebuild fullrebuild tools build includes tags depend
.PHONY: clean distclean

# old BSD name, same as distclean
cleandir: distclean
.PHONY: cleandir
7 changes: 7 additions & 0 deletions common/gcc-millicode/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
These are support functions needed by gcc to perform operations on
64-bit integer types on 32-bit machines. The names are meaningful to
the gcc back end. The term "millicode" is sometimes used to describe
such compiler support code.

This code was taken from NetBSD's src/common/lib/libc/quad, and
polished some for OS/161.
56 changes: 56 additions & 0 deletions common/gcc-millicode/adddi3.c
Original file line number 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. 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:
* @(#)adddi3.c 8.1 (Berkeley) 6/4/93
* NetBSD: adddi3.c,v 1.1 2005/12/20 19:28:51 christos Exp
*/

#include "longlong.h"

/*
* Add two long longs. This is trivial since a one-bit carry from a
* single unsigned int 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).
*/
long long
__adddi3(long long a, long long b)
{
union uu aa, bb, sum;

aa.ll = a;
bb.ll = b;
sum.ui[L] = aa.ui[L] + bb.ui[L];
sum.ui[H] = aa.ui[H] + bb.ui[H] + (sum.ui[L] < bb.ui[L]);
return (sum.ll);
}
53 changes: 53 additions & 0 deletions common/gcc-millicode/anddi3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*-
* 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. 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:
* @(#)anddi3.c 8.1 (Berkeley) 6/4/93
* NetBSD: anddi3.c,v 1.1 2005/12/20 19:28:51 christos Exp
*/

#include "longlong.h"

/*
* Return a & b, in long long.
*/
long long
__anddi3(long long a, long long b)
{
union uu aa, bb;

aa.ll = a;
bb.ll = b;
aa.ui[0] &= bb.ui[0];
aa.ui[1] &= bb.ui[1];
return (aa.ll);
}
61 changes: 61 additions & 0 deletions common/gcc-millicode/ashldi3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/*-
* 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. 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:
* @(#)ashldi3.c 8.1 (Berkeley) 6/4/93
* NetBSD: ashldi3.c,v 1.1 2005/12/20 19:28:51 christos Exp
*/

#include "longlong.h"

/*
* Shift a (signed) long long value left (arithmetic shift left).
* This is the same as logical shift left!
*/
long long
__ashldi3(long long a, unsigned int shift)
{
union uu aa;

if (shift == 0)
return(a);
aa.ll = a;
if (shift >= INT_BITS) {
aa.ui[H] = aa.ui[L] << (shift - INT_BITS);
aa.ui[L] = 0;
} else {
aa.ui[H] = (aa.ui[H] << shift) |
(aa.ui[L] >> (INT_BITS - shift));
aa.ui[L] <<= shift;
}
return (aa.ll);
}
73 changes: 73 additions & 0 deletions common/gcc-millicode/ashrdi3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*-
* 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. 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:
* @(#)ashrdi3.c 8.1 (Berkeley) 6/4/93
* NetBSD: ashrdi3.c,v 1.1 2005/12/20 19:28:51 christos Exp
*/

#include "longlong.h"

/*
* Shift a (signed) long long value right (arithmetic shift right).
*/
long long
__ashrdi3(long long a, unsigned int shift)
{
union uu aa;

if (shift == 0)
return(a);
aa.ll = a;
if (shift >= INT_BITS) {
int s;

/*
* Smear bits rightward using the machine's right-shift
* method, whether that is sign extension or zero fill,
* to get the `sign word' s. Note that shifting by
* INT_BITS is undefined, so we shift (INT_BITS-1),
* then 1 more, to get our answer.
*/
/* LINTED inherits machine dependency */
s = (aa.si[H] >> (INT_BITS - 1)) >> 1;
/* LINTED inherits machine dependency*/
aa.ui[L] = aa.si[H] >> (shift - INT_BITS);
aa.ui[H] = s;
} else {
aa.ui[L] = (aa.ui[L] >> shift) |
(aa.ui[H] << (INT_BITS - shift));
/* LINTED inherits machine dependency */
aa.si[H] >>= shift;
}
return (aa.ll);
}
54 changes: 54 additions & 0 deletions common/gcc-millicode/cmpdi2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*-
* 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. 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:
* @(#)cmpdi2.c 8.1 (Berkeley) 6/4/93
* NetBSD: cmpdi2.c,v 1.1 2005/12/20 19:28:51 christos Exp
*/

#include "longlong.h"

/*
* Return 0, 1, or 2 as a <, =, > b respectively.
* Both a and b are considered signed---which means only the high word is
* signed.
*/
int
__cmpdi2(long long a, long long b)
{
union uu aa, bb;

aa.ll = a;
bb.ll = b;
return (aa.si[H] < bb.si[H] ? 0 : aa.si[H] > bb.si[H] ? 2 :
aa.ui[L] < bb.ui[L] ? 0 : aa.ui[L] > bb.ui[L] ? 2 : 1);
}
Loading

0 comments on commit 82b65d2

Please sign in to comment.