xref: /minix3/minix/kernel/arch/i386/do_iopenable.c (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc /* The system call implemented in this file:
2*433d6423SLionel Sambuc  *   m_type:	SYS_IOPENABLE
3*433d6423SLionel Sambuc  *
4*433d6423SLionel Sambuc  * The parameters for this system call are:
5*433d6423SLionel Sambuc  *   m_lsys_krn_sys_iopenable.endpt	(process to give I/O Protection Level bits)
6*433d6423SLionel Sambuc  *
7*433d6423SLionel Sambuc  * Author:
8*433d6423SLionel Sambuc  *    Jorrit N. Herder <jnherder@cs.vu.nl>
9*433d6423SLionel Sambuc  */
10*433d6423SLionel Sambuc 
11*433d6423SLionel Sambuc #include "kernel/system.h"
12*433d6423SLionel Sambuc #include "kernel/kernel.h"
13*433d6423SLionel Sambuc #include <minix/endpoint.h>
14*433d6423SLionel Sambuc 
15*433d6423SLionel Sambuc #include "arch_proto.h"
16*433d6423SLionel Sambuc 
17*433d6423SLionel Sambuc /*===========================================================================*
18*433d6423SLionel Sambuc  *			        do_iopenable				     *
19*433d6423SLionel Sambuc  *===========================================================================*/
20*433d6423SLionel Sambuc int do_iopenable(struct proc * caller, message * m_ptr)
21*433d6423SLionel Sambuc {
22*433d6423SLionel Sambuc   int proc_nr;
23*433d6423SLionel Sambuc 
24*433d6423SLionel Sambuc #if 1 /* ENABLE_USERPRIV && ENABLE_USERIOPL */
25*433d6423SLionel Sambuc   if (m_ptr->m_lsys_krn_sys_iopenable.endpt == SELF) {
26*433d6423SLionel Sambuc 	okendpt(caller->p_endpoint, &proc_nr);
27*433d6423SLionel Sambuc   } else if(!isokendpt(m_ptr->m_lsys_krn_sys_iopenable.endpt, &proc_nr))
28*433d6423SLionel Sambuc 	return(EINVAL);
29*433d6423SLionel Sambuc   enable_iop(proc_addr(proc_nr));
30*433d6423SLionel Sambuc   return(OK);
31*433d6423SLionel Sambuc #else
32*433d6423SLionel Sambuc   return(EPERM);
33*433d6423SLionel Sambuc #endif
34*433d6423SLionel Sambuc }
35*433d6423SLionel Sambuc 
36*433d6423SLionel Sambuc 
37