spl.S revision 1.1.2.2 1 1.1.2.2 lukem /* $NetBSD: spl.S,v 1.1.2.2 2001/08/03 04:10:59 lukem Exp $ */
2 1.1.2.2 lukem
3 1.1.2.2 lukem /*
4 1.1.2.2 lukem * Copyright (c) 1996-1998 Mark Brinicombe.
5 1.1.2.2 lukem * Copyright (c) Brini.
6 1.1.2.2 lukem * All rights reserved.
7 1.1.2.2 lukem *
8 1.1.2.2 lukem * Redistribution and use in source and binary forms, with or without
9 1.1.2.2 lukem * modification, are permitted provided that the following conditions
10 1.1.2.2 lukem * are met:
11 1.1.2.2 lukem * 1. Redistributions of source code must retain the above copyright
12 1.1.2.2 lukem * notice, this list of conditions and the following disclaimer.
13 1.1.2.2 lukem * 2. Redistributions in binary form must reproduce the above copyright
14 1.1.2.2 lukem * notice, this list of conditions and the following disclaimer in the
15 1.1.2.2 lukem * documentation and/or other materials provided with the distribution.
16 1.1.2.2 lukem * 3. All advertising materials mentioning features or use of this software
17 1.1.2.2 lukem * must display the following acknowledgement:
18 1.1.2.2 lukem * This product includes software developed by Mark Brinicombe
19 1.1.2.2 lukem * for the NetBSD Project.
20 1.1.2.2 lukem * 4. The name of the company nor the name of the author may be used to
21 1.1.2.2 lukem * endorse or promote products derived from this software without specific
22 1.1.2.2 lukem * prior written permission.
23 1.1.2.2 lukem *
24 1.1.2.2 lukem * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
25 1.1.2.2 lukem * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
26 1.1.2.2 lukem * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 1.1.2.2 lukem * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
28 1.1.2.2 lukem * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 1.1.2.2 lukem * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 1.1.2.2 lukem * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 1.1.2.2 lukem * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 1.1.2.2 lukem * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 1.1.2.2 lukem * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 1.1.2.2 lukem * SUCH DAMAGE.
35 1.1.2.2 lukem *
36 1.1.2.2 lukem * spl routines
37 1.1.2.2 lukem *
38 1.1.2.2 lukem * Created : 01/03/96
39 1.1.2.2 lukem */
40 1.1.2.2 lukem
41 1.1.2.2 lukem #include "assym.h"
42 1.1.2.2 lukem #include <machine/psl.h>
43 1.1.2.2 lukem #include <machine/asm.h>
44 1.1.2.2 lukem
45 1.1.2.2 lukem .text
46 1.1.2.2 lukem .align 0
47 1.1.2.2 lukem
48 1.1.2.2 lukem Lcurrent_spl_level:
49 1.1.2.2 lukem .word _C_LABEL(current_spl_level)
50 1.1.2.2 lukem
51 1.1.2.2 lukem Lspl_masks:
52 1.1.2.2 lukem .word _C_LABEL(spl_masks)
53 1.1.2.2 lukem
54 1.1.2.2 lukem Lspl_mask:
55 1.1.2.2 lukem .word _C_LABEL(spl_mask)
56 1.1.2.2 lukem
57 1.1.2.2 lukem ENTRY(raisespl)
58 1.1.2.2 lukem mov r3, r0 /* Save the new value */
59 1.1.2.2 lukem ldr r1, Lcurrent_spl_level /* Get the current spl level */
60 1.1.2.2 lukem ldr r0, [r1]
61 1.1.2.2 lukem cmp r3, r0
62 1.1.2.2 lukem movle pc, lr
63 1.1.2.2 lukem
64 1.1.2.2 lukem str r3, [r1] /* Store the new spl level */
65 1.1.2.2 lukem
66 1.1.2.2 lukem ldr r2, Lspl_masks /* Get the spl mask */
67 1.1.2.2 lukem ldr r2, [r2, r3, lsl #2]
68 1.1.2.2 lukem
69 1.1.2.2 lukem ldr r1, Lspl_mask /* Store in the current spl mask */
70 1.1.2.2 lukem str r2, [r1]
71 1.1.2.2 lukem
72 1.1.2.2 lukem stmfd sp!, {r0, lr} /* Preserve registers */
73 1.1.2.2 lukem bl _C_LABEL(irq_setmasks) /* Update the actual masks */
74 1.1.2.2 lukem ldmfd sp!, {r0, pc} /* Exit */
75 1.1.2.2 lukem
76 1.1.2.2 lukem ENTRY(lowerspl)
77 1.1.2.2 lukem mov r3, r0 /* Save the new value */
78 1.1.2.2 lukem ldr r1, Lcurrent_spl_level /* Get the current spl level */
79 1.1.2.2 lukem ldr r0, [r1]
80 1.1.2.2 lukem cmp r3, r0
81 1.1.2.2 lukem movge pc, lr
82 1.1.2.2 lukem
83 1.1.2.2 lukem str r3, [r1] /* Store the new spl level */
84 1.1.2.2 lukem
85 1.1.2.2 lukem ldr r2, Lspl_masks /* Get the spl mask */
86 1.1.2.2 lukem ldr r2, [r2, r3, lsl #2]
87 1.1.2.2 lukem
88 1.1.2.2 lukem ldr r1, Lspl_mask /* Store in the current spl mask */
89 1.1.2.2 lukem str r2, [r1]
90 1.1.2.2 lukem
91 1.1.2.2 lukem stmfd sp!, {r0, lr} /* Preserve registers */
92 1.1.2.2 lukem bl _C_LABEL(irq_setmasks) /* Update the actual masks */
93 1.1.2.2 lukem bl _C_LABEL(dosoftints) /* Process any pending soft ints */
94 1.1.2.2 lukem ldmfd sp!, {r0, pc} /* Exit */
95 1.1.2.2 lukem
96 1.1.2.2 lukem ENTRY(splx)
97 1.1.2.2 lukem mov r3, r0 /* Save the new value */
98 1.1.2.2 lukem ldr r1, Lcurrent_spl_level /* Get the current spl level */
99 1.1.2.2 lukem ldr r0, [r1]
100 1.1.2.2 lukem cmp r3, r0
101 1.1.2.2 lukem moveq pc, lr
102 1.1.2.2 lukem
103 1.1.2.2 lukem str r3, [r1] /* Store the new spl level */
104 1.1.2.2 lukem
105 1.1.2.2 lukem ldr r2, Lspl_masks /* Get the spl mask */
106 1.1.2.2 lukem ldr r2, [r2, r3, lsl #2] /* Use r4 so available later */
107 1.1.2.2 lukem
108 1.1.2.2 lukem ldr r1, Lspl_mask /* Store in the current spl mask */
109 1.1.2.2 lukem str r2, [r1]
110 1.1.2.2 lukem
111 1.1.2.2 lukem stmfd sp!, {r0, lr} /* Preserve registers */
112 1.1.2.2 lukem bl _C_LABEL(irq_setmasks) /* Update the actual masks */
113 1.1.2.2 lukem bl _C_LABEL(dosoftints) /* Process any pending soft ints */
114 1.1.2.2 lukem ldmfd sp!, {r0, pc} /* Exit */
115