grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / exec / disable.c
blobf90e5b3d6912321fb2f2074838ff4ab914cd865a
1 /*
2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Disable() - Stop interrupts from occurring.
6 Lang: english
7 */
9 #define DEBUG 0
11 #include <exec/types.h>
12 #include <exec/execbase.h>
13 #include <aros/libcall.h>
14 #include <aros/atomic.h>
15 #include <proto/kernel.h>
17 #include "exec_intern.h"
19 /*****************************************************************************/
20 #undef Exec
21 #ifdef UseExecstubs
22 # define Exec _Exec
23 #endif
25 /* NAME */
26 #include <proto/exec.h>
28 AROS_LH0(void, Disable,
30 /* LOCATION */
31 struct ExecBase *, SysBase, 20, Exec)
33 /* FUNCTION
34 This function will prevent interrupts from occuring. You can
35 start the interrupts again with a call to Enable().
37 Note that calls to Disable() nest, and for every call to
38 Disable() you need a matching call to Enable().
40 ***** WARNING *****
42 Using this function is considered very harmful, and it is
43 not recommended to use this function for ** ANY ** reason.
45 It is quite possible to either crash the system, or to prevent
46 normal activities (disk/port i/o) from occuring.
48 Note: As taskswitching is driven by the interrupts subsystem,
49 this function has the side effect of disabling
50 multitasking.
52 INPUTS
54 RESULT
55 Interrupts will be disabled AFTER this call returns.
57 NOTES
58 This function preserves all registers.
60 To prevent deadlocks calling Wait() in disabled state breaks
61 the disable - thus interrupts may happen again.
63 EXAMPLE
64 No you DEFINITELY don't want to use this function.
66 BUGS
67 The only architecture that you can rely on the registers being
68 saved is on the Motorola mc68000 family.
70 SEE ALSO
71 Forbid(), Permit(), Enable(), Wait()
73 INTERNALS
74 This function must be replaced in the $(KERNEL) or $(ARCH)
75 directories in order to do some work.
77 ******************************************************************************/
79 #undef Exec
81 AROS_LIBFUNC_INIT
83 D(bug("[Exec] Disable()\n");)
85 if (KernelBase)
86 KrnCli();
88 IDNESTCOUNT_INC;
90 D(bug("[Exec] Disable: IDNESTCOUNT = %d\n", IDNESTCOUNT_GET);)
92 AROS_LIBFUNC_EXIT
93 } /* Disable() */