simplify IOPL gain/remove privs code. It's easier with md_regs
being a trapframe.
This commit is contained in:
parent
f756433e8b
commit
36428e6100
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=25552
@ -38,7 +38,7 @@
|
|||||||
*
|
*
|
||||||
* from: Utah $Hdr: mem.c 1.13 89/10/08$
|
* from: Utah $Hdr: mem.c 1.13 89/10/08$
|
||||||
* from: @(#)mem.c 7.2 (Berkeley) 5/9/91
|
* from: @(#)mem.c 7.2 (Berkeley) 5/9/91
|
||||||
* $Id: mem.c,v 1.41 1997/02/22 09:32:33 peter Exp $
|
* $Id: mem.c,v 1.42 1997/04/14 15:54:26 bde Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -145,16 +145,13 @@ mmclose(dev, flags, fmt, p)
|
|||||||
int fmt;
|
int fmt;
|
||||||
struct proc *p;
|
struct proc *p;
|
||||||
{
|
{
|
||||||
struct trapframe *fp;
|
|
||||||
|
|
||||||
switch (minor(dev)) {
|
switch (minor(dev)) {
|
||||||
#ifdef PERFMON
|
#ifdef PERFMON
|
||||||
case 32:
|
case 32:
|
||||||
return perfmon_close(dev, flags, fmt, p);
|
return perfmon_close(dev, flags, fmt, p);
|
||||||
#endif
|
#endif
|
||||||
case 14:
|
case 14:
|
||||||
fp = (struct trapframe *)curproc->p_md.md_regs;
|
curproc->p_md.md_regs->tf_eflags &= ~PSL_IOPL;
|
||||||
fp->tf_eflags &= ~PSL_IOPL;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -170,7 +167,6 @@ mmopen(dev, flags, fmt, p)
|
|||||||
struct proc *p;
|
struct proc *p;
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
struct trapframe *fp;
|
|
||||||
|
|
||||||
switch (minor(dev)) {
|
switch (minor(dev)) {
|
||||||
case 32:
|
case 32:
|
||||||
@ -185,8 +181,7 @@ mmopen(dev, flags, fmt, p)
|
|||||||
return (error);
|
return (error);
|
||||||
if (securelevel > 0)
|
if (securelevel > 0)
|
||||||
return (EPERM);
|
return (EPERM);
|
||||||
fp = (struct trapframe *)curproc->p_md.md_regs;
|
curproc->p_md.md_regs->tf_eflags |= PSL_IOPL;
|
||||||
fp->tf_eflags |= PSL_IOPL;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: syscons.c,v 1.213 1997/04/30 15:31:22 ache Exp $
|
* $Id: syscons.c,v 1.214 1997/05/07 10:42:06 yokota Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sc.h"
|
#include "sc.h"
|
||||||
@ -718,7 +718,6 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
|||||||
int error;
|
int error;
|
||||||
u_int i;
|
u_int i;
|
||||||
struct tty *tp;
|
struct tty *tp;
|
||||||
struct trapframe *fp;
|
|
||||||
scr_stat *scp;
|
scr_stat *scp;
|
||||||
|
|
||||||
tp = scdevtotty(dev);
|
tp = scdevtotty(dev);
|
||||||
@ -1138,13 +1137,11 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
|||||||
return error;
|
return error;
|
||||||
if (securelevel > 0)
|
if (securelevel > 0)
|
||||||
return EPERM;
|
return EPERM;
|
||||||
fp = (struct trapframe *)p->p_md.md_regs;
|
p->p_md.md_regs->tf_eflags |= PSL_IOPL;
|
||||||
fp->tf_eflags |= PSL_IOPL;
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case KDDISABIO: /* disallow io operations (default) */
|
case KDDISABIO: /* disallow io operations (default) */
|
||||||
fp = (struct trapframe *)p->p_md.md_regs;
|
p->p_md.md_regs->tf_eflags &= ~PSL_IOPL;
|
||||||
fp->tf_eflags &= ~PSL_IOPL;
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case KDSETMODE: /* set current mode of this (virtual) console */
|
case KDSETMODE: /* set current mode of this (virtual) console */
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
*
|
*
|
||||||
* from: Utah $Hdr: mem.c 1.13 89/10/08$
|
* from: Utah $Hdr: mem.c 1.13 89/10/08$
|
||||||
* from: @(#)mem.c 7.2 (Berkeley) 5/9/91
|
* from: @(#)mem.c 7.2 (Berkeley) 5/9/91
|
||||||
* $Id: mem.c,v 1.41 1997/02/22 09:32:33 peter Exp $
|
* $Id: mem.c,v 1.42 1997/04/14 15:54:26 bde Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -145,16 +145,13 @@ mmclose(dev, flags, fmt, p)
|
|||||||
int fmt;
|
int fmt;
|
||||||
struct proc *p;
|
struct proc *p;
|
||||||
{
|
{
|
||||||
struct trapframe *fp;
|
|
||||||
|
|
||||||
switch (minor(dev)) {
|
switch (minor(dev)) {
|
||||||
#ifdef PERFMON
|
#ifdef PERFMON
|
||||||
case 32:
|
case 32:
|
||||||
return perfmon_close(dev, flags, fmt, p);
|
return perfmon_close(dev, flags, fmt, p);
|
||||||
#endif
|
#endif
|
||||||
case 14:
|
case 14:
|
||||||
fp = (struct trapframe *)curproc->p_md.md_regs;
|
curproc->p_md.md_regs->tf_eflags &= ~PSL_IOPL;
|
||||||
fp->tf_eflags &= ~PSL_IOPL;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -170,7 +167,6 @@ mmopen(dev, flags, fmt, p)
|
|||||||
struct proc *p;
|
struct proc *p;
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
struct trapframe *fp;
|
|
||||||
|
|
||||||
switch (minor(dev)) {
|
switch (minor(dev)) {
|
||||||
case 32:
|
case 32:
|
||||||
@ -185,8 +181,7 @@ mmopen(dev, flags, fmt, p)
|
|||||||
return (error);
|
return (error);
|
||||||
if (securelevel > 0)
|
if (securelevel > 0)
|
||||||
return (EPERM);
|
return (EPERM);
|
||||||
fp = (struct trapframe *)curproc->p_md.md_regs;
|
curproc->p_md.md_regs->tf_eflags |= PSL_IOPL;
|
||||||
fp->tf_eflags |= PSL_IOPL;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -211,7 +211,6 @@ spigot_ioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
|||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)];
|
struct spigot_softc *ss = (struct spigot_softc *)&spigot_softc[UNIT(dev)];
|
||||||
struct trapframe *fp;
|
|
||||||
struct spigot_info *info;
|
struct spigot_info *info;
|
||||||
|
|
||||||
if(!data) return(EINVAL);
|
if(!data) return(EINVAL);
|
||||||
@ -228,12 +227,10 @@ struct spigot_info *info;
|
|||||||
if (securelevel > 0)
|
if (securelevel > 0)
|
||||||
return EPERM;
|
return EPERM;
|
||||||
#endif
|
#endif
|
||||||
fp=(struct trapframe *)p->p_md.md_regs;
|
p->p_md.md_regs->tf_eflags |= PSL_IOPL;
|
||||||
fp->tf_eflags |= PSL_IOPL;
|
|
||||||
break;
|
break;
|
||||||
case SPIGOT_IOPL_OFF: /* deny access to the IO PAGE */
|
case SPIGOT_IOPL_OFF: /* deny access to the IO PAGE */
|
||||||
fp=(struct trapframe *)p->p_md.md_regs;
|
p->p_md.md_regs->tf_eflags &= ~PSL_IOPL;
|
||||||
fp->tf_eflags &= ~PSL_IOPL;
|
|
||||||
break;
|
break;
|
||||||
case SPIGOT_GET_INFO:
|
case SPIGOT_GET_INFO:
|
||||||
info = (struct spigot_info *)data;
|
info = (struct spigot_info *)data;
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: syscons.c,v 1.213 1997/04/30 15:31:22 ache Exp $
|
* $Id: syscons.c,v 1.214 1997/05/07 10:42:06 yokota Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sc.h"
|
#include "sc.h"
|
||||||
@ -718,7 +718,6 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
|||||||
int error;
|
int error;
|
||||||
u_int i;
|
u_int i;
|
||||||
struct tty *tp;
|
struct tty *tp;
|
||||||
struct trapframe *fp;
|
|
||||||
scr_stat *scp;
|
scr_stat *scp;
|
||||||
|
|
||||||
tp = scdevtotty(dev);
|
tp = scdevtotty(dev);
|
||||||
@ -1138,13 +1137,11 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
|||||||
return error;
|
return error;
|
||||||
if (securelevel > 0)
|
if (securelevel > 0)
|
||||||
return EPERM;
|
return EPERM;
|
||||||
fp = (struct trapframe *)p->p_md.md_regs;
|
p->p_md.md_regs->tf_eflags |= PSL_IOPL;
|
||||||
fp->tf_eflags |= PSL_IOPL;
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case KDDISABIO: /* disallow io operations (default) */
|
case KDDISABIO: /* disallow io operations (default) */
|
||||||
fp = (struct trapframe *)p->p_md.md_regs;
|
p->p_md.md_regs->tf_eflags &= ~PSL_IOPL;
|
||||||
fp->tf_eflags &= ~PSL_IOPL;
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case KDSETMODE: /* set current mode of this (virtual) console */
|
case KDSETMODE: /* set current mode of this (virtual) console */
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: syscons.c,v 1.213 1997/04/30 15:31:22 ache Exp $
|
* $Id: syscons.c,v 1.214 1997/05/07 10:42:06 yokota Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "sc.h"
|
#include "sc.h"
|
||||||
@ -718,7 +718,6 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
|||||||
int error;
|
int error;
|
||||||
u_int i;
|
u_int i;
|
||||||
struct tty *tp;
|
struct tty *tp;
|
||||||
struct trapframe *fp;
|
|
||||||
scr_stat *scp;
|
scr_stat *scp;
|
||||||
|
|
||||||
tp = scdevtotty(dev);
|
tp = scdevtotty(dev);
|
||||||
@ -1138,13 +1137,11 @@ scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p)
|
|||||||
return error;
|
return error;
|
||||||
if (securelevel > 0)
|
if (securelevel > 0)
|
||||||
return EPERM;
|
return EPERM;
|
||||||
fp = (struct trapframe *)p->p_md.md_regs;
|
p->p_md.md_regs->tf_eflags |= PSL_IOPL;
|
||||||
fp->tf_eflags |= PSL_IOPL;
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case KDDISABIO: /* disallow io operations (default) */
|
case KDDISABIO: /* disallow io operations (default) */
|
||||||
fp = (struct trapframe *)p->p_md.md_regs;
|
p->p_md.md_regs->tf_eflags &= ~PSL_IOPL;
|
||||||
fp->tf_eflags &= ~PSL_IOPL;
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case KDSETMODE: /* set current mode of this (virtual) console */
|
case KDSETMODE: /* set current mode of this (virtual) console */
|
||||||
|
Loading…
Reference in New Issue
Block a user