xref: /dflybsd-src/sys/dev/drm/include/linux/uaccess.h (revision 01b431220369c70fefc5b0bd891792e306eb88b6)
1*01b43122SFrançois Tigeot /*
2*01b43122SFrançois Tigeot  * Copyright (c) 2015 François Tigeot
3*01b43122SFrançois Tigeot  * All rights reserved.
4*01b43122SFrançois Tigeot  *
5*01b43122SFrançois Tigeot  * Redistribution and use in source and binary forms, with or without
6*01b43122SFrançois Tigeot  * modification, are permitted provided that the following conditions
7*01b43122SFrançois Tigeot  * are met:
8*01b43122SFrançois Tigeot  * 1. Redistributions of source code must retain the above copyright
9*01b43122SFrançois Tigeot  *    notice unmodified, this list of conditions, and the following
10*01b43122SFrançois Tigeot  *    disclaimer.
11*01b43122SFrançois Tigeot  * 2. Redistributions in binary form must reproduce the above copyright
12*01b43122SFrançois Tigeot  *    notice, this list of conditions and the following disclaimer in the
13*01b43122SFrançois Tigeot  *    documentation and/or other materials provided with the distribution.
14*01b43122SFrançois Tigeot  *
15*01b43122SFrançois Tigeot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16*01b43122SFrançois Tigeot  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17*01b43122SFrançois Tigeot  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18*01b43122SFrançois Tigeot  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19*01b43122SFrançois Tigeot  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20*01b43122SFrançois Tigeot  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21*01b43122SFrançois Tigeot  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22*01b43122SFrançois Tigeot  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23*01b43122SFrançois Tigeot  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24*01b43122SFrançois Tigeot  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25*01b43122SFrançois Tigeot  */
26*01b43122SFrançois Tigeot 
27*01b43122SFrançois Tigeot #ifndef _LINUX_UACCESS_H_
28*01b43122SFrançois Tigeot #define _LINUX_UACCESS_H_
29*01b43122SFrançois Tigeot 
pagefault_disable(void)30*01b43122SFrançois Tigeot static inline void pagefault_disable(void)
31*01b43122SFrançois Tigeot {
32*01b43122SFrançois Tigeot 	atomic_set_int(&curthread->td_flags, TDF_NOFAULT);
33*01b43122SFrançois Tigeot }
34*01b43122SFrançois Tigeot 
pagefault_enable(void)35*01b43122SFrançois Tigeot static inline void pagefault_enable(void)
36*01b43122SFrançois Tigeot {
37*01b43122SFrançois Tigeot 	atomic_clear_int(&curthread->td_flags, TDF_NOFAULT);
38*01b43122SFrançois Tigeot }
39*01b43122SFrançois Tigeot 
40*01b43122SFrançois Tigeot #endif	/* _LINUX_UACCESS_H_ */
41