From 7334cf17bb577ee8e94b257169388358114297a9 Mon Sep 17 00:00:00 2001 From: ad Date: Fri, 29 Dec 2006 19:16:30 +0000 Subject: [PATCH] Enable /dev/io for COMPAT_FREEBSD. --- etc/MAKEDEV.tmpl | 7 ++++++- etc/etc.i386/MAKEDEV.conf | 3 ++- sys/arch/i386/i386/mem.c | 15 ++++++++++++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/etc/MAKEDEV.tmpl b/etc/MAKEDEV.tmpl index 441f753f4303..79053c093b0d 100644 --- a/etc/MAKEDEV.tmpl +++ b/etc/MAKEDEV.tmpl @@ -1,5 +1,5 @@ #!/bin/sh - -# $NetBSD: MAKEDEV.tmpl,v 1.68 2006/12/10 08:14:32 dyoung Exp $ +# $NetBSD: MAKEDEV.tmpl,v 1.69 2006/12/29 19:16:30 ad Exp $ # # Copyright (c) 2003 The NetBSD Foundation, Inc. # All rights reserved. @@ -244,6 +244,7 @@ # hil HP300 HIL input devices # icp ICP-Vortex/Intel RAID control interface # iic* IIC bus device +# io x86 IOPL access for COMPAT_10, COMPAT_FREEBSD # iop* I2O IOP control interface # ipl IP Filter # irframe* IrDA physical frame @@ -1099,6 +1100,10 @@ bktr*) mkdev vbi$unit c %bktr_chr% $(($unit + 32)) 444 ;; +io) + mkdev io c %mem_chr% 14 600 + ;; + iop*) unit=${i#iop} mkdev iop$unit c %iop_chr% $unit diff --git a/etc/etc.i386/MAKEDEV.conf b/etc/etc.i386/MAKEDEV.conf index fd43c60f19cf..734d3a9f50ec 100644 --- a/etc/etc.i386/MAKEDEV.conf +++ b/etc/etc.i386/MAKEDEV.conf @@ -1,4 +1,4 @@ -# $NetBSD: MAKEDEV.conf,v 1.10 2006/07/26 10:31:00 tron Exp $ +# $NetBSD: MAKEDEV.conf,v 1.11 2006/12/29 19:16:30 ad Exp $ # As of 2005-03-15, the "init" case must not create more than 1024 entries. init) @@ -41,6 +41,7 @@ all_md) makedev dmoverio makedev kttcp makedev nsmb + makedev io ;; xen) diff --git a/sys/arch/i386/i386/mem.c b/sys/arch/i386/i386/mem.c index 0257fde83b35..737f00eb7342 100644 --- a/sys/arch/i386/i386/mem.c +++ b/sys/arch/i386/i386/mem.c @@ -1,4 +1,4 @@ -/* $NetBSD: mem.c,v 1.67 2006/11/16 01:32:38 christos Exp $ */ +/* $NetBSD: mem.c,v 1.68 2006/12/29 19:16:30 ad Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -77,9 +77,10 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.67 2006/11/16 01:32:38 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.68 2006/12/29 19:16:30 ad Exp $"); #include "opt_compat_netbsd.h" +#include "opt_compat_freebsd.h" #include #include @@ -89,6 +90,7 @@ __KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.67 2006/11/16 01:32:38 christos Exp $"); #include #include #include +#include #include @@ -117,11 +119,18 @@ mmopen(dev_t dev, int flag, int mode, struct lwp *l) { switch (minor(dev)) { -#ifdef COMPAT_10 +#if defined(COMPAT_10) || defined(COMPAT_FREEBSD) /* This is done by i386_iopl(3) now. */ case DEV_IO: if (flag & FWRITE) { struct trapframe *fp; + int error; + + error = kauth_authorize_machdep(l->l_cred, + KAUTH_MACHDEP_IOPL, NULL, NULL, NULL, NULL); + if (error) + return (error); + fp = curlwp->l_md.md_regs; fp->tf_eflags |= PSL_IOPL; }