xref: /dflybsd-src/sys/cpu/x86_64/include/psl.h (revision 2c64e990ea2bb1213bd0758af732469466873ba6)
1b2b3ffcdSSimon Schubert /*-
2b2b3ffcdSSimon Schubert  * Copyright (c) 1990 The Regents of the University of California.
3b2b3ffcdSSimon Schubert  * All rights reserved.
4b2b3ffcdSSimon Schubert  *
5b2b3ffcdSSimon Schubert  * This code is derived from software contributed to Berkeley by
6b2b3ffcdSSimon Schubert  * William Jolitz.
7b2b3ffcdSSimon Schubert  *
8b2b3ffcdSSimon Schubert  * Redistribution and use in source and binary forms, with or without
9b2b3ffcdSSimon Schubert  * modification, are permitted provided that the following conditions
10b2b3ffcdSSimon Schubert  * are met:
11b2b3ffcdSSimon Schubert  * 1. Redistributions of source code must retain the above copyright
12b2b3ffcdSSimon Schubert  *    notice, this list of conditions and the following disclaimer.
13b2b3ffcdSSimon Schubert  * 2. Redistributions in binary form must reproduce the above copyright
14b2b3ffcdSSimon Schubert  *    notice, this list of conditions and the following disclaimer in the
15b2b3ffcdSSimon Schubert  *    documentation and/or other materials provided with the distribution.
16*2c64e990Szrj  * 3. Neither the name of the University nor the names of its contributors
17b2b3ffcdSSimon Schubert  *    may be used to endorse or promote products derived from this software
18b2b3ffcdSSimon Schubert  *    without specific prior written permission.
19b2b3ffcdSSimon Schubert  *
20b2b3ffcdSSimon Schubert  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21b2b3ffcdSSimon Schubert  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22b2b3ffcdSSimon Schubert  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23b2b3ffcdSSimon Schubert  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24b2b3ffcdSSimon Schubert  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25b2b3ffcdSSimon Schubert  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26b2b3ffcdSSimon Schubert  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27b2b3ffcdSSimon Schubert  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28b2b3ffcdSSimon Schubert  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29b2b3ffcdSSimon Schubert  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30b2b3ffcdSSimon Schubert  * SUCH DAMAGE.
31b2b3ffcdSSimon Schubert  *
32b2b3ffcdSSimon Schubert  *	from: @(#)psl.h	5.2 (Berkeley) 1/18/91
33b2b3ffcdSSimon Schubert  * $FreeBSD: src/sys/amd64/include/psl.h,v 1.12 2003/05/01 01:05:23 peter Exp $
34b2b3ffcdSSimon Schubert  */
35b2b3ffcdSSimon Schubert 
36b2b3ffcdSSimon Schubert #ifndef _CPU_PSL_H_
37b2b3ffcdSSimon Schubert #define	_CPU_PSL_H_
38b2b3ffcdSSimon Schubert 
39b2b3ffcdSSimon Schubert /*
40b2b3ffcdSSimon Schubert  * 386 processor status longword.
41b2b3ffcdSSimon Schubert  */
42b2b3ffcdSSimon Schubert #define	PSL_C		0x00000001	/* carry bit */
43b2b3ffcdSSimon Schubert #define	PSL_PF		0x00000004	/* parity bit */
44b2b3ffcdSSimon Schubert #define	PSL_AF		0x00000010	/* bcd carry bit */
45b2b3ffcdSSimon Schubert #define	PSL_Z		0x00000040	/* zero bit */
46b2b3ffcdSSimon Schubert #define	PSL_N		0x00000080	/* negative bit */
47b2b3ffcdSSimon Schubert #define	PSL_T		0x00000100	/* trace enable bit */
48b2b3ffcdSSimon Schubert #define	PSL_I		0x00000200	/* interrupt enable bit */
49b2b3ffcdSSimon Schubert #define	PSL_D		0x00000400	/* string instruction direction bit */
50b2b3ffcdSSimon Schubert #define	PSL_V		0x00000800	/* overflow bit */
51b2b3ffcdSSimon Schubert #define	PSL_IOPL	0x00003000	/* i/o privilege level */
52b2b3ffcdSSimon Schubert #define	PSL_NT		0x00004000	/* nested task bit */
53b2b3ffcdSSimon Schubert #define	PSL_RF		0x00010000	/* resume flag bit */
54b2b3ffcdSSimon Schubert #define PSL_VM_UNSUPP	0x00020000 	/* virtual 8086 mode bit */
55b2b3ffcdSSimon Schubert #define	PSL_AC		0x00040000	/* alignment checking */
56b2b3ffcdSSimon Schubert /* #define PSL_VIF	0x00080000 */	/* virtual interrupt enable */
57b2b3ffcdSSimon Schubert /* #define PSL_VIP	0x00100000 */	/* virtual interrupt pending */
58b2b3ffcdSSimon Schubert #define	PSL_ID		0x00200000	/* identification bit */
59b2b3ffcdSSimon Schubert 
60b2b3ffcdSSimon Schubert /*
61b2b3ffcdSSimon Schubert  * The i486 manual says that we are not supposed to change reserved flags,
62b2b3ffcdSSimon Schubert  * but this is too much trouble since the reserved flags depend on the cpu
63b2b3ffcdSSimon Schubert  * and setting them to their historical values works in practice.
64b2b3ffcdSSimon Schubert  */
65b2b3ffcdSSimon Schubert #define	PSL_RESERVED_DEFAULT	0x00000002
66b2b3ffcdSSimon Schubert 
67b2b3ffcdSSimon Schubert /*
68b2b3ffcdSSimon Schubert  * Initial flags for kernel and user mode.  The kernel later inherits
69b2b3ffcdSSimon Schubert  * PSL_I and some other flags from user mode.
70b2b3ffcdSSimon Schubert  */
71b2b3ffcdSSimon Schubert #define	PSL_KERNEL	PSL_RESERVED_DEFAULT
72b2b3ffcdSSimon Schubert #define	PSL_USER	(PSL_RESERVED_DEFAULT | PSL_I)
73b2b3ffcdSSimon Schubert 
74b2b3ffcdSSimon Schubert /*
75b2b3ffcdSSimon Schubert  * Bits that can be changed in user mode on 486's.  We allow these bits
76b2b3ffcdSSimon Schubert  * to be changed using ptrace(), sigreturn() and procfs.  Setting PS_NT
77b2b3ffcdSSimon Schubert  * is undesirable but it may as well be allowed since users can inflict
78b2b3ffcdSSimon Schubert  * it on the kernel directly.  Changes to PSL_AC are silently ignored on
79b2b3ffcdSSimon Schubert  * 386's.
80b2b3ffcdSSimon Schubert  */
81b2b3ffcdSSimon Schubert #define	PSL_USERCHANGE (PSL_C | PSL_PF | PSL_AF | PSL_Z | PSL_N | PSL_T \
82b2b3ffcdSSimon Schubert 			| PSL_D | PSL_V | PSL_NT | PSL_AC | PSL_ID)
83b2b3ffcdSSimon Schubert 
84b2b3ffcdSSimon Schubert #endif /* !_CPU_PSL_H_ */
85