graphics.library: MakeVPort() RastInfo based double-buffering fixes
[AROS.git] / rom / exec / disable.c
blob281354fa21802dad3b7955f819ce56aab4dc4dcd
1 /*
2 Copyright © 1995-2010, 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>
13 #include <proto/kernel.h>
15 #include "exec_intern.h"
17 /*****************************************************************************/
18 #undef Exec
19 #ifdef UseExecstubs
20 # define Exec _Exec
21 #endif
23 /* NAME */
24 #include <proto/exec.h>
26 AROS_LH0(void, Disable,
28 /* LOCATION */
29 struct ExecBase *, SysBase, 20, Exec)
31 /* FUNCTION
32 This function will prevent interrupts from occuring. You can
33 start the interrupts again with a call to Enable().
35 Note that calls to Disable() nest, and for every call to
36 Disable() you need a matching call to Enable().
38 ***** WARNING *****
40 Using this function is considered very harmful, and it is
41 not recommended to use this function for ** ANY ** reason.
43 It is quite possible to either crash the system, or to prevent
44 normal activities (disk/port i/o) from occuring.
46 Note: As taskswitching is driven by the interrupts subsystem,
47 this function has the side effect of disabling
48 multitasking.
50 INPUTS
52 RESULT
53 Interrupts will be disabled AFTER this call returns.
55 NOTES
56 This function preserves all registers.
58 To prevent deadlocks calling Wait() in disabled state breaks
59 the disable - thus interrupts may happen again.
61 EXAMPLE
62 No you DEFINITELY don't want to use this function.
64 BUGS
65 The only architecture that you can rely on the registers being
66 saved is on the Motorola mc68000 family.
68 SEE ALSO
69 Forbid(), Permit(), Enable(), Wait()
71 INTERNALS
72 This function must be replaced in the $(KERNEL) or $(ARCH)
73 directories in order to do some work.
75 ******************************************************************************/
77 #undef Exec
79 AROS_LIBFUNC_INIT
81 if (KernelBase)
82 KrnCli();
84 #ifdef AROS_NO_ATOMIC_OPERATIONS
85 /* Generic atomic operations in aros/atomic.h rely on Disable()/Enable() themselves,
86 so we have to take care about it here. Otherwise we fall into endless loop.
87 It is strongly recommended to implement real atomic operations in assembler.
88 The same is done in Enable() */
89 SysBase->IDNestCnt++;
90 #else
91 AROS_ATOMIC_INC(SysBase->IDNestCnt);
92 #endif
94 AROS_LIBFUNC_EXIT
95 } /* Disable() */