xref: /openbsd-src/sys/arch/hppa/include/psl.h (revision 36fd90dcf1acf2ddb4ef5dbabe5313b3a8d46ee2)
1*36fd90dcSjsg /*	$OpenBSD: psl.h,v 1.11 2021/03/11 11:16:57 jsg Exp $	*/
2e55ab885Smickey 
3e55ab885Smickey /*
4fef2e65fSmickey  * Copyright (c) 1999-2004 Michael Shalayeff
5158c8846Smickey  * All rights reserved.
6e55ab885Smickey  *
7158c8846Smickey  * Redistribution and use in source and binary forms, with or without
8158c8846Smickey  * modification, are permitted provided that the following conditions
9158c8846Smickey  * are met:
10158c8846Smickey  * 1. Redistributions of source code must retain the above copyright
11158c8846Smickey  *    notice, this list of conditions and the following disclaimer.
12158c8846Smickey  * 2. Redistributions in binary form must reproduce the above copyright
13158c8846Smickey  *    notice, this list of conditions and the following disclaimer in the
14158c8846Smickey  *    documentation and/or other materials provided with the distribution.
15e55ab885Smickey  *
16158c8846Smickey  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17158c8846Smickey  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18158c8846Smickey  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19158c8846Smickey  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
20158c8846Smickey  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21158c8846Smickey  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22158c8846Smickey  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23158c8846Smickey  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
24158c8846Smickey  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
25158c8846Smickey  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
26158c8846Smickey  * THE POSSIBILITY OF SUCH DAMAGE.
27e55ab885Smickey  */
28e55ab885Smickey 
29343a9f2aSmickey #ifndef _MACHINE_PSL_H_
30343a9f2aSmickey #define _MACHINE_PSL_H_
31e55ab885Smickey 
32e55ab885Smickey /*
33*36fd90dcSjsg  * Reference:
34158c8846Smickey  * 1. PA-RISC 1.1 Architecture and Instruction Set Manual
35158c8846Smickey  *    Hewlett Packard, 3rd Edition, February 1994; Part Number 09740-90039
36e55ab885Smickey  */
37e55ab885Smickey 
38e55ab885Smickey /*
39158c8846Smickey  * Processor Status Word Bit Positions (in PA-RISC bit order)
40158c8846Smickey  */
41db3c698bSmickey #define	PSL_Y_POS	(0)
42db3c698bSmickey #define	PSL_Z_POS	(1)
43db3c698bSmickey #define	PSL_SS_POS	(3)	/* Reserved, Software-defined */
44e7689ce4Smickey #define	PSL_W_POS	(4)
45db3c698bSmickey #define	PSL_E_POS	(5)
46db3c698bSmickey #define	PSL_S_POS	(6)
47db3c698bSmickey #define	PSL_T_POS	(7)
48db3c698bSmickey #define	PSL_H_POS	(8)
49db3c698bSmickey #define	PSL_L_POS	(9)
50db3c698bSmickey #define	PSL_N_POS	(10)
51db3c698bSmickey #define	PSL_X_POS	(11)
52db3c698bSmickey #define	PSL_B_POS	(12)
53db3c698bSmickey #define	PSL_C_POS	(13)
54db3c698bSmickey #define	PSL_V_POS	(14)
55db3c698bSmickey #define	PSL_M_POS	(15)
56db3c698bSmickey #define	PSL_CB_POS	(16)
57e7689ce4Smickey #define	PSL_O_POS	(24)
58db3c698bSmickey #define	PSL_G_POS	(25)
59db3c698bSmickey #define	PSL_F_POS	(26)
60db3c698bSmickey #define	PSL_R_POS	(27)
61db3c698bSmickey #define	PSL_Q_POS	(28)
62db3c698bSmickey #define	PSL_P_POS	(29)
63db3c698bSmickey #define	PSL_D_POS	(30)
64db3c698bSmickey #define	PSL_I_POS	(31)
65158c8846Smickey 
66e7689ce4Smickey #define	PSL_BITS	"\020\001I\002D\003P\004Q\005R\006F\007G\010O"  \
67ae187c07Smickey 			"\021M\022V\023C\024B\025X\026N\027L\030H" \
68e7689ce4Smickey 			"\031T\032S\033E\034W\037Z\040Y"
69ae187c07Smickey 
70158c8846Smickey /*
71158c8846Smickey  * Processor Status Word Bit Values
72158c8846Smickey  */
73db3c698bSmickey #define	PSL_Y	(1 << (31-PSL_Y_POS))	/* Data Debug Trap Disable */
74db3c698bSmickey #define	PSL_Z	(1 << (31-PSL_Z_POS))	/* Instruction Debug Trap Disable */
75db3c698bSmickey #define	PSL_SS	(1 << (31-PSL_SS_POS))	/* Reserved; Software Single-Step */
76e7689ce4Smickey #define	PSL_W	(1 << (31-PSL_W_POS))	/* 64bit address decode enable */
77db3c698bSmickey #define	PSL_E	(1 << (31-PSL_E_POS))	/* Little Endian Memory Access Enable */
78db3c698bSmickey #define	PSL_S	(1 << (31-PSL_S_POS))	/* Secure Interval Timer */
79db3c698bSmickey #define	PSL_T	(1 << (31-PSL_T_POS))	/* Taken Branch Trap Enable */
80db3c698bSmickey #define	PSL_H	(1 << (31-PSL_H_POS))	/* Higher-privilege Transfer Trap Enable */
81db3c698bSmickey #define	PSL_L	(1 << (31-PSL_L_POS))	/* Lower-privilege Transfer Trap Enable */
82db3c698bSmickey #define	PSL_N	(1 << (31-PSL_N_POS))	/* Nullify */
83db3c698bSmickey #define	PSL_X	(1 << (31-PSL_X_POS))	/* Data Memory Break Disable */
84db3c698bSmickey #define	PSL_B	(1 << (31-PSL_B_POS))	/* Taken Branch */
85db3c698bSmickey #define	PSL_C	(1 << (31-PSL_C_POS))	/* Instruction Address Translation Enable */
86db3c698bSmickey #define	PSL_V	(1 << (31-PSL_V_POS))	/* Divide Step Correction */
87db3c698bSmickey #define	PSL_M	(1 << (31-PSL_M_POS))	/* High-priority Machine Check Mask */
88db3c698bSmickey #define	PSL_CB	(1 << (31-PSL_CB_POS))	/* Carry/Borrow Bits */
89e7689ce4Smickey #define	PSL_O	(1 << (31-PSL_O_POS))	/* Force strong ordering (2.0) */
90db3c698bSmickey #define	PSL_G	(1 << (31-PSL_G_POS))	/* Debug Trap Enable */
91*36fd90dcSjsg #define	PSL_F	(1 << (31-PSL_F_POS))	/* Performance Monitor Interrupt Unmask */
92db3c698bSmickey #define	PSL_R	(1 << (31-PSL_R_POS))	/* Recover Counter Enable */
93db3c698bSmickey #define	PSL_Q	(1 << (31-PSL_Q_POS))	/* Interrupt State Collection Enable */
94db3c698bSmickey #define	PSL_P	(1 << (31-PSL_P_POS))	/* Protection Identifier Validation Enable */
9537bf48b2Sjmc #define	PSL_D	(1 << (31-PSL_D_POS))	/* Data Address Translation Enable */
96db3c698bSmickey #define	PSL_I	(1 << (31-PSL_I_POS))	/* External Interrupt, Power Failure
97158c8846Smickey 					   Interrupt, and Low-Priority Machine
98158c8846Smickey 					   Check Interrupt unmask */
99158c8846Smickey 
100158c8846Smickey /*
10157071f6bSmickey  * Frequently Used PSW Values
102e55ab885Smickey  */
103db3c698bSmickey #define	RESET_PSL	(PSL_R | PSL_Q | PSL_P | PSL_D | PSL_I)
104e55ab885Smickey 
105343a9f2aSmickey #endif  /* _MACHINE_PSL_H_ */
106