1 /*
2 * Mach Operating System
3 * Copyright (c) 1991,1990,1989 Carnegie Mellon University
4 * All Rights Reserved.
5 *
6 * Permission to use, copy, modify and distribute this software and its
7 * documentation is hereby granted, provided that both the copyright
8 * notice and this permission notice appear in all copies of the
9 * software, derivative works or modified versions, and any portions
10 * thereof, and that both notices appear in supporting documentation.
11 *
12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
15 *
16 * Carnegie Mellon requests users of this software to return to
17 *
18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
19 * School of Computer Science
20 * Carnegie Mellon University
21 * Pittsburgh PA 15213-3890
22 *
23 * any improvements or extensions that they make and grant Carnegie Mellon
24 * the rights to redistribute these changes.
25 */
26 /*
27 * HISTORY
28 * $Log: dev_master.h,v $
29 * Revision 2.6 91/05/14 15:41:00 mrt
30 * Correcting copyright
31 *
32 * Revision 2.5 91/02/05 17:08:30 mrt
33 * Changed to new Mach copyright
34 * [91/01/31 17:27:25 mrt]
35 *
36 * Revision 2.4 91/01/08 15:09:30 rpd
37 * Added continuation argument to thread_block.
38 * [90/12/08 rpd]
39 *
40 * Revision 2.3 90/10/12 18:07:25 rpd
41 * Fixed calls to thread_bind in io_grab_master and io_release_master.
42 * [90/10/10 rpd]
43 *
44 * Revision 2.2 90/01/11 11:41:48 dbg
45 * Created.
46 * [89/11/27 dbg]
47 *
48 */
49 /*
50 * Author: David B. Golub, Carnegie Mellon University
51 * Date: 11/89
52 *
53 * Bind an IO operation to the master CPU.
54 */
55
56 #include <cpus.h>
57
58 #if NCPUS > 1
59
60 #include <kern/macro_help.h>
61 #include <kern/cpu_number.h>
62 #include <kern/sched_prim.h>
63 #include <kern/thread.h>
64 #include <kern/processor.h>
65
66 #define io_grab_master() \
67 MACRO_BEGIN \
68 thread_bind(current_thread(), master_processor); \
69 if (current_processor() != master_processor) \
70 thread_block((void (*)()) 0); \
71 MACRO_END
72
73 #define io_release_master() \
74 MACRO_BEGIN \
75 thread_bind(current_thread(), PROCESSOR_NULL); \
76 MACRO_END
77
78 #else NCPUS > 1
79
80 #define io_grab_master()
81 #define io_release_master()
82
83 #endif NCPUS > 1
Cache object: 2250d232678ab00143aae725dd17413f
|