Updated PCI IDs to latest snapshot.
[tangerine.git] / arch / i386-pc / exec / permit.c
blobf06a7d77b8c1145237f806a5b402cdf1bddad56b
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 <asm/segments.h>
15 #include <proto/exec.h>
17 void Exec_Permit_Supervisor();
19 /*****************************************************************************/
20 #undef Exec
21 #ifdef UseExecstubs
22 # define Exec _Exec
23 #endif
25 /* NAME */
27 AROS_LH0(void, Permit,
29 /* LOCATION */
30 struct ExecBase *, SysBase, 23, Exec)
32 /* FUNCTION
33 This function will reactivate the task dispatcher after a call
34 to Forbid(). Note that calls to Forbid() nest, and for every
35 call to Forbid() you need a matching call to Permit().
37 INPUTS
38 None.
40 RESULT
41 Multitasking will be re-enabled.
43 NOTES
44 This function preserves all registers.
46 To prevent deadlocks calling Wait() in forbidden state breaks
47 the forbid - thus taskswitches may happen again.
49 EXAMPLE
50 No you really don't want to use this function.
52 BUGS
53 The only architecture that you can rely on the registers being
54 saved is on the Motorola mc68000 family.
56 SEE ALSO
57 Forbid(), Disable(), Enable(), Wait()
59 INTERNALS
60 If you want to preserve all the registers, replace this function
61 in your $(KERNEL) directory. Otherwise this function is
62 satisfactory.
64 HISTORY
66 ******************************************************************************/
67 #undef Exec
69 AROS_LIBFUNC_INIT
72 Task switches are allowed again, if a switch is pending, we
73 should allow it.
76 AROS_ATOMIC_DEC(SysBase->TDNestCnt);
78 if( ( SysBase->TDNestCnt < 0 )
79 && ( SysBase->IDNestCnt < 0 )
80 && ( SysBase->AttnResched & 0x80 ) )
82 /* Haha, you re-enabled multitasking, only to have the rug
83 pulled out from under you feet :)
85 Clear the Switch() pending flag.
88 if (IN_USER_MODE) Supervisor(Exec_Permit_Supervisor);
91 AROS_LIBFUNC_EXIT
92 } /* Permit() */