1237ffc69SFrançois Tigeot /* 2056b029cSFrançois Tigeot * Copyright (c) 2019-2020 François Tigeot <ftigeot@wolfpond.org> 3237ffc69SFrançois Tigeot * All rights reserved. 4237ffc69SFrançois Tigeot * 5237ffc69SFrançois Tigeot * Redistribution and use in source and binary forms, with or without 6237ffc69SFrançois Tigeot * modification, are permitted provided that the following conditions 7237ffc69SFrançois Tigeot * are met: 8237ffc69SFrançois Tigeot * 1. Redistributions of source code must retain the above copyright 9237ffc69SFrançois Tigeot * notice unmodified, this list of conditions, and the following 10237ffc69SFrançois Tigeot * disclaimer. 11237ffc69SFrançois Tigeot * 2. Redistributions in binary form must reproduce the above copyright 12237ffc69SFrançois Tigeot * notice, this list of conditions and the following disclaimer in the 13237ffc69SFrançois Tigeot * documentation and/or other materials provided with the distribution. 14237ffc69SFrançois Tigeot * 15237ffc69SFrançois Tigeot * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16237ffc69SFrançois Tigeot * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17237ffc69SFrançois Tigeot * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18237ffc69SFrançois Tigeot * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19237ffc69SFrançois Tigeot * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20237ffc69SFrançois Tigeot * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21237ffc69SFrançois Tigeot * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22237ffc69SFrançois Tigeot * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23237ffc69SFrançois Tigeot * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24237ffc69SFrançois Tigeot * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25237ffc69SFrançois Tigeot */ 26237ffc69SFrançois Tigeot 27237ffc69SFrançois Tigeot #ifndef _LINUX_PREEMPT_H_ 28237ffc69SFrançois Tigeot #define _LINUX_PREEMPT_H_ 29237ffc69SFrançois Tigeot 30056b029cSFrançois Tigeot #include <linux/linkage.h> 31237ffc69SFrançois Tigeot #include <linux/list.h> 32237ffc69SFrançois Tigeot 33237ffc69SFrançois Tigeot #define preempt_disable() cpu_ccfence() 34237ffc69SFrançois Tigeot 35237ffc69SFrançois Tigeot #define preempt_enable() cpu_ccfence() 36237ffc69SFrançois Tigeot 37056b029cSFrançois Tigeot #define in_atomic() (curthread->td_flags & TDF_NOFAULT) 38056b029cSFrançois Tigeot 39*78973132SSergey Zigachev #define in_task() (curthread->td_pri >= TDPRI_SOFT_NORM) 40*78973132SSergey Zigachev 41237ffc69SFrançois Tigeot #endif /* _LINUX_PREEMPT_H_ */ 42