xref: /dragonfly/sys/platform/pc64/x86_64/sysarch.c (revision 80d831e1)
1b2b3ffcdSSimon Schubert /*
2b2b3ffcdSSimon Schubert  * Copyright (c) 2006 The DragonFly Project.  All rights reserved.
3b2b3ffcdSSimon Schubert  *
4b2b3ffcdSSimon Schubert  * This code is derived from software contributed to The DragonFly Project
5b2b3ffcdSSimon Schubert  * by Matthew Dillon <dillon@backplane.com>
6b2b3ffcdSSimon Schubert  *
7b2b3ffcdSSimon Schubert  * Redistribution and use in source and binary forms, with or without
8b2b3ffcdSSimon Schubert  * modification, are permitted provided that the following conditions
9b2b3ffcdSSimon Schubert  * are met:
10b2b3ffcdSSimon Schubert  *
11b2b3ffcdSSimon Schubert  * 1. Redistributions of source code must retain the above copyright
12b2b3ffcdSSimon Schubert  *    notice, this list of conditions and the following disclaimer.
13b2b3ffcdSSimon Schubert  * 2. Redistributions in binary form must reproduce the above copyright
14b2b3ffcdSSimon Schubert  *    notice, this list of conditions and the following disclaimer in
15b2b3ffcdSSimon Schubert  *    the documentation and/or other materials provided with the
16b2b3ffcdSSimon Schubert  *    distribution.
17b2b3ffcdSSimon Schubert  * 3. Neither the name of The DragonFly Project nor the names of its
18b2b3ffcdSSimon Schubert  *    contributors may be used to endorse or promote products derived
19b2b3ffcdSSimon Schubert  *    from this software without specific, prior written permission.
20b2b3ffcdSSimon Schubert  *
21b2b3ffcdSSimon Schubert  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22b2b3ffcdSSimon Schubert  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23b2b3ffcdSSimon Schubert  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24b2b3ffcdSSimon Schubert  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
25b2b3ffcdSSimon Schubert  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26b2b3ffcdSSimon Schubert  * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
27b2b3ffcdSSimon Schubert  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28b2b3ffcdSSimon Schubert  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29b2b3ffcdSSimon Schubert  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30b2b3ffcdSSimon Schubert  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31b2b3ffcdSSimon Schubert  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32b2b3ffcdSSimon Schubert  * SUCH DAMAGE.
33b2b3ffcdSSimon Schubert  */
34b2b3ffcdSSimon Schubert #include <sys/types.h>
35b2b3ffcdSSimon Schubert #include <sys/kernel.h>
368467576aSMatthew Dillon #include <sys/param.h>
37b2b3ffcdSSimon Schubert #include <sys/systm.h>
38*80d831e1SMatthew Dillon #include <sys/sysmsg.h>
39b2b3ffcdSSimon Schubert #include <sys/memrange.h>
40b2b3ffcdSSimon Schubert #include <sys/errno.h>
41b2b3ffcdSSimon Schubert #include <sys/proc.h>
42b2b3ffcdSSimon Schubert 
438467576aSMatthew Dillon #include <machine/cpu.h>
448467576aSMatthew Dillon 
45b2b3ffcdSSimon Schubert int
sys_sysarch(struct sysmsg * sysmsg,const struct sysarch_args * uap)46*80d831e1SMatthew Dillon sys_sysarch(struct sysmsg *sysmsg, const struct sysarch_args *uap)
47b2b3ffcdSSimon Schubert {
48b2b3ffcdSSimon Schubert 	return (EOPNOTSUPP);
49b2b3ffcdSSimon Schubert }
50b2b3ffcdSSimon Schubert 
51b2b3ffcdSSimon Schubert int
cpu_set_iopl(void)52b2b3ffcdSSimon Schubert cpu_set_iopl(void)
53b2b3ffcdSSimon Schubert {
54b2b3ffcdSSimon Schubert 	curthread->td_lwp->lwp_md.md_regs->tf_rflags |= PSL_IOPL;
558467576aSMatthew Dillon 	clear_quickret();
56b2b3ffcdSSimon Schubert 	return(0);
57b2b3ffcdSSimon Schubert }
58b2b3ffcdSSimon Schubert 
59b2b3ffcdSSimon Schubert int
cpu_clr_iopl(void)60b2b3ffcdSSimon Schubert cpu_clr_iopl(void)
61b2b3ffcdSSimon Schubert {
62b2b3ffcdSSimon Schubert 	curthread->td_lwp->lwp_md.md_regs->tf_rflags &= ~PSL_IOPL;
638467576aSMatthew Dillon 	clear_quickret();
64b2b3ffcdSSimon Schubert 	return(0);
65b2b3ffcdSSimon Schubert }
66b2b3ffcdSSimon Schubert 
67