]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/powerpc/include/sr.h
Mark the repository as being converted to Git.
[FreeBSD/FreeBSD.git] / sys / powerpc / include / sr.h
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (C) 2002 Benno Rice.
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  *
16  * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  *
27  * $FreeBSD$
28  */
29
30 #ifndef _MACHINE_SR_H_
31 #define _MACHINE_SR_H_
32
33 /*
34  * Bit definitions for segment registers.
35  *
36  * PowerPC Microprocessor Family: The Programming Environments for 32-bit
37  * Microprocessors, section 2.3.5
38  */
39
40 #define SR_TYPE         0x80000000      /* Type selector */
41 #define SR_KS           0x40000000      /* Supervisor-state protection key */
42 #define SR_KP           0x20000000      /* User-state protection key */
43 #define SR_N            0x10000000      /* No-execute protection */
44 #define SR_VSID_MASK    0x00ffffff      /* Virtual Segment ID mask */
45
46 /* Kernel segment register usage */
47 #define USER_SR         12
48 #define KERNEL_SR       13
49 #define KERNEL2_SR      14
50 #define KERNEL3_SR      15
51 #define KERNEL_VSIDBITS 0xfffffUL
52 #define KERNEL_SEGMENT  (0xfffff0 + KERNEL_SR)
53 #define KERNEL2_SEGMENT (0xfffff0 + KERNEL2_SR)
54 #define EMPTY_SEGMENT   0xfffff0
55 #ifdef __powerpc64__
56 #define USER_ADDR       0xc00ffffff0000000UL
57 #else
58 #define USER_ADDR       ((uintptr_t)USER_SR << ADDR_SR_SHFT)
59 #endif
60 #define SEGMENT_LENGTH  0x10000000UL
61 #define SEGMENT_INVMASK 0x0fffffffUL
62 #define SEGMENT_MASK    ~SEGMENT_INVMASK
63
64 #endif /* !_MACHINE_SR_H_ */