setcpsr.S revision 1.1.8.2 1 1.1.8.2 thorpej /* $NetBSD: setcpsr.S,v 1.1.8.2 2002/08/19 21:39:05 thorpej Exp $ */
2 1.1.8.2 thorpej
3 1.1.8.2 thorpej /*
4 1.1.8.2 thorpej * Copyright (c) 1994 Mark Brinicombe.
5 1.1.8.2 thorpej * Copyright (c) 1994 Brini.
6 1.1.8.2 thorpej * All rights reserved.
7 1.1.8.2 thorpej *
8 1.1.8.2 thorpej * This code is derived from software written for Brini by Mark Brinicombe
9 1.1.8.2 thorpej *
10 1.1.8.2 thorpej * Redistribution and use in source and binary forms, with or without
11 1.1.8.2 thorpej * modification, are permitted provided that the following conditions
12 1.1.8.2 thorpej * are met:
13 1.1.8.2 thorpej * 1. Redistributions of source code must retain the above copyright
14 1.1.8.2 thorpej * notice, this list of conditions and the following disclaimer.
15 1.1.8.2 thorpej * 2. Redistributions in binary form must reproduce the above copyright
16 1.1.8.2 thorpej * notice, this list of conditions and the following disclaimer in the
17 1.1.8.2 thorpej * documentation and/or other materials provided with the distribution.
18 1.1.8.2 thorpej * 3. All advertising materials mentioning features or use of this software
19 1.1.8.2 thorpej * must display the following acknowledgement:
20 1.1.8.2 thorpej * This product includes software developed by Brini.
21 1.1.8.2 thorpej * 4. The name of the company nor the name of the author may be used to
22 1.1.8.2 thorpej * endorse or promote products derived from this software without specific
23 1.1.8.2 thorpej * prior written permission.
24 1.1.8.2 thorpej *
25 1.1.8.2 thorpej * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
26 1.1.8.2 thorpej * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
27 1.1.8.2 thorpej * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28 1.1.8.2 thorpej * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
29 1.1.8.2 thorpej * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
30 1.1.8.2 thorpej * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 1.1.8.2 thorpej * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 1.1.8.2 thorpej * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 1.1.8.2 thorpej * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 1.1.8.2 thorpej * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 1.1.8.2 thorpej * SUCH DAMAGE.
36 1.1.8.2 thorpej *
37 1.1.8.2 thorpej * RiscBSD kernel project
38 1.1.8.2 thorpej *
39 1.1.8.2 thorpej * setcpsr.S
40 1.1.8.2 thorpej *
41 1.1.8.2 thorpej * Miscellaneous routines to play with the CPSR register
42 1.1.8.2 thorpej *
43 1.1.8.2 thorpej * Eventually this routine can be inline assembly.
44 1.1.8.2 thorpej *
45 1.1.8.2 thorpej * Created : 12/09/94
46 1.1.8.2 thorpej *
47 1.1.8.2 thorpej * Based of kate/display/setcpsr.s
48 1.1.8.2 thorpej */
49 1.1.8.2 thorpej
50 1.1.8.2 thorpej #include <machine/asm.h>
51 1.1.8.2 thorpej
52 1.1.8.2 thorpej /* Sets and clears bits in the CPSR register
53 1.1.8.2 thorpej *
54 1.1.8.2 thorpej * r0 - bic mask
55 1.1.8.2 thorpej * r1 - eor mask
56 1.1.8.2 thorpej */
57 1.1.8.2 thorpej
58 1.1.8.2 thorpej ENTRY_NP(SetCPSR)
59 1.1.8.2 thorpej mrs r3, cpsr /* Set the CPSR */
60 1.1.8.2 thorpej bic r2, r3, r0
61 1.1.8.2 thorpej eor r2, r2, r1
62 1.1.8.2 thorpej msr cpsr_all, r2
63 1.1.8.2 thorpej
64 1.1.8.2 thorpej mov r0, r3 /* Return the old CPSR */
65 1.1.8.2 thorpej
66 1.1.8.2 thorpej mov pc, lr
67 1.1.8.2 thorpej
68 1.1.8.2 thorpej
69 1.1.8.2 thorpej /* Gets the CPSR register
70 1.1.8.2 thorpej *
71 1.1.8.2 thorpej * Returns the CPSR in r0
72 1.1.8.2 thorpej */
73 1.1.8.2 thorpej
74 1.1.8.2 thorpej ENTRY_NP(GetCPSR)
75 1.1.8.2 thorpej mrs r0, cpsr /* Get the CPSR */
76 1.1.8.2 thorpej
77 1.1.8.2 thorpej mov pc, lr
78 1.1.8.2 thorpej
79