Deleted Added
full compact
io.c (202097) io.c (207329)
1/*-
2 * Copyright (c) 2004 Mark R V Murray
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2004 Mark R V Murray
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/amd64/amd64/io.c 202097 2010-01-11 18:10:13Z marcel $");
28__FBSDID("$FreeBSD: head/sys/amd64/amd64/io.c 207329 2010-04-28 15:38:01Z attilio $");
29
30#include <sys/param.h>
29
30#include <sys/param.h>
31#include <sys/conf.h>
32#include <sys/fcntl.h>
33#include <sys/lock.h>
34#include <sys/malloc.h>
35#include <sys/mutex.h>
36#include <sys/priv.h>
37#include <sys/proc.h>
31#include <sys/proc.h>
38#include <sys/signalvar.h>
39#include <sys/systm.h>
40
32
41#include <machine/db_machdep.h>
42#include <machine/frame.h>
33#include <machine/frame.h>
34#include <machine/iodev.h>
43#include <machine/psl.h>
35#include <machine/psl.h>
44#include <machine/specialreg.h>
45
36
46#include <vm/vm.h>
47#include <vm/pmap.h>
48
49#include <machine/iodev.h>
50
51/* ARGSUSED */
52int
37int
53ioopen(struct cdev *dev __unused, int flags __unused, int fmt __unused,
54 struct thread *td)
38iodev_open(struct thread *td)
55{
39{
56 int error;
57
40
58 error = priv_check(td, PRIV_IO);
59 if (error != 0)
60 return (error);
61 error = securelevel_gt(td->td_ucred, 0);
62 if (error != 0)
63 return (error);
64
65 td->td_frame->tf_rflags |= PSL_IOPL;
41 td->td_frame->tf_rflags |= PSL_IOPL;
66
67 return (0);
68}
69
42 return (0);
43}
44
70/* ARGSUSED */
71int
45int
72ioclose(struct cdev *dev __unused, int flags __unused, int fmt __unused,
73 struct thread *td)
46iodev_close(struct thread *td)
74{
47{
75 td->td_frame->tf_rflags &= ~PSL_IOPL;
76
48
49 td->td_frame->tf_rflags &= ~PSL_IOPL;
77 return (0);
78}
79
80/* ARGSUSED */
81int
50 return (0);
51}
52
53/* ARGSUSED */
54int
82ioioctl(struct cdev *dev __unused, u_long cmd __unused, caddr_t data __unused,
83 int fflag __unused, struct thread *td __unused)
55iodev_ioctl(u_long cmd __unused, caddr_t data __unused)
84{
85
56{
57
86 return (ENXIO);
58 return (ENOIOCTL);
87}
59}