debuggers.hg

view xen/include/asm-ia64/vmx_mm_def.h @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children
line source
1 /* -*- Mode:C; c-basic-offset:4; tab-width:4; indent-tabs-mode:nil -*- */
2 /*
3 * vmx_mm_def.h:
4 * Copyright (c) 2004, Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17 * Place - Suite 330, Boston, MA 02111-1307 USA.
18 *
19 * Kun Tian (Kevin Tian) (kevin.tian@intel.com)
20 */
21 #ifndef _MM_DEF_H_
22 #define _MM_DEF_H_
25 /* VHPT size 4M */
26 //#define VHPT_SIZE_PS 22
27 //#define VHPT_SIZE (1 << VHPT_SIZE_PS)
28 #define ARCH_PAGE_SHIFT 12
29 #define ARCH_PAGE_SIZE PSIZE(ARCH_PAGE_SHIFT)
30 #define MAX_PHYS_ADDR_BITS 50
31 #define GUEST_IMPL_VA_MSB 59
32 #define PMASK(size) (~((size) - 1))
33 #define PSIZE(size) (1UL<<(size))
34 //#define PAGE_SIZE_4K PSIZE(12)
35 #define POFFSET(vaddr, ps) ((vaddr) & (PSIZE(ps) - 1))
36 #define PPN_2_PA(ppn) ((ppn)<<12)
37 #define CLEARLSB(ppn, nbits) ((((uint64_t)ppn) >> (nbits)) << (nbits))
38 #define PAGEALIGN(va, ps) CLEARLSB(va, ps)
40 #define TLB_AR_R 0
41 #define TLB_AR_RX 1
42 #define TLB_AR_RW 2
43 #define TLB_AR_RWX 3
44 #define TLB_AR_R_RW 4
45 #define TLB_AR_RX_RWX 5
46 #define TLB_AR_RWX_RW 6
47 #define TLB_AR_XP 7
49 #define IA64_ISR_CODE_MASK0 0xf
50 #define IA64_UNIMPL_DADDR_FAULT 0x30
51 #define IA64_UNIMPL_IADDR_TRAP 0x10
52 #define IA64_RESERVED_REG_FAULT 0x30
53 #define IA64_REG_NAT_CONSUMPTION_FAULT 0x10
54 #define IA64_NAT_CONSUMPTION_FAULT 0x20
55 #define IA64_PRIV_OP_FAULT 0x10
57 #define DEFER_NONE 0
58 #define DEFER_ALWAYS 0x1
59 #define DEFER_DM 0x100 /* bit 8 */
60 #define DEFER_DP 0X200 /* bit 9 */
61 #define DEFER_DK 0x400 /* bit 10 */
62 #define DEFER_DX 0x800 /* bit 11 */
63 #define DEFER_DR 0x1000 /* bit 12 */
64 #define DEFER_DA 0x2000 /* bit 13 */
65 #define DEFER_DD 0x4000 /* bit 14 */
67 #define ACCESS_RIGHT(a) ((a) & (ACCESS_FETCHADD - 1))
69 #define ACCESS_READ 0x1
70 #define ACCESS_WRITE 0x2
71 #define ACCESS_EXECUTE 0x4
72 #define ACCESS_XP0 0x8
73 #define ACCESS_XP1 0x10
74 #define ACCESS_XP2 0x20
75 #define ACCESS_FETCHADD 0x40
76 #define ACCESS_XCHG 0x80
77 #define ACCESS_CMPXCHG 0x100
79 #define ACCESS_SIZE_1 0x10000
80 #define ACCESS_SIZE_2 0x20000
81 #define ACCESS_SIZE_4 0x40000
82 #define ACCESS_SIZE_8 0x80000
83 #define ACCESS_SIZE_10 0x100000
84 #define ACCESS_SIZE_16 0x200000
86 #define STLB_TC 0
87 #define STLB_TR 1
89 #define IA64_RR_SHIFT 61
91 #define PHYS_PAGE_SHIFT PPN_SHIFT
93 #define STLB_SZ_SHIFT 8 // 256
94 #define STLB_SIZE (1UL<<STLB_SZ_SHIFT)
95 #define STLB_PPS_SHIFT 12
96 #define STLB_PPS (1UL<<STLB_PPS_SHIFT)
97 #define GUEST_TRNUM 8
99 /* Virtual address memory attributes encoding */
100 #define VA_MATTR_WB 0x0
101 #define VA_MATTR_UC 0x4
102 #define VA_MATTR_UCE 0x5
103 #define VA_MATTR_WC 0x6
104 #define VA_MATTR_NATPAGE 0x7
106 #define VRN_MASK 0xe000000000000000
107 #define PTA_BASE_MASK 0x3fffffffffffL
108 #define PTA_BASE_SHIFT 15
109 #define VHPT_OFFSET_MASK 0x7fff
111 #define BITS_SHIFT_256MB 28
112 #define SIZE_256MB (1UL<<BITS_SHIFT_256MB)
113 #define TLB_GR_RV_BITS ((1UL<<1) | (3UL<<50))
114 #define HPA_MAPPING_ATTRIBUTE 0x61 //ED:0;AR:0;PL:0;D:1;A:1;P:1
115 #define VPN_2_VRN(vpn) ((vpn << PPN_SHIFT) >> IA64_VRN_SHIFT)
117 #ifndef __ASSEMBLY__
118 typedef enum { INSTRUCTION, DATA, REGISTER } miss_type;
120 //typedef enum { MVHPT, STLB } vtlb_loc_type_t;
121 typedef enum { DATA_REF, NA_REF, INST_REF, RSE_REF } vhpt_ref_t;
123 static __inline__ uint64_t
124 bits_v(uint64_t v, uint32_t bs, uint32_t be)
125 {
126 uint64_t result;
127 __asm __volatile("shl %0=%1, %2;; shr.u %0=%0, %3;;"
128 : "=r" (result): "r"(v), "r"(63-be), "r" (bs+63-be) );
129 return result;
130 }
132 #define bits(val, bs, be) \
133 ({ \
134 u64 ret; \
135 \
136 __asm __volatile("extr.u %0=%1, %2, %3" \
137 : "=r" (ret): "r"(val), \
138 "M" ((bs)), \
139 "M" ((be) - (bs) + 1) ); \
140 ret; \
141 })
143 /*
144 * clear bits (pos, len) from v.
145 *
146 */
147 #define clearbits(v, pos, len) \
148 ({ \
149 u64 ret; \
150 \
151 __asm __volatile("dep.z %0=%1, %2, %3" \
152 : "=r" (ret): "r"(v), \
153 "M" ((pos)), \
154 "M" ((len))); \
155 ret; \
156 })
157 #endif
159 #endif