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/sqt/mutex.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* 
    2  * Mach Operating System
    3  * Copyright (c) 1991 Carnegie Mellon University
    4  * Copyright (c) 1991 Sequent Computer Systems
    5  * All Rights Reserved.
    6  * 
    7  * Permission to use, copy, modify and distribute this software and its
    8  * documentation is hereby granted, provided that both the copyright
    9  * notice and this permission notice appear in all copies of the
   10  * software, derivative works or modified versions, and any portions
   11  * thereof, and that both notices appear in supporting documentation.
   12  * 
   13  * CARNEGIE MELLON AND SEQUENT COMPUTER SYSTEMS ALLOW FREE USE OF
   14  * THIS SOFTWARE IN ITS "AS IS" CONDITION.  CARNEGIE MELLON AND
   15  * SEQUENT COMPUTER SYSTEMS DISCLAIM ANY LIABILITY OF ANY KIND FOR
   16  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   17  * 
   18  * Carnegie Mellon requests users of this software to return to
   19  * 
   20  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   21  *  School of Computer Science
   22  *  Carnegie Mellon University
   23  *  Pittsburgh PA 15213-3890
   24  * 
   25  * any improvements or extensions that they make and grant Carnegie Mellon 
   26  * the rights to redistribute these changes.
   27  */
   28 
   29 /*
   30  * HISTORY
   31  * $Log:        mutex.h,v $
   32  * Revision 2.3  91/07/31  18:03:14  dbg
   33  *      Changed copyright.
   34  *      [91/07/31            dbg]
   35  * 
   36  * Revision 2.2  91/05/08  12:58:12  dbg
   37  *      Adapted for pure kernel.  Removed gate code, since Symmetry
   38  *      doesn't use it.  Re-implemented Dynix semaphores.
   39  *      [90/09/24            dbg]
   40  * 
   41  */
   42 
   43 /*
   44  * $Header: mutex.h,v 2.3 91/07/31 18:03:14 dbg Exp $
   45  *
   46  * mutex.h
   47  *      Implementation dependent mutual-exclusion interface definitions.
   48  *
   49  * i386 version.
   50  */
   51 
   52 /*
   53  * Revision 1.1  89/07/05  13:15:39  kak
   54  * Initial revision
   55  * 
   56  * Revision 2.25  89/02/27  10:38:58  djg
   57  * increased slic sychrinisation timing to 22Mhz (=12 cycles)
   58  * 
   59  * Revision 2.24  89/02/20  08:02:20  djg
   60  * corrected comments on SLICSYNC timeing and added a missing
   61  * #if MHz=20 ... nop
   62  * 
   63  * Revision 2.23  88/11/10  08:25:17  djg
   64  * bak242 
   65  * 
   66  */
   67 
   68 #ifndef _SQT_MUTEX_H_
   69 #define _SQT_MUTEX_H_
   70 
   71 /*
   72  * i386 does not use gates.  Leave typedef here for compilation.
   73  */
   74 typedef unsigned char   gate_t;         /* gate number */
   75 
   76 /*
   77  * Use Mach simple_lock_data_t instead of Dynix lock_t.
   78  */
   79 #include <kern/lock.h>
   80 
   81 /*
   82  * Semaphores.
   83  * Very simple mono-processor implementation.  See sqt/sema.c.
   84  *
   85  * These semaphores assume non-signalable sleep priorities, initial value
   86  * == 0 or 1.  Implements "random" queueing.
   87  *
   88  * This is sufficient for (eg) zd driver, sm, misc others.  Anything
   89  * more fancy need to be done in driver itself.
   90  */
   91 
   92 struct sema {
   93         char            lock;
   94         char            waiting;
   95         short           count;
   96 };
   97 typedef struct sema     sema_t;
   98 
   99 /*
  100  * Processor interrupt masking (lowest level mutex).
  101  */
  102 
  103 #if     !defined(GENASSYM) && !defined(lint)
  104 
  105 #define DISABLE() \
  106         asm volatile("cli")
  107 
  108 #define ENABLE() \
  109         asm volatile("sti")
  110 
  111 #endif  !defined(GENASSYM) && !defined(lint)
  112 
  113 /*
  114  * Locks.
  115  *
  116  * init_lock() interface provided as a macro to avoid need to represent
  117  * SLIC gates numbers.
  118  */
  119 
  120 #define L_UNLOCKED      0
  121 #define L_LOCKED        1
  122 
  123 #define CPLOCKFAIL      -1              /* illegal SPL value */
  124 
  125 #define init_lock(l,g)  simple_lock_init(l)
  126 
  127 #define v_lock(l,p)     (simple_unlock(l), splx(p))
  128 
  129 #endif  _SQT_MUTEX_H_

Cache object: 85d7003a9b92632c891214cf647f9a0f


[ 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.