Updated PCI IDs to latest snapshot.
[tangerine.git] / arch / ppc-chrp / exec / permit.c
blobbe55cea5e57445e3c1b0975cafb8a63289a6034e
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Permit() - Allow tasks switches to occur.
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 <aros/debug.h>
14 #include <proto/exec.h>
15 #include <proto/kernel.h>
17 extern void *priv_KernelBase;
19 #undef Exec
20 #ifdef UseExecstubs
21 # define Exec _Exec
22 #endif
24 /* NAME */
26 AROS_LH0(void, Permit,
28 /* LOCATION */
29 struct ExecBase *, SysBase, 23, Exec)
31 /* FUNCTION
32 This function will reactivate the task dispatcher after a call
33 to Forbid(). Note that calls to Forbid() nest, and for every
34 call to Forbid() you need a matching call to Permit().
36 INPUTS
37 None.
39 RESULT
40 Multitasking will be re-enabled.
42 NOTES
43 This function preserves all registers.
45 To prevent deadlocks calling Wait() in forbidden state breaks
46 the forbid - thus taskswitches may happen again.
48 EXAMPLE
49 No you really don't want to use this function.
51 BUGS
52 The only architecture that you can rely on the registers being
53 saved is on the Motorola mc68000 family.
55 SEE ALSO
56 Forbid(), Disable(), Enable(), Wait()
58 INTERNALS
59 If you want to preserve all the registers, replace this function
60 in your $(KERNEL) directory. Otherwise this function is
61 satisfactory.
63 HISTORY
65 ******************************************************************************/
66 #undef Exec
68 AROS_LIBFUNC_INIT
70 void *KernelBase = priv_KernelBase;
73 Task switches are allowed again, if a switch is pending, we
74 should allow it.
77 AROS_ATOMIC_DEC(SysBase->TDNestCnt);
79 if( ( SysBase->TDNestCnt < 0 )
80 && ( SysBase->IDNestCnt < 0 )
81 && ( SysBase->AttnResched & 0x80 ) )
83 /* Haha, you re-enabled multitasking, only to have the rug
84 pulled out from under you feet :)
86 Clear the Switch() pending flag.
89 if (KernelBase && !KrnIsSuper())
90 KrnSchedule();
93 AROS_LIBFUNC_EXIT
94 } /* Permit() */