Enable /dev/io for COMPAT_FREEBSD.

This commit is contained in:
ad 2006-12-29 19:16:30 +00:00
parent 4798cd2cab
commit 7334cf17bb
3 changed files with 20 additions and 5 deletions

View File

@ -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

View File

@ -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)

View File

@ -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 <sys/cdefs.h>
__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 <sys/param.h>
#include <sys/buf.h>
@ -89,6 +90,7 @@ __KERNEL_RCSID(0, "$NetBSD: mem.c,v 1.67 2006/11/16 01:32:38 christos Exp $");
#include <sys/proc.h>
#include <sys/fcntl.h>
#include <sys/conf.h>
#include <sys/kauth.h>
#include <machine/cpu.h>
@ -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;
}