interrupt.s
1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**************************************************************************
* *
* Copyright (C) 1994, Silicon Graphics, Inc. *
* *
* These coded instructions, statements, and computer programs contain *
* unpublished proprietary information of Silicon Graphics, Inc., and *
* are protected by Federal copyright law. They may not be disclosed *
* to third parties or copied or duplicated in any form, in whole or *
* in part, without the prior written consent of Silicon Graphics, Inc. *
* *
**************************************************************************/
#include <asm.h>
#include <regdef.h>
#include <R4300.h>
#include "threadasm.h"
.set noreorder
/*
* u32 __osDisableInt(void)
*
* Disable interrupts by flipping the interrupt enable bit off;
* return previous state of this bit.
*/
LEAF(__osDisableInt)
/* Load GlobalIntMask */
la t2, __OSGlobalIntMask
lw t3, 0(t2)
andi t3, SR_IMASK /* t3 = old GlobalIntMask */
/* Load SR register */
mfc0 t0,C0_SR
/* Turn off IE */
and t1, t0, ~SR_IE
mtc0 t1, C0_SR
/* Set return Value (SR_IE bit: 0 or 1) */
and v0, t0, SR_IE
/* Check GlobalIntMask change */
lw t0, 0(t2)
andi t0, SR_IMASK /* t0 = new GlobalIntMask */
beq t0, t3, No_Change_Global_Int
/* Set new GlobalIntMask */
la t2,__osRunningThread
lw t1,T_CONTEXT_SR(t2)
and t2, t1, SR_IMASK
and t2, t0
and t1, ~SR_IMASK
or t1, t2
and t1, t1, ~SR_IE
mtc0 t1,C0_SR
nop
nop
No_Change_Global_Int:
j ra
nop
END(__osDisableInt)
/*
* void __osRestoreInt(u32 enable)
*
* Restore the previous state of the interrupt enable bit.
*/
LEAF(__osRestoreInt)
mfc0 t0,C0_SR
or t0,a0
mtc0 t0,C0_SR
nop
nop
j ra
nop
END(__osRestoreInt)