2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
5 Desc: Enable() - Allow interrupts to occur after Disable().
9 #include <exec/execbase.h>
10 #include <aros/libcall.h>
11 #include <aros/atomic.h>
12 #include <proto/kernel.h>
14 #include "exec_intern.h"
16 /*****************************************************************************/
23 #include <proto/exec.h>
25 AROS_LH0(void, Enable
,
28 struct ExecBase
*, SysBase
, 21, Exec
)
31 This function will allow interrupts to occur after they have
32 been disabled by Disable().
34 Note that calls to Disable() nest, and for every call to
35 Disable() you need a matching call to Enable().
39 Using this function is considered very harmful, and it is
40 not recommended to use this function for ** ANY ** reason.
42 It is quite possible to either crash the system, or to prevent
43 normal activities (disk/port i/o) from occuring.
45 Note: As taskswitching is driven by the interrupts subsystem,
46 this function has the side effect of disabling
53 Interrupts will be enabled again when this call returns.
56 This function preserves all registers.
58 To prevent deadlocks calling Wait() in disabled state breaks
59 the disable - thus interrupts may happen again.
62 No you DEFINITATELY don't want to use this function.
65 The only architecture that you can rely on the registers being
66 saved is on the Motorola mc68000 family.
69 Forbid(), Permit(), Disable(), Wait()
73 ******************************************************************************/
79 #ifdef AROS_NO_ATOMIC_OPERATIONS
82 AROS_ATOMIC_DEC(SysBase
->IDNestCnt
);
85 if (KernelBase
&& (SysBase
->IDNestCnt
< 0))
87 D(bug("[Enable] Enabling interrupts\n"));
92 /* The following stuff is not safe to call from within supervisor mode */
97 * There's no dff09c like thing in x86 native which would allow
98 * us to set delayed (mark it as pending but it gets triggered
99 * only once interrupts are enabled again) software interrupt,
100 * so we check it manually here in Enable(), similar to Permit().
102 if (SysBase
->SysFlags
& SFF_SoftInt
)
105 * First we react on SFF_SoftInt by issuing KrnCause() call. This triggers
106 * the complete interrupt processing code in kernel, which implies also
107 * rescheduling if became necessary.
112 if ((SysBase
->TDNestCnt
< 0) && (SysBase
->AttnResched
& ARF_AttnSwitch
))
115 * If SFF_SoftInt hasn't been set, we have a chance that task switching
116 * is enabled and pending. We need to trigger it here in such a case.