The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/i386/include/critical.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2002 Matthew Dillon.  This code is distributed under
    3  * the BSD copyright, /usr/src/COPYRIGHT.
    4  *
    5  * This file contains prototypes and high-level inlines related to
    6  * machine-level critical function support:
    7  *
    8  *      cpu_critical_enter()            - inlined
    9  *      cpu_critical_exit()             - inlined
   10  *      cpu_critical_fork_exit()        - prototyped
   11  *      cpu_thread_link()               - prototyped
   12  *      related support functions residing
   13  *      in <arch>/<arch>/critical.c     - prototyped
   14  *
   15  * $FreeBSD: releng/5.0/sys/i386/include/critical.h 99742 2002-07-10 20:15:58Z dillon $
   16  */
   17 
   18 #ifndef _MACHINE_CRITICAL_H_
   19 #define _MACHINE_CRITICAL_H_
   20 
   21 __BEGIN_DECLS
   22 
   23 /*
   24  * Prototypes - see <arch>/<arch>/critical.c
   25  */
   26 void cpu_unpend(void);
   27 void cpu_critical_fork_exit(void);
   28 void cpu_thread_link(struct thread *td);
   29 
   30 #ifdef  __GNUC__
   31 
   32 /*
   33  *      cpu_critical_enter:
   34  *
   35  *      This routine is called from critical_enter() on the 0->1 transition
   36  *      of td_critnest, prior to it being incremented to 1.
   37  *
   38  *      If new-style critical section handling we do not have to do anything.
   39  *      However, as a side effect any interrupts occuring while td_critnest
   40  *      is non-zero will be deferred.
   41  */
   42 #define cpu_critical_enter()
   43 
   44 /*
   45  *      cpu_critical_exit:
   46  *
   47  *      This routine is called from critical_exit() on a 1->0 transition
   48  *      of td_critnest, after it has been decremented to 0.  We are
   49  *      exiting the last critical section.
   50  *
   51  *      Note that the td->critnest (1->0) transition interrupt race against
   52  *      our int_pending/unpend() check below is handled by the interrupt
   53  *      code for us, so we do not have to do anything fancy.
   54  */
   55 static __inline void
   56 cpu_critical_exit(void)
   57 {
   58         /*
   59          * We may have to schedule pending interrupts.  Create
   60          * conditions similar to an interrupt context and call
   61          * unpend().
   62          *
   63          * note: we do this even if we are in an interrupt
   64          * nesting level.  Deep nesting is protected by
   65          * critical_*() and if we conditionalized it then we
   66          * would have to check int_pending again whenever
   67          * we decrement td_intr_nesting_level to 0.
   68          */
   69         if (PCPU_GET(int_pending))
   70                 cpu_unpend();
   71 }
   72 
   73 #else /* !__GNUC__ */
   74 
   75 void cpu_critical_enter(void)
   76 void cpu_critical_exit(void)
   77 
   78 #endif  /* __GNUC__ */
   79 
   80 __END_DECLS
   81 
   82 #endif /* !_MACHINE_CRITICAL_H_ */
   83 

Cache object: 867dc6d6e726ea4af6ab67d0c00eaa32


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.