use the locations specified in the bcm2708_boot header
[AROS.git] / rom / exec / enable.c
blob53662e7c89ca6772611705e32adcc298a64b94b8
1 /*
2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Enable() - Allow interrupts to occur after Disable().
6 Lang: english
7 */
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 /*****************************************************************************/
17 #undef Exec
18 #ifdef UseExecstubs
19 # define Exec _Exec
20 #endif
22 /* NAME */
23 #include <proto/exec.h>
25 AROS_LH0(void, Enable,
27 /* LOCATION */
28 struct ExecBase *, SysBase, 21, Exec)
30 /* FUNCTION
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().
37 ***** WARNING *****
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
47 multitasking.
49 INPUTS
50 None.
52 RESULT
53 Interrupts will be enabled again when 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 DEFINITATELY 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(), Disable(), Wait()
71 INTERNALS
73 ******************************************************************************/
75 #undef Exec
77 AROS_LIBFUNC_INIT
79 #ifdef AROS_NO_ATOMIC_OPERATIONS
80 SysBase->IDNestCnt--;
81 #else
82 AROS_ATOMIC_DEC(SysBase->IDNestCnt);
83 #endif
85 if (KernelBase && (SysBase->IDNestCnt < 0))
87 D(bug("[Enable] Enabling interrupts\n"));
88 KrnSti();
90 if (KrnIsSuper())
92 /* The following stuff is not safe to call from within supervisor mode */
93 return;
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.
109 KrnCause();
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.
118 KrnSchedule();
122 AROS_LIBFUNC_EXIT
123 } /* Enable() */