show more relevant debug
[AROS.git] / rom / exec / disable.c
blobea22576c631648ecdec588703a0ff0cf2cf7e6fb
1 /*
2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Disable() - Stop interrupts from occurring.
6 Lang: english
7 */
9 #include <exec/types.h>
10 #include <exec/execbase.h>
11 #include <aros/libcall.h>
12 #include <aros/atomic.h>
14 #include "exec_intern.h"
16 /*****************************************************************************/
17 #undef Exec
18 #ifdef UseExecstubs
19 # define Exec _Exec
20 #endif
22 /* NAME */
23 #include <proto/exec.h>
25 AROS_LH0(void, Disable,
27 /* LOCATION */
28 struct ExecBase *, SysBase, 20, Exec)
30 /* FUNCTION
31 This function will prevent interrupts from occuring (*). You can
32 start the interrupts again with a call to Enable().
34 Note that calls to Disable() nest, and for every call to
35 Disable() you need a matching call to Enable().
37 ***** WARNING *****
39 Using this function is considered very harmful, and it should only
40 ever be used to protect data that could also be accessed in interrupts.
42 It is quite possible to either crash the system, or to prevent
43 normal activities (disk/port i/o) from occuring.
45 INPUTS
47 RESULT
48 Interrupts will be disabled AFTER this call returns.
50 NOTES
51 This function preserves all registers.
53 To prevent deadlocks calling Wait() in disabled state breaks
54 the disable - thus interrupts may happen again.
56 As the schedulers pre-emption is interrupt driven,
57 this function has the side effect of disabling
58 multitasking.
60 (*) On EXECSMP builds, Disable() only aplies to the processor
61 it is called from (and needs to be re-enabled there also)
62 Data which needs to be protected from parallel access will
63 also require a spinlock.
65 EXAMPLE
66 In most userspace code, you will not want to use this function.
68 BUGS
69 The only architecture that you can rely on the registers being
70 saved is on the Motorola mc68000 family.
72 SEE ALSO
73 Forbid(), Permit(), Enable(), Wait()
75 INTERNALS
76 This function must be replaced in the $(KERNEL) or $(ARCH)
77 directories in order to do some work.
79 ******************************************************************************/
81 #undef Exec
83 AROS_LIBFUNC_INIT
85 D(bug("[Exec] Disable()\n");)
87 if (KernelBase)
88 KrnCli();
90 IDNESTCOUNT_INC;
92 D(bug("[Exec] Disable: IDNESTCOUNT = %d\n", IDNESTCOUNT_GET);)
94 AROS_LIBFUNC_EXIT
95 } /* Disable() */