sr.h revision 126478
1/*
2 * Copyright (C) 2002 Benno Rice.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * $FreeBSD: head/sys/powerpc/include/sr.h 126478 2004-03-02 06:49:21Z grehan $
26 */
27
28#ifndef _MACHINE_SR_H_
29#define	_MACHINE_SR_H_
30
31/*
32 * Bit definitions for segment registers.
33 *
34 * PowerPC Microprocessor Family: The Programming Environments for 32-bit
35 * Microprocessors, section 2.3.5
36 */
37
38#define	SR_TYPE		0x80000000	/* Type selector */
39#define	SR_KS		0x40000000	/* Supervisor-state protection key */
40#define	SR_KP		0x20000000	/* User-state protection key */
41#define	SR_N		0x10000000	/* No-execute protection */
42#define	SR_VSID_MASK	0x00ffffff	/* Virtual Segment ID mask */
43
44/* Kernel segment register usage */
45#define	USER_SR		12
46#define	KERNEL_SR	13
47#define	KERNEL2_SR	14
48#define	KERNEL_VSIDBITS	0xfffff
49#define	KERNEL_SEGMENT	(0xfffff0 + KERNEL_SR)
50#define	KERNEL2_SEGMENT	(0xfffff0 + KERNEL2_SR)
51#define	EMPTY_SEGMENT	0xfffff0
52#define	USER_ADDR	((void *)(USER_SR << ADDR_SR_SHFT))
53#define	SEGMENT_LENGTH	0x10000000
54#define	SEGMENT_MASK	0xf0000000
55
56#endif /* !_MACHINE_SR_H_ */
57