Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: SS_AsiInfo.h | |
5 | * Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved. | |
6 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES. | |
7 | * | |
8 | * The above named program is free software; you can redistribute it and/or | |
9 | * modify it under the terms of the GNU General Public | |
10 | * License version 2 as published by the Free Software Foundation. | |
11 | * | |
12 | * The above named program is distributed in the hope that it will be | |
13 | * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | * General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public | |
18 | * License along with this work; if not, write to the Free Software | |
19 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. | |
20 | * | |
21 | * ========== Copyright Header End ============================================ | |
22 | */ | |
23 | ||
24 | #ifndef __SS_AsiInfo_h__ | |
25 | #define __SS_AsiInfo_h__ | |
26 | ||
27 | #include "SS_Types.h" | |
28 | ||
29 | class SS_AsiInfo | |
30 | { | |
31 | public: | |
32 | enum Flags | |
33 | { | |
34 | INVALID = 0, | |
35 | ||
36 | PROTECTION_OFFSET = 0, // 0=user, 1=priv, 2=hyper | |
37 | PROTECTION_MASK = 3, // 0=user, 1=priv, 2=hyper | |
38 | PRIVILEGED = 1 << PROTECTION_OFFSET, // priviledged access, cause privileged_action trap | |
39 | HYPERPRIVILEGED = 2 << PROTECTION_OFFSET, // hyper-privileged access ,cause privileged_action trap | |
40 | ||
41 | CLASS_LD = 1 << 2, // Valid asi for ld[us][bhw]a? ldxa? ldd?fa? | |
42 | CLASS_ST = 1 << 3, // Valid asi for st[bhwx]a? | |
43 | CLASS_STF = 1 << 4, // Valid asi for st[df]a? | |
44 | CLASS_LDX = 1 << 5, // Valid asi for ldxa | |
45 | CLASS_STX = 1 << 6, // Valid asi for stxa | |
46 | CLASS_ATOMIC = 1 << 7, // Valid asi for ldstuba, swapa, casa, casxa | |
47 | CLASS_PREFETCH = 1 << 8, // Valid asi for prefetcha | |
48 | ||
49 | PRIMARY = 1 << 9, // Translate with primary context | |
50 | SECONDARY = 1 << 10, // Translate with secondary context | |
51 | NUCLEUS = 1 << 11, // Translate with nucleus context | |
52 | REAL = 1 << 12, // Translate as RA->PA (ignore context), only when nonprivileged. | |
53 | BYPASS = 1 << 13, // Translate as PA=VA (bypass), only when hpstate.hpriv=1 | |
54 | ||
55 | LITTLE_ENDIAN = 1 << 14, // The asi is a little endian memory access | |
56 | NOFAULT = 1 << 15, // The asi is a non faulting asi | |
57 | AS_IF_USER = 1 << 16, // The asi is an as_if_user asi | |
58 | AS_IF_PRIV = 1 << 17, // The asi is an as_if_user asi | |
59 | ||
60 | QUAD_LOAD = 1 << 18, // The asi is a quad_load (only valid for ldd) | |
61 | BLOCK_LOAD = 1 << 19, // The asi is a block load (only valid for lddfa) | |
62 | BLOCK_STORE = 1 << 20, // The asi is a block store (only valid for stdfa) | |
63 | SHORTF_8 = 1 << 21, // The asi is a short float 8 load/store (only valid for lddfa and stdfa) | |
64 | SHORTF_16 = 1 << 22, // The asi is a short float 16 load/store (only valid for lddfa and stdfa) | |
65 | PARTIAL_8 = 1 << 23, // The asi is a partial float store 8 (only valid for stdfa) | |
66 | PARTIAL_16 = 1 << 24, // The asi is a partial float store 16 (only valid for stdfa) | |
67 | PARTIAL_32 = 1 << 25, // The asi is a partial float store 32 (only valid for stdfa) | |
68 | BLOCK_INIT = 1 << 26, // The asi is a block init store (valid with all store) | |
69 | ||
70 | NONTRANS = 1 << 27 // The asi is a nontransacional asi | |
71 | }; | |
72 | ||
73 | friend Flags operator|( Flags a, Flags b ) { return Flags(uint_t(a) | uint_t(b)); } | |
74 | friend Flags operator&( Flags a, Flags b ) { return Flags(uint_t(a) & uint_t(b)); } | |
75 | ||
76 | SS_AsiInfo( Flags f=INVALID ) : flags(f) {} | |
77 | ||
78 | void set_flags( Flags f ) { flags = f; } | |
79 | Flags get_flags() { return flags; } | |
80 | void clr_flags( Flags f ) { flags = flags & Flags(~uint_t(f)); } | |
81 | ||
82 | bool is_valid_ld_asi() const { return flags & CLASS_LD; } | |
83 | bool is_valid_ldx_asi() const { return flags & CLASS_LDX; } | |
84 | bool is_valid_st_asi() const { return flags & CLASS_ST; } | |
85 | bool is_valid_stf_asi() const { return flags & CLASS_STF; } | |
86 | bool is_valid_stx_asi() const { return flags & CLASS_STX; } | |
87 | bool is_valid_atomic_asi() const { return flags & CLASS_ATOMIC; } | |
88 | bool is_valid_prefetch_asi() const { return flags & CLASS_PREFETCH; } | |
89 | bool is_valid_flush_asi() const { return flags & CLASS_ATOMIC; } | |
90 | ||
91 | bool is_translating() const { return flags & (PRIMARY|SECONDARY|NUCLEUS|REAL); } | |
92 | bool is_primary() const { return flags & PRIMARY; } | |
93 | bool is_secondary() const { return flags & SECONDARY; } | |
94 | bool is_nucleus() const { return flags & NUCLEUS; } | |
95 | bool is_real() const { return flags & REAL; } | |
96 | bool is_bypass() const { return flags & BYPASS; } | |
97 | ||
98 | uint_t get_protection() const { return (flags >> PROTECTION_OFFSET) & PROTECTION_MASK; } | |
99 | ||
100 | bool is_little_endian() const { return flags & LITTLE_ENDIAN; } | |
101 | bool is_nofault() const { return flags & NOFAULT; } | |
102 | bool is_as_if_user() const { return flags & AS_IF_USER; } | |
103 | bool is_as_if_priv() const { return flags & AS_IF_PRIV; } | |
104 | ||
105 | bool is_quad_load_asi() const { return flags & QUAD_LOAD; } | |
106 | bool is_partial8_asi() const { return flags & PARTIAL_8; } | |
107 | bool is_partial16_asi() const { return flags & PARTIAL_16; } | |
108 | bool is_partial32_asi() const { return flags & PARTIAL_32; } | |
109 | bool is_shortf8_asi() const { return flags & SHORTF_8; } | |
110 | bool is_shortf16_asi() const { return flags & SHORTF_16; } | |
111 | bool is_block_load_asi() const { return flags & BLOCK_LOAD; } | |
112 | bool is_block_store_asi() const { return flags & BLOCK_STORE; } | |
113 | bool is_block_init_asi() const { return flags & BLOCK_INIT; } | |
114 | bool is_block_asi() const { return flags & (BLOCK_INIT|BLOCK_LOAD|BLOCK_STORE); } | |
115 | bool is_nontrans_asi() const { return flags & NONTRANS; } | |
116 | ||
117 | private: | |
118 | Flags flags; | |
119 | }; | |
120 | ||
121 | ||
122 | #endif |