xref: /openbsd-src/sys/arch/hppa/include/psl.h (revision b2ea75c1b17e1a9a339660e7ed45cd24946b230e)
1 /*	$OpenBSD: psl.h,v 1.6 1999/11/25 18:29:01 mickey Exp $	*/
2 
3 /*
4  * Copyright (c) 1999 Michael Shalayeff
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *      This product includes software developed by Michael Shalayeff.
18  * 4. The name of the author may not be used to endorse or promote products
19  *    derived from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
25  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
29  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
30  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31  * THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef _MACHINE_PSL_H_
35 #define _MACHINE_PSL_H_
36 
37 /*
38  * Rference:
39  * 1. PA-RISC 1.1 Architecture and Instruction Set Manual
40  *    Hewlett Packard, 3rd Edition, February 1994; Part Number 09740-90039
41  */
42 
43 /*
44  * Processor Status Word Bit Positions (in PA-RISC bit order)
45  */
46 #define	PSW_Y_POS	(0)
47 #define	PSW_Z_POS	(1)
48 #define	PSW_SS_POS	(3)	/* Reserved, Software-defined */
49 #define	PSW_E_POS	(5)
50 #define	PSW_S_POS	(6)
51 #define	PSW_T_POS	(7)
52 #define	PSW_H_POS	(8)
53 #define	PSW_L_POS	(9)
54 #define	PSW_N_POS	(10)
55 #define	PSW_X_POS	(11)
56 #define	PSW_B_POS	(12)
57 #define	PSW_C_POS	(13)
58 #define	PSW_V_POS	(14)
59 #define	PSW_M_POS	(15)
60 #define	PSW_CB_POS	(16)
61 #define	PSW_G_POS	(25)
62 #define	PSW_F_POS	(26)
63 #define	PSW_R_POS	(27)
64 #define	PSW_Q_POS	(28)
65 #define	PSW_P_POS	(29)
66 #define	PSW_D_POS	(30)
67 #define	PSW_I_POS	(31)
68 
69 #define	PSW_BITS	"\020\001I\002D\003P\004Q\005R\006F\007G"  \
70 			"\021M\022V\023C\024B\025X\026N\027L\030H" \
71 			"\031T\032S\033E\037Z\040Y"
72 
73 /*
74  * Processor Status Word Bit Values
75  */
76 #define	PSW_Y	(1 << (31-PSW_Y_POS))	/* Data Debug Trap Disable */
77 #define	PSW_Z	(1 << (31-PSW_Z_POS))	/* Instruction Debug Trap Disable */
78 #define	PSW_SS	(1 << (31-PSW_SS_POS))	/* Reserved; Software Single-Step */
79 #define	PSW_E	(1 << (31-PSW_E_POS))	/* Little Endian Memory Access Enable */
80 #define	PSW_S	(1 << (31-PSW_S_POS))	/* Secure Interval Timer */
81 #define	PSW_T	(1 << (31-PSW_T_POS))	/* Taken Branch Trap Enable */
82 #define	PSW_H	(1 << (31-PSW_H_POS))	/* Higher-privilege Transfer Trap Enable */
83 #define	PSW_L	(1 << (31-PSW_L_POS))	/* Lower-privilege Transfer Trap Enable */
84 #define	PSW_N	(1 << (31-PSW_N_POS))	/* Nullify */
85 #define	PSW_X	(1 << (31-PSW_X_POS))	/* Data Memory Break Disable */
86 #define	PSW_B	(1 << (31-PSW_B_POS))	/* Taken Branch */
87 #define	PSW_C	(1 << (31-PSW_C_POS))	/* Instruction Address Translation Enable */
88 #define	PSW_V	(1 << (31-PSW_V_POS))	/* Divide Step Correction */
89 #define	PSW_M	(1 << (31-PSW_M_POS))	/* High-priority Machine Check Mask */
90 #define	PSW_CB	(1 << (31-PSW_CB_POS))	/* Carry/Borrow Bits */
91 #define	PSW_G	(1 << (31-PSW_G_POS))	/* Debug Trap Enable */
92 #define	PSW_F	(1 << (31-PSW_F_POS))	/* Perfomance Monitor Interrupt Unmask */
93 #define	PSW_R	(1 << (31-PSW_R_POS))	/* Recover Counter Enable */
94 #define	PSW_Q	(1 << (31-PSW_Q_POS))	/* Interrupt State Collection Enable */
95 #define	PSW_P	(1 << (31-PSW_P_POS))	/* Protection Identifier Validation Enable */
96 #define	PSW_D	(1 << (31-PSW_D_POS))	/* Data Adress Translation Enable */
97 #define	PSW_I	(1 << (31-PSW_I_POS))	/* External Interrupt, Power Failure
98 					   Interrupt, and Low-Priority Machine
99 					   Check Interrupt unmask */
100 
101 /*
102  * Frequently Used PSW Values
103  */
104 #define	RESET_PSW	(PSW_R | PSW_Q | PSW_P | PSW_D | PSW_I)
105 
106 #endif  /* _MACHINE_PSL_H_ */
107