diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2003-02-24 22:30:13 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2003-02-24 22:30:13 +0000 |
commit | 805cfa0f4d2d7efac161ed2d95258737ba4e5482 (patch) | |
tree | 04c2d19482a3087bd62d70bd692907428a74ee78 /lkm | |
parent | adbff043ef6dc9e16a9e66158c84470a7236599d (diff) |
Bye, unused code.
Diffstat (limited to 'lkm')
-rw-r--r-- | lkm/Makefile | 6 | ||||
-rw-r--r-- | lkm/ap/Makefile | 12 | ||||
-rw-r--r-- | lkm/ap/README | 66 | ||||
-rw-r--r-- | lkm/ap/ap.4 | 75 | ||||
-rw-r--r-- | lkm/ap/aperture.c | 84 | ||||
-rw-r--r-- | lkm/ap/apinstall | 18 | ||||
-rw-r--r-- | lkm/ap/aptest/Makefile | 6 | ||||
-rw-r--r-- | lkm/ap/aptest/aptest.c | 122 | ||||
-rw-r--r-- | lkm/ap/lkm.c | 43 | ||||
-rw-r--r-- | lkm/ap/version.c | 8 | ||||
-rw-r--r-- | lkm/ap/version.h | 8 |
11 files changed, 1 insertions, 447 deletions
diff --git a/lkm/Makefile b/lkm/Makefile index 49e80908bae..e2312b4dcf5 100644 --- a/lkm/Makefile +++ b/lkm/Makefile @@ -1,9 +1,5 @@ -# $OpenBSD: Makefile,v 1.4 1999/12/09 00:52:31 deraadt Exp $ +# $OpenBSD: Makefile,v 1.5 2003/02/24 22:30:12 matthieu Exp $ SUBDIR+= -#.if ${MACHINE_ARCH} == "i386" -#SUBDIR+= ap -#.endif - .include <bsd.subdir.mk> diff --git a/lkm/ap/Makefile b/lkm/ap/Makefile deleted file mode 100644 index 6e921ea4d38..00000000000 --- a/lkm/ap/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $OpenBSD: Makefile,v 1.4 1997/01/19 12:29:23 mickey Exp $ - -LKM= ap -SRCS+= aperture.c lkm.c version.c -MAN= ap.4 -MLINKS= ap.4 xf86.4 - -.ifmake !(install) -SUBDIR= aptest -.endif - -.include <bsd.lkm.mk> diff --git a/lkm/ap/README b/lkm/ap/README deleted file mode 100644 index 698960ed669..00000000000 --- a/lkm/ap/README +++ /dev/null @@ -1,66 +0,0 @@ -# $OpenBSD: README,v 1.2 1998/02/03 23:33:51 deraadt Exp $ - - XFree86 Framebuffer aperture driver for OpenBSD. - ----------------------------------------------- - -This module was written to help work around the security feature of -OpenBSD that prevents read/write access to /dev/mem. - -XFree86 can take advantage of having direct access to video -memory (especially with VLB and PCI cards) and even requires it for -the P9000 server. - -This driver works like the standard /dev/mem driver. It just allows -mapping of the VGA framebuffer even if kernel security level is > 0. -The driver only implements the open(), close() and mmap() calls. In -order not to defeat kernel security, only one open() at a time is -allowed and only a process with effective user id of 0 can perform -it. So while you're running XFree86, no other process will be allowed -to open /dev/xf86. - -This work is heavily inspired from the Solaris x86 aperture driver by -Doug Anson (danson@lgc.com) and David Holland (davidh@use.com). - - -Installation: -------------- - -1. Edit the Makefile if you want to modify the default installation - directory. - -2. run make depend && make; then as root, run make install. - -3. add these lines somehere at the end of /etc/rc.local (before the - sysctl that raises the security level): - - KERNDIR=/usr/X11R6/lib/X11/kernel - if [ -f ${KERNDIR}/ap.o ]; then - modload -o ${KERNDIR}/ap -e ap -p ${KERNDIR}/apinstall ${KERNDIR}/ap.o - fi - - to load the driver at bootime. - -4. Reboot your system. - -5. Test the module by running 'aptest' as root. The outpout will look like: - -# ./aptest -NOTICE: VGA mapped [0xa0000 ,size=4096) to addr=0x10073000... - -DONE displaying memory contents (80 bytes) -UNMAPPING [0xa0000 ,size=4096) to addr=0x10073000... and closing...DONE. -Exiting successful... - -6. If you're running XFree86 3.1 or higher, just make sure that - HasOpenBSDApertureDriver is set to YES in xf86site.def before building - your server. The OpenBSD binary distribution has the aperture driver - code enabled. - -Bug reports, comments, suggestions can be sent to matthieu@laas.fr - ---Matthieu Herrb - ----------------------------------------------------------------------- - - Copyright (c) 1994 The XFree86 Project Inc. - diff --git a/lkm/ap/ap.4 b/lkm/ap/ap.4 deleted file mode 100644 index a54cca7099c..00000000000 --- a/lkm/ap/ap.4 +++ /dev/null @@ -1,75 +0,0 @@ -.\" $OpenBSD: ap.4,v 1.2 1999/05/16 19:56:13 alex 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: @(#)mem.4 5.3 (Berkeley) 5/2/91 -.\" from Id: mem.4,v 1.1.1.1 1995/10/18 08:44:29 deraadt Exp -.\" -.Dd Jan 19, 1997 -.Dt AP 4 -.Os -.Sh NAME -.Nm xf86 -.Nd XFree86 Framebuffer aperture driver -.Sh DESCRIPTION -This module was written to help work around the security feature of -the OS that prevents read/write access to /dev/mem. -.Pp -XFree86 can take advantage of having direct access to video -memory (especially with VLB and PCI cards) and even requires it for -the P9000 server. -.Pp -This driver works like the standard -.Nm /dev/mem -driver. It just allows -mapping of the VGA framebuffer even if kernel security level is > 0. -The driver only implements the -.Xr open 2 , -.Xr close 2 , -.Xr mmap 2 -calls. In -order not to defeat kernel security, only one open() at a time is -allowed and only a process with effective user id of 0 can perform -it. So while you're running XFree86, no other process will be allowed -to open -.Nm /dev/xf86 -.Sh FILES -.Bl -tag -width Pa -compact -.It Pa /dev/xf86 -.El -.Sh SEE ALSO -.Xr kmem 4 , -.Xr mem 4 -.Sh HISTORY -This work is heavily inspired from the Solaris x86 aperture driver by -Doug Anson (danson@lgc.com) and David Holland (davidh@use.com). - diff --git a/lkm/ap/aperture.c b/lkm/ap/aperture.c deleted file mode 100644 index 09c56924bc9..00000000000 --- a/lkm/ap/aperture.c +++ /dev/null @@ -1,84 +0,0 @@ -/* $OpenBSD: aperture.c,v 1.5 2000/03/02 01:49:09 todd Exp $ */ - -/* - * Copyright 1994 the XFree86 Project Inc. - */ - -/* - * linear framebuffer aperture driver for OpenBSD - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/proc.h> -#include <sys/errno.h> - -#define VGA_START 0xA0000 -#ifdef PC98 -#define VGA_END 0xFFFFF -#define HOLE16M_START 0xF00000 -#define HOLE16M_END 0xFFFFFF -#else -#define VGA_END 0xBFFFF -#endif - -/* open counter */ -static int ap_open_count = 0; - -/* - * Open the device - */ -int -apopen(dev_t dev, int oflags, int devtype, struct proc *p) -{ - - if (suser(p->p_ucred, &p->p_acflag) != 0) { - return(EPERM); - } - /* authorize only one simultaneous open() */ - if (ap_open_count > 0) { - return(EPERM); - } - ap_open_count++; - - return(0); -} - -/* - * Close the device - */ -int -apclose(dev_t dev, int cflags, int devtype, struct proc *p) -{ - - ap_open_count--; - return(0); -} - -/* - * mmap() physical memory sections - * - * allow only section in the vga framebuffer and above main memory - * to be mapped - */ -int -apmmap(dev_t dev, int offset, int length) -{ - -#ifdef AP_DEBUG - printf("apmmap: addr 0x%x\n", offset); -#endif - if ((minor(dev) == 0) - && ((offset >= VGA_START && offset <= VGA_END ) - || (unsigned)offset > (unsigned)ctob(physmem) -#ifdef PC98 - || ((unsigned)offset >=HOLE16M_START - && (unsigned)offset <= HOLE16M_END) -#endif - )) { - return i386_btop(offset); - } else { - return(-1); - } -} - diff --git a/lkm/ap/apinstall b/lkm/ap/apinstall deleted file mode 100644 index 89d7492af05..00000000000 --- a/lkm/ap/apinstall +++ /dev/null @@ -1,18 +0,0 @@ -#! /bin/sh -# $OpenBSD: apinstall,v 1.3 1998/02/03 23:33:53 deraadt Exp $ -# -# Postinstall script for OpenBSD Aperture Driver -# -# Copyright (C) 1994 The XFree86 Project Inc. -# -if [ $# -ne 3 ]; then - echo "$0: should be called by modload(8) with 3 arguments" - exit 1 -fi - -echo "Major device number: $3" -rm -f /dev/xf86 -mknod /dev/xf86 c $3 0 -chown root.wheel /dev/xf86 -chmod 600 /dev/xf86 -exit 0 diff --git a/lkm/ap/aptest/Makefile b/lkm/ap/aptest/Makefile deleted file mode 100644 index 2b63c0a111c..00000000000 --- a/lkm/ap/aptest/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# $OpenBSD: Makefile,v 1.1 1996/03/05 11:25:42 mickey Exp $ - -PROG= aptest -NOMAN= noman - -.include <bsd.prog.mk> diff --git a/lkm/ap/aptest/aptest.c b/lkm/ap/aptest/aptest.c deleted file mode 100644 index 5dcccfb9d39..00000000000 --- a/lkm/ap/aptest/aptest.c +++ /dev/null @@ -1,122 +0,0 @@ -/* $OpenBSD: aptest.c,v 1.2 1996/12/21 22:23:39 millert Exp $ */ -/* - * Copyright 1994 Doug Anson, danson@lgc.com & David Holland, davidh@use.com - * - * Author: Doug Anson (danson@lgc.com) - * Date : 2/21/94 - * Modifed: David Holland (davidh@use.com) - * Log: - * DWH - Changed names/added comments 2/23/94 - * DWH - Removed annoying delays. 2/23/94 - * - * This program test the fb aperture driver by 'cheating' - * it uses the aperture driver to access/read the main - * system BIOS header - * - * Copyright notice: - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Doug Anson, and David Holland be used in - * advertising or publicity pertaining to distribution of the software - * Doug Anson, and David Holland make no * representations about the - * suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - * - * Disclaimer: - * DOUG ANSON, AND DAVID HOLLAND DISCLAIMS ALL WARRIENTS WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS, - * IN NO EVENT SHALL DOUG ANSON, OR DAVID HOLLAND BE LIABLE FOR ANY SPECIAL, - * INDIRECT, OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM - * USAGE OF THIS SOFTWARE. - */ - -/* - * linear framebuffer aperture driver test program - */ - -/* - * Id - */ - - -#include <stdio.h> -#include <sys/types.h> -#include <sys/mman.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <errno.h> - -#if !defined(sun) -extern void exit(int); -extern caddr_t mmap(); -extern int close(); -extern int munmap(); -#endif - -/* framebuffer access defines */ -#define AP_DEV "/dev/xf86" /* framebuffer apperture device */ -#define PADDR 0xa0000 /* offset from fbmem base */ -#define BUF_LENGTH 0x1000 /* length in bytes -- ignored */ - -/* debug testing defines */ -#define START_INDEX 0 /* display starting index(>=0)*/ -#define STOP_INDEX 80 /* display stopping index */ -#define INCR 1 /* display increment */ - -/* main program */ -int main(int argc,char **argv) -{ - caddr_t addr = (caddr_t)0; - int fb_dev; - long start = START_INDEX; - long stop = STOP_INDEX; - int i; - - /* open the framebuffer device */ - fb_dev = open (AP_DEV,O_RDWR); - if (fb_dev < 0) - { - /* failed to open framebuffer driver */ - printf("ERROR: failed to open %s\n",AP_DEV); - perror("ERROR: open()"); - exit(1); - } - - /* memory map the framebuffer */ - addr = (caddr_t)mmap((caddr_t)0,BUF_LENGTH,PROT_READ|PROT_WRITE,MAP_SHARED, - fb_dev,(off_t)PADDR); - if (addr == (caddr_t)-1) - { - /* failed to memory map framebuffer driver */ - printf("ERROR: failed to mmap [0x%x ,size=%d bytes)\n", - PADDR,BUF_LENGTH); - perror("ERROR: mmap()"); - close(fb_dev); - exit(1); - } - else - { - /* frame buffer mapped */ - close(fb_dev); - printf("NOTICE: BIOS mapped [0x%x ,size=%d) to addr=0x%x...\n", - PADDR,BUF_LENGTH,(int)addr); - - /* display the buffer */ - for(i=start;i<stop;i=i+INCR) - printf("%c",addr[i]); - /* printf("addr[%d]=%c\n",i,addr[i]); - */ - printf("\nDONE displaying memory contents (%ld bytes)\n",stop); - - /* unmap and close */ - printf("UNMAPPING [0x%x ,size=%d) to addr=0x%x... and closing...", - PADDR,BUF_LENGTH,(int)addr); - munmap(addr,BUF_LENGTH); - printf("DONE.\n"); - printf("Exiting successful...\n"); - exit(0); - } - return 1; -} diff --git a/lkm/ap/lkm.c b/lkm/ap/lkm.c deleted file mode 100644 index 7c9e0bd927d..00000000000 --- a/lkm/ap/lkm.c +++ /dev/null @@ -1,43 +0,0 @@ -/* $OpenBSD: lkm.c,v 1.2 1998/01/26 04:55:11 deraadt Exp $ */ -/* - * Copyright (c) 1994 The XFree86 Project Inc. - */ - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/uio.h> -#include <sys/exec.h> -#include <sys/lkm.h> -#include <errno.h> -#include "version.h" - -extern int apopen(dev_t dev, int oflags, int devtype, struct proc *p); -extern int apclose(dev_t dev, int fflags, int devtype, struct proc *p); -extern int apmmap(dev_t dev, int offset, int length); - -static struct cdevsw newdev = { - apopen, apclose, - (dev_type_read((*))) enodev, (dev_type_write((*))) enodev, - (dev_type_ioctl((*))) enodev, - (dev_type_stop((*))) enodev, - 0, seltrue, (dev_type_mmap((*))) apmmap, 0}; - -MOD_DEV("ap", LM_DT_CHAR, -1, &newdev) - -static int -ap_load(struct lkm_table *lkmtp, int cmd) -{ - if (cmd == LKM_E_LOAD) { - printf("Aperture driver for XFree86 version %s.%s\n", - ap_major_version, ap_minor_version); - } - return(0); -} - -int -ap(struct lkm_table *lkmtp, int cmd, int ver) -{ - DISPATCH(lkmtp, cmd, ver, ap_load, lkm_nofunc, lkm_nofunc) -} - diff --git a/lkm/ap/version.c b/lkm/ap/version.c deleted file mode 100644 index 47911d77359..00000000000 --- a/lkm/ap/version.c +++ /dev/null @@ -1,8 +0,0 @@ -/* $OpenBSD: version.c,v 1.3 2000/03/02 01:49:09 todd Exp $ */ -/* - * Loadable Kernel Module for XFree86 Aperture driver - * - * Copyright (c) 1994,1996 The XFree86 Project Inc. - */ -char *ap_major_version = "1"; -char *ap_minor_version = "6"; diff --git a/lkm/ap/version.h b/lkm/ap/version.h deleted file mode 100644 index d71bb41ed3f..00000000000 --- a/lkm/ap/version.h +++ /dev/null @@ -1,8 +0,0 @@ -/* $OpenBSD: version.h,v 1.1 1996/03/05 11:25:38 mickey Exp $ */ -/* - * Loadable Kernel Module for XFree86 Aperture driver - * - * Copyright (c) 1994 Matthieu Herrb - */ -extern char *ap_major_version; -extern char *ap_minor_version; |