summaryrefslogtreecommitdiff
path: root/sys/arch/wgrisc/stand/libsa
diff options
context:
space:
mode:
authorPer Fogelstrom <pefo@cvs.openbsd.org>1997-05-11 16:17:57 +0000
committerPer Fogelstrom <pefo@cvs.openbsd.org>1997-05-11 16:17:57 +0000
commit7ca343aa7ca2c7d3146dd87dd7845b6d261fa505 (patch)
tree701a6a6de8038a80d9d7f880b4a5827a60b30802 /sys/arch/wgrisc/stand/libsa
parent03246f32eb4aa4c396840499bbfb8d22619ab092 (diff)
Boot block for the wgrisc!
Diffstat (limited to 'sys/arch/wgrisc/stand/libsa')
-rw-r--r--sys/arch/wgrisc/stand/libsa/Makefile28
-rw-r--r--sys/arch/wgrisc/stand/libsa/devopen.c28
-rw-r--r--sys/arch/wgrisc/stand/libsa/getenv.c34
-rw-r--r--sys/arch/wgrisc/stand/libsa/gets.c80
4 files changed, 122 insertions, 48 deletions
diff --git a/sys/arch/wgrisc/stand/libsa/Makefile b/sys/arch/wgrisc/stand/libsa/Makefile
index d147171311d..f0ba65b1c51 100644
--- a/sys/arch/wgrisc/stand/libsa/Makefile
+++ b/sys/arch/wgrisc/stand/libsa/Makefile
@@ -1,14 +1,26 @@
-# $NetBSD: Makefile,v 1.5 1995/01/18 06:53:51 mellon Exp $
-# @(#)Makefile 8.2 (Berkeley) 2/16/94
+# $OpenBSD: Makefile,v 1.2 1997/05/11 16:17:55 pefo Exp $
LIB= sa
-SRCS= alloc.c bcopy.c bzero.c close.c dev.c disklabel.c getfile.c \
- getputchar.c ioctl.c lseek.c open.c printf.c read.c ufs.c write.c \
- devopen.c getenv.c gets.c strcat.c strcmp.c strcpy.c strlen.c
-.PATH: ../../../../lib/libsa ../../../../lib/libkern
+S=${.CURDIR}/../../../..
+DIR_SA= $S/lib/libsa
+DIR_KERN=$S/lib/libkern
+
+CFLAGS+=$(SACFLAGS) -D__INTERNAL_LIBSA_CREAD
+CFLAGS+=-DSTART=$(START) -DHEAP_LIMIT=$(HEAP_LIMIT)
+CFLAGS+=${DEBUGFLAGS} -I${.CURDIR} -I${.CURDIR}/..
+CFLAGS+=-I$(S)/lib/libsa -I$(S)
+
+SRCS= alloc.c close.c dev.c disklabel.c dkcksum.c getfile.c ioctl.c \
+ lseek.c open.c printf.c read.c ufs.c write.c devopen.c getenv.c \
+ gets.c memcmp.c memcpy.c memset.c strcat.c strcmp.c strcpy.c strlen.c \
+ strncpy.c
+
+.PATH: ${DIR_SA} ${DIR_KERN}
+
+all: ${SALIB}
+
NOPROFILE=noprofile
+NOPIC=nopic
.include <bsd.lib.mk>
-
-CFLAGS=-O2 -I../../include -I/sys -DSMALL
diff --git a/sys/arch/wgrisc/stand/libsa/devopen.c b/sys/arch/wgrisc/stand/libsa/devopen.c
index 79b35f8f595..32eef0c79cd 100644
--- a/sys/arch/wgrisc/stand/libsa/devopen.c
+++ b/sys/arch/wgrisc/stand/libsa/devopen.c
@@ -44,15 +44,16 @@
* Decode the string 'fname', open the device and return the remaining
* file name if any.
*/
+int
devopen(f, fname, file)
struct open_file *f;
const char *fname;
char **file; /* out */
{
- register char *cp;
- register char *ncp;
- register struct devsw *dp;
- register int c, i;
+ const char *cp;
+ char *ncp;
+ struct devsw *dp;
+ int c, i;
int ctlr = 0, unit = 0, part = 0;
char namebuf[20];
int rc;
@@ -60,7 +61,7 @@ devopen(f, fname, file)
cp = fname;
ncp = namebuf;
- /* expect a string like 'rz(0,0,0)vmunix' */
+ /* expect a string like 'sd(0,0,0)vmunix' */
while ((c = *cp) != '\0') {
if (c == '(') {
cp++;
@@ -97,32 +98,19 @@ devopen(f, fname, file)
cp++;
*ncp = '\0';
-#ifdef SMALL
- if (strcmp (namebuf, "rz")) {
+ if (strcmp (namebuf, "sd")) {
printf ("Unknown device: %s\n", namebuf);
return ENXIO;
}
dp = devsw;
i = 0;
-#else
- for (dp = devsw, i = 0; i < ndevs; dp++, i++)
- if (dp->dv_name && strcmp(namebuf, dp->dv_name) == 0)
- goto fnd;
- printf("Unknown device '%s'\nKnown devices are:", namebuf);
- for (dp = devsw, i = 0; i < ndevs; dp++, i++)
- if (dp->dv_name)
- printf(" %s", dp->dv_name);
- printf("\n");
- return (ENXIO);
-fnd:
-#endif
rc = (dp->dv_open)(f, ctlr, unit, part);
if (rc)
return (rc);
f->f_dev = dp;
if (file && *cp != '\0')
- *file = cp;
+ *file = (char *)cp;
return (0);
}
diff --git a/sys/arch/wgrisc/stand/libsa/getenv.c b/sys/arch/wgrisc/stand/libsa/getenv.c
index 7e063cd4ad5..e1341b47588 100644
--- a/sys/arch/wgrisc/stand/libsa/getenv.c
+++ b/sys/arch/wgrisc/stand/libsa/getenv.c
@@ -1,12 +1,8 @@
-/* $NetBSD: getenv.c,v 1.5 1995/01/18 06:53:55 mellon Exp $ */
+/* $OpenBSD: getenv.c,v 1.2 1997/05/11 16:17:55 pefo Exp $ */
-/*-
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Ralph Campbell.
- *
+/*
+ * Copyright (c) 1997 Per Fogelstrom
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -17,17 +13,16 @@
* 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 product includes software developed under OpenBSD for
+ * Willowglen Services PTE, by Per Fogelstrom, Opsycon AB.
+ * 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 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
+ * 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
@@ -35,11 +30,10 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)getenv.c 8.1 (Berkeley) 6/10/93
*/
-
char *
getenv(s)
char *s;
{
+ return(0);
}
diff --git a/sys/arch/wgrisc/stand/libsa/gets.c b/sys/arch/wgrisc/stand/libsa/gets.c
new file mode 100644
index 00000000000..841dd048915
--- /dev/null
+++ b/sys/arch/wgrisc/stand/libsa/gets.c
@@ -0,0 +1,80 @@
+/* $OpenBSD: gets.c,v 1.1 1997/05/11 16:17:56 pefo Exp $ */
+/* $NetBSD: gets.c,v 1.5.2.1 1995/10/13 19:54:26 pk Exp $ */
+
+/*-
+ * Copyright (c) 1993
+ * 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.
+ *
+ * @(#)gets.c 8.1 (Berkeley) 6/11/93
+ */
+
+#include "stand.h"
+
+void
+gets(buf)
+ char *buf;
+{
+ register int c;
+ register char *lp;
+
+ for (lp = buf;;)
+ switch (c = getchar() & 0177) {
+ case '\n':
+ case '\r':
+ *lp = '\0';
+ return;
+ case '\b':
+ case '\177':
+ if (lp > buf) {
+ lp--;
+ putchar('\b');
+ putchar(' ');
+ putchar('\b');
+ }
+ break;
+ case 'r'&037: {
+ register char *p;
+
+ putchar('\n');
+ for (p = buf; p < lp; ++p)
+ putchar(*p);
+ break;
+ }
+ case 'u'&037:
+ case 'w'&037:
+ lp = buf;
+ putchar('\n');
+ break;
+ default:
+ *lp++ = c;
+ }
+ /*NOTREACHED*/
+}