added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / arch / .unmaintained / m68k-native / exec / disable.s
blobf183cef6d5c64e8ec0c071ac3f09940352cd038e
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 /*****************************************************************************
8 NAME
10 AROS_LH0(void, Disable,
12 LOCATION
13 struct ExecBase *, SysBase, 20, Exec)
15 FUNCTION
16 This function disables the delivery of all interrupts until a matching
17 call to Enable() is done. This implies a Forbid(). Since the system
18 needs the regular delivery of all interrupts it is forbidden to disable
19 them for longer than ~250 microseconds.
21 THIS CALL IS VERY DANGEROUS!!!
23 Do not use it without thinking very well about it or better do not use
24 it at all. Most of the time you can live without it by using semaphores
25 or similar.
27 Calls to Disable() nest, i.e. for each call to Disable() you need one
28 call to Enable().
30 INPUTS
32 RESULT
34 NOTES
35 This function preserves all registers.
37 This function may be used from interrupts to disable all higher
38 priority interrupts. Lower priority interrupts are disabled anyway.
40 To prevent deadlocks calling Wait() in disabled state breaks the
41 disable - thus interrupts and taskswitches may happen again.
43 EXAMPLE
45 BUGS
47 SEE ALSO
48 Forbid(), Permit(), Enable(), Wait()
50 INTERNALS
51 For old exec Disable() there exists an assembler macro replacement
52 that is (of course) unportable. Using a Disable() implementation
53 equal to this macro would not only have some impact on Disable()
54 itself but also on other functions (e.g. Signal()).
55 Therefore I decided to drop support for this macro to a certain
56 extent. The difference is only minuscule:
57 If a task uses the assembler macro and activates some higher priority
58 task he cannot expect this task to be awakened immediately at Enable()
59 but only at the next context switch. But I do not think that this
60 poses any problems.
62 HISTORY
64 ******************************************************************************/
66 INTENA = 0xdff09a
67 INTEN = 0x4000
68 SET = 0x8000
70 #include "machine.i"
72 .text
73 .balign 4
74 .globl AROS_SLIB_ENTRY(Disable,Exec)
75 .type AROS_SLIB_ENTRY(Disable,Exec),@function
76 AROS_SLIB_ENTRY(Disable,Exec):
77 /* disable interrupts */
78 move.w #INTEN,INTENA
80 /* increment nesting count and return */
81 addq.b #1,IDNestCnt(a6)
82 rts