2 Copyright © 1995-2015, The AROS Development Team. All rights reserved.
5 Desc: Enable() - Allow interrupts to occur after Disable().
11 #include <exec/execbase.h>
12 #include <aros/libcall.h>
13 #include <aros/atomic.h>
14 #include <proto/kernel.h>
16 #include "exec_intern.h"
18 /*****************************************************************************/
25 #include <proto/exec.h>
27 AROS_LH0(void, Enable
,
30 struct ExecBase
*, SysBase
, 21, Exec
)
33 This function will allow interrupts to occur after they have
34 been disabled by Disable().
36 Note that calls to Disable() nest, and for every call to
37 Disable() you need a matching call to Enable().
41 Using this function is considered very harmful, and it is
42 not recommended to use this function for ** ANY ** reason.
44 It is quite possible to either crash the system, or to prevent
45 normal activities (disk/port i/o) from occuring.
47 Note: As taskswitching is driven by the interrupts subsystem,
48 this function has the side effect of disabling
55 Interrupts will be enabled again when this call returns.
58 This function preserves all registers.
60 To prevent deadlocks calling Wait() in disabled state breaks
61 the disable - thus interrupts may happen again.
64 No you DEFINITATELY don't want to use this function.
67 The only architecture that you can rely on the registers being
68 saved is on the Motorola mc68000 family.
71 Forbid(), Permit(), Disable(), Wait()
75 ******************************************************************************/
81 D(bug("[Exec] Enable()\n");)
85 D(bug("[Exec] Enable: IDNESTCOUNT = %d\n", IDNESTCOUNT_GET
);)
89 if (IDNESTCOUNT_GET
< 0)
91 D(bug("[Exec] Enable: Enabling interrupts\n");)
95 /* The following stuff is not safe to call from within supervisor mode */
99 * There's no dff09c like thing in x86 native which would allow
100 * us to set delayed (mark it as pending but it gets triggered
101 * only once interrupts are enabled again) software interrupt,
102 * so we check it manually here in Enable(), similar to Permit().
104 if (SysBase
->SysFlags
& SFF_SoftInt
)
107 * First we react on SFF_SoftInt by issuing KrnCause() call. This triggers
108 * the complete interrupt processing code in kernel, which implies also
109 * rescheduling if became necessary.
111 D(bug("[Exec] Enable: causing softints\n");)
115 if ((TDNESTCOUNT_GET
< 0) && FLAG_SCHEDSWITCH_ISSET
)
118 * If SFF_SoftInt hasn't been set, we have a chance that task switching
119 * is enabled and pending. We need to trigger it here in such a case.
121 D(bug("[Exec] Enable: rescheduling\n");)