revert between 56095 -> 55830 in arch
[AROS.git] / arch / .unmaintained / ppc-native / exec / disable.s
blob2f8989a5a1e9af34cde2ece3db51c87b12ce770b
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 This is literal rewrite of MC68000 version plus code to clear
52 EE bit in MSR
54 HISTORY
56 ******************************************************************************/
58 INTENA = 0xdff09a
59 INTEN = 0x4000
60 SET = 0x8000
62 #include "machine.i"
64 .text
65 .balign 4
66 .globl AROS_SLIB_ENTRY(Disable,Exec)
67 .type AROS_SLIB_ENTRY(Disable,Exec),@function
68 AROS_SLIB_ENTRY(Disable,Exec):
69 subr
70 push scr
72 /* disable amiga chipset interrupts */
73 li scr,INTEN
74 stw scr,INTENA
75 /* disable external interrupts in PPC, must be executed in supervisor */
76 lwz arg0,_disab(0)
77 jsrlvo Supervisor,base
78 /* we should come back here from _disab */
79 /* increment nesting count and return */
80 lbz scr,IDNestCnt(base)
81 addi scr,scr,1
82 stb scr,IDNestCnt(base)
84 pop scr
85 rts
87 _disab:
88 mfmsr scr
89 andi. scr,scr,0xFFFF7FFF
90 isync
91 mtmsr scr
92 sync
93 rfi