David Gibson | 10b4652 | 2013-03-12 00:31:06 +0000 | [diff] [blame] | 1 | /* |
| 2 | * PowerPC MMU, TLB, SLB and BAT emulation helpers for QEMU. |
| 3 | * |
| 4 | * Copyright (c) 2003-2007 Jocelyn Mayer |
| 5 | * Copyright (c) 2013 David Gibson, IBM Corporation |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Lesser General Public |
| 9 | * License as published by the Free Software Foundation; either |
| 10 | * version 2 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with this library; if not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | #include "cpu.h" |
Richard Henderson | 2ef6175 | 2014-04-07 22:31:41 -0700 | [diff] [blame] | 21 | #include "exec/helper-proto.h" |
David Gibson | 10b4652 | 2013-03-12 00:31:06 +0000 | [diff] [blame] | 22 | #include "sysemu/kvm.h" |
| 23 | #include "kvm_ppc.h" |
| 24 | #include "mmu-hash64.h" |
| 25 | |
| 26 | //#define DEBUG_SLB |
| 27 | |
| 28 | #ifdef DEBUG_SLB |
Paolo Bonzini | 48880da | 2015-11-13 13:34:23 +0100 | [diff] [blame] | 29 | # define LOG_SLB(...) qemu_log_mask(CPU_LOG_MMU, __VA_ARGS__) |
David Gibson | 10b4652 | 2013-03-12 00:31:06 +0000 | [diff] [blame] | 30 | #else |
| 31 | # define LOG_SLB(...) do { } while (0) |
| 32 | #endif |
| 33 | |
| 34 | /* |
Aneesh Kumar K.V | 7c43bca | 2014-02-20 18:52:24 +0100 | [diff] [blame] | 35 | * Used to indicate whether we have allocated htab in the |
| 36 | * host kernel |
| 37 | */ |
| 38 | bool kvmppc_kern_htab; |
| 39 | /* |
David Gibson | 10b4652 | 2013-03-12 00:31:06 +0000 | [diff] [blame] | 40 | * SLB handling |
| 41 | */ |
| 42 | |
David Gibson | 0480884 | 2013-03-12 00:31:09 +0000 | [diff] [blame] | 43 | static ppc_slb_t *slb_lookup(CPUPPCState *env, target_ulong eaddr) |
David Gibson | 10b4652 | 2013-03-12 00:31:06 +0000 | [diff] [blame] | 44 | { |
| 45 | uint64_t esid_256M, esid_1T; |
| 46 | int n; |
| 47 | |
| 48 | LOG_SLB("%s: eaddr " TARGET_FMT_lx "\n", __func__, eaddr); |
| 49 | |
| 50 | esid_256M = (eaddr & SEGMENT_MASK_256M) | SLB_ESID_V; |
| 51 | esid_1T = (eaddr & SEGMENT_MASK_1T) | SLB_ESID_V; |
| 52 | |
| 53 | for (n = 0; n < env->slb_nr; n++) { |
| 54 | ppc_slb_t *slb = &env->slb[n]; |
| 55 | |
| 56 | LOG_SLB("%s: slot %d %016" PRIx64 " %016" |
| 57 | PRIx64 "\n", __func__, n, slb->esid, slb->vsid); |
| 58 | /* We check for 1T matches on all MMUs here - if the MMU |
| 59 | * doesn't have 1T segment support, we will have prevented 1T |
| 60 | * entries from being inserted in the slbmte code. */ |
| 61 | if (((slb->esid == esid_256M) && |
| 62 | ((slb->vsid & SLB_VSID_B) == SLB_VSID_B_256M)) |
| 63 | || ((slb->esid == esid_1T) && |
| 64 | ((slb->vsid & SLB_VSID_B) == SLB_VSID_B_1T))) { |
| 65 | return slb; |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | return NULL; |
| 70 | } |
| 71 | |
| 72 | void dump_slb(FILE *f, fprintf_function cpu_fprintf, CPUPPCState *env) |
| 73 | { |
| 74 | int i; |
| 75 | uint64_t slbe, slbv; |
| 76 | |
Andreas Färber | cb446ec | 2013-05-01 14:24:52 +0200 | [diff] [blame] | 77 | cpu_synchronize_state(CPU(ppc_env_get_cpu(env))); |
David Gibson | 10b4652 | 2013-03-12 00:31:06 +0000 | [diff] [blame] | 78 | |
| 79 | cpu_fprintf(f, "SLB\tESID\t\t\tVSID\n"); |
| 80 | for (i = 0; i < env->slb_nr; i++) { |
| 81 | slbe = env->slb[i].esid; |
| 82 | slbv = env->slb[i].vsid; |
| 83 | if (slbe == 0 && slbv == 0) { |
| 84 | continue; |
| 85 | } |
| 86 | cpu_fprintf(f, "%d\t0x%016" PRIx64 "\t0x%016" PRIx64 "\n", |
| 87 | i, slbe, slbv); |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | void helper_slbia(CPUPPCState *env) |
| 92 | { |
Andreas Färber | 00c8cb0 | 2013-09-04 02:19:44 +0200 | [diff] [blame] | 93 | PowerPCCPU *cpu = ppc_env_get_cpu(env); |
David Gibson | 10b4652 | 2013-03-12 00:31:06 +0000 | [diff] [blame] | 94 | int n, do_invalidate; |
| 95 | |
| 96 | do_invalidate = 0; |
| 97 | /* XXX: Warning: slbia never invalidates the first segment */ |
| 98 | for (n = 1; n < env->slb_nr; n++) { |
| 99 | ppc_slb_t *slb = &env->slb[n]; |
| 100 | |
| 101 | if (slb->esid & SLB_ESID_V) { |
| 102 | slb->esid &= ~SLB_ESID_V; |
| 103 | /* XXX: given the fact that segment size is 256 MB or 1TB, |
| 104 | * and we still don't have a tlb_flush_mask(env, n, mask) |
| 105 | * in QEMU, we just invalidate all TLBs |
| 106 | */ |
| 107 | do_invalidate = 1; |
| 108 | } |
| 109 | } |
| 110 | if (do_invalidate) { |
Andreas Färber | 00c8cb0 | 2013-09-04 02:19:44 +0200 | [diff] [blame] | 111 | tlb_flush(CPU(cpu), 1); |
David Gibson | 10b4652 | 2013-03-12 00:31:06 +0000 | [diff] [blame] | 112 | } |
| 113 | } |
| 114 | |
| 115 | void helper_slbie(CPUPPCState *env, target_ulong addr) |
| 116 | { |
Andreas Färber | 00c8cb0 | 2013-09-04 02:19:44 +0200 | [diff] [blame] | 117 | PowerPCCPU *cpu = ppc_env_get_cpu(env); |
David Gibson | 10b4652 | 2013-03-12 00:31:06 +0000 | [diff] [blame] | 118 | ppc_slb_t *slb; |
| 119 | |
| 120 | slb = slb_lookup(env, addr); |
| 121 | if (!slb) { |
| 122 | return; |
| 123 | } |
| 124 | |
| 125 | if (slb->esid & SLB_ESID_V) { |
| 126 | slb->esid &= ~SLB_ESID_V; |
| 127 | |
| 128 | /* XXX: given the fact that segment size is 256 MB or 1TB, |
| 129 | * and we still don't have a tlb_flush_mask(env, n, mask) |
| 130 | * in QEMU, we just invalidate all TLBs |
| 131 | */ |
Andreas Färber | 00c8cb0 | 2013-09-04 02:19:44 +0200 | [diff] [blame] | 132 | tlb_flush(CPU(cpu), 1); |
David Gibson | 10b4652 | 2013-03-12 00:31:06 +0000 | [diff] [blame] | 133 | } |
| 134 | } |
| 135 | |
| 136 | int ppc_store_slb(CPUPPCState *env, target_ulong rb, target_ulong rs) |
| 137 | { |
| 138 | int slot = rb & 0xfff; |
| 139 | ppc_slb_t *slb = &env->slb[slot]; |
| 140 | |
| 141 | if (rb & (0x1000 - env->slb_nr)) { |
| 142 | return -1; /* Reserved bits set or slot too high */ |
| 143 | } |
| 144 | if (rs & (SLB_VSID_B & ~SLB_VSID_B_1T)) { |
| 145 | return -1; /* Bad segment size */ |
| 146 | } |
| 147 | if ((rs & SLB_VSID_B) && !(env->mmu_model & POWERPC_MMU_1TSEG)) { |
| 148 | return -1; /* 1T segment on MMU that doesn't support it */ |
| 149 | } |
| 150 | |
| 151 | /* Mask out the slot number as we store the entry */ |
| 152 | slb->esid = rb & (SLB_ESID_ESID | SLB_ESID_V); |
| 153 | slb->vsid = rs; |
| 154 | |
| 155 | LOG_SLB("%s: %d " TARGET_FMT_lx " - " TARGET_FMT_lx " => %016" PRIx64 |
| 156 | " %016" PRIx64 "\n", __func__, slot, rb, rs, |
| 157 | slb->esid, slb->vsid); |
| 158 | |
| 159 | return 0; |
| 160 | } |
| 161 | |
| 162 | static int ppc_load_slb_esid(CPUPPCState *env, target_ulong rb, |
| 163 | target_ulong *rt) |
| 164 | { |
| 165 | int slot = rb & 0xfff; |
| 166 | ppc_slb_t *slb = &env->slb[slot]; |
| 167 | |
| 168 | if (slot >= env->slb_nr) { |
| 169 | return -1; |
| 170 | } |
| 171 | |
| 172 | *rt = slb->esid; |
| 173 | return 0; |
| 174 | } |
| 175 | |
| 176 | static int ppc_load_slb_vsid(CPUPPCState *env, target_ulong rb, |
| 177 | target_ulong *rt) |
| 178 | { |
| 179 | int slot = rb & 0xfff; |
| 180 | ppc_slb_t *slb = &env->slb[slot]; |
| 181 | |
| 182 | if (slot >= env->slb_nr) { |
| 183 | return -1; |
| 184 | } |
| 185 | |
| 186 | *rt = slb->vsid; |
| 187 | return 0; |
| 188 | } |
| 189 | |
| 190 | void helper_store_slb(CPUPPCState *env, target_ulong rb, target_ulong rs) |
| 191 | { |
| 192 | if (ppc_store_slb(env, rb, rs) < 0) { |
| 193 | helper_raise_exception_err(env, POWERPC_EXCP_PROGRAM, |
| 194 | POWERPC_EXCP_INVAL); |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | target_ulong helper_load_slb_esid(CPUPPCState *env, target_ulong rb) |
| 199 | { |
| 200 | target_ulong rt = 0; |
| 201 | |
| 202 | if (ppc_load_slb_esid(env, rb, &rt) < 0) { |
| 203 | helper_raise_exception_err(env, POWERPC_EXCP_PROGRAM, |
| 204 | POWERPC_EXCP_INVAL); |
| 205 | } |
| 206 | return rt; |
| 207 | } |
| 208 | |
| 209 | target_ulong helper_load_slb_vsid(CPUPPCState *env, target_ulong rb) |
| 210 | { |
| 211 | target_ulong rt = 0; |
| 212 | |
| 213 | if (ppc_load_slb_vsid(env, rb, &rt) < 0) { |
| 214 | helper_raise_exception_err(env, POWERPC_EXCP_PROGRAM, |
| 215 | POWERPC_EXCP_INVAL); |
| 216 | } |
| 217 | return rt; |
| 218 | } |
David Gibson | 9d7c3f4 | 2013-03-12 00:31:07 +0000 | [diff] [blame] | 219 | |
| 220 | /* |
| 221 | * 64-bit hash table MMU handling |
| 222 | */ |
| 223 | |
David Gibson | e01b444 | 2013-03-12 00:31:40 +0000 | [diff] [blame] | 224 | static int ppc_hash64_pte_prot(CPUPPCState *env, |
| 225 | ppc_slb_t *slb, ppc_hash_pte64_t pte) |
David Gibson | 496272a | 2013-03-12 00:31:14 +0000 | [diff] [blame] | 226 | { |
David Gibson | e01b444 | 2013-03-12 00:31:40 +0000 | [diff] [blame] | 227 | unsigned pp, key; |
| 228 | /* Some pp bit combinations have undefined behaviour, so default |
| 229 | * to no access in those cases */ |
| 230 | int prot = 0; |
David Gibson | 496272a | 2013-03-12 00:31:14 +0000 | [diff] [blame] | 231 | |
David Gibson | e01b444 | 2013-03-12 00:31:40 +0000 | [diff] [blame] | 232 | key = !!(msr_pr ? (slb->vsid & SLB_VSID_KP) |
| 233 | : (slb->vsid & SLB_VSID_KS)); |
| 234 | pp = (pte.pte1 & HPTE64_R_PP) | ((pte.pte1 & HPTE64_R_PP0) >> 61); |
| 235 | |
David Gibson | 496272a | 2013-03-12 00:31:14 +0000 | [diff] [blame] | 236 | if (key == 0) { |
| 237 | switch (pp) { |
| 238 | case 0x0: |
| 239 | case 0x1: |
| 240 | case 0x2: |
David Gibson | e01b444 | 2013-03-12 00:31:40 +0000 | [diff] [blame] | 241 | prot = PAGE_READ | PAGE_WRITE; |
| 242 | break; |
| 243 | |
David Gibson | 496272a | 2013-03-12 00:31:14 +0000 | [diff] [blame] | 244 | case 0x3: |
| 245 | case 0x6: |
David Gibson | e01b444 | 2013-03-12 00:31:40 +0000 | [diff] [blame] | 246 | prot = PAGE_READ; |
David Gibson | 496272a | 2013-03-12 00:31:14 +0000 | [diff] [blame] | 247 | break; |
| 248 | } |
| 249 | } else { |
| 250 | switch (pp) { |
| 251 | case 0x0: |
| 252 | case 0x6: |
David Gibson | e01b444 | 2013-03-12 00:31:40 +0000 | [diff] [blame] | 253 | prot = 0; |
David Gibson | 496272a | 2013-03-12 00:31:14 +0000 | [diff] [blame] | 254 | break; |
David Gibson | e01b444 | 2013-03-12 00:31:40 +0000 | [diff] [blame] | 255 | |
David Gibson | 496272a | 2013-03-12 00:31:14 +0000 | [diff] [blame] | 256 | case 0x1: |
| 257 | case 0x3: |
David Gibson | e01b444 | 2013-03-12 00:31:40 +0000 | [diff] [blame] | 258 | prot = PAGE_READ; |
David Gibson | 496272a | 2013-03-12 00:31:14 +0000 | [diff] [blame] | 259 | break; |
David Gibson | e01b444 | 2013-03-12 00:31:40 +0000 | [diff] [blame] | 260 | |
David Gibson | 496272a | 2013-03-12 00:31:14 +0000 | [diff] [blame] | 261 | case 0x2: |
David Gibson | e01b444 | 2013-03-12 00:31:40 +0000 | [diff] [blame] | 262 | prot = PAGE_READ | PAGE_WRITE; |
David Gibson | 496272a | 2013-03-12 00:31:14 +0000 | [diff] [blame] | 263 | break; |
| 264 | } |
| 265 | } |
David Gibson | e01b444 | 2013-03-12 00:31:40 +0000 | [diff] [blame] | 266 | |
| 267 | /* No execute if either noexec or guarded bits set */ |
David Gibson | 57d0a39 | 2013-03-12 00:31:41 +0000 | [diff] [blame] | 268 | if (!(pte.pte1 & HPTE64_R_N) || (pte.pte1 & HPTE64_R_G) |
| 269 | || (slb->vsid & SLB_VSID_N)) { |
David Gibson | e01b444 | 2013-03-12 00:31:40 +0000 | [diff] [blame] | 270 | prot |= PAGE_EXEC; |
David Gibson | 496272a | 2013-03-12 00:31:14 +0000 | [diff] [blame] | 271 | } |
| 272 | |
David Gibson | e01b444 | 2013-03-12 00:31:40 +0000 | [diff] [blame] | 273 | return prot; |
David Gibson | 496272a | 2013-03-12 00:31:14 +0000 | [diff] [blame] | 274 | } |
| 275 | |
David Gibson | f80872e | 2013-03-12 00:31:47 +0000 | [diff] [blame] | 276 | static int ppc_hash64_amr_prot(CPUPPCState *env, ppc_hash_pte64_t pte) |
| 277 | { |
| 278 | int key, amrbits; |
Cédric Le Goater | 363248e | 2014-02-04 18:21:39 +0100 | [diff] [blame] | 279 | int prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; |
David Gibson | f80872e | 2013-03-12 00:31:47 +0000 | [diff] [blame] | 280 | |
| 281 | |
| 282 | /* Only recent MMUs implement Virtual Page Class Key Protection */ |
| 283 | if (!(env->mmu_model & POWERPC_MMU_AMR)) { |
Cédric Le Goater | 363248e | 2014-02-04 18:21:39 +0100 | [diff] [blame] | 284 | return prot; |
David Gibson | f80872e | 2013-03-12 00:31:47 +0000 | [diff] [blame] | 285 | } |
| 286 | |
| 287 | key = HPTE64_R_KEY(pte.pte1); |
| 288 | amrbits = (env->spr[SPR_AMR] >> 2*(31 - key)) & 0x3; |
| 289 | |
| 290 | /* fprintf(stderr, "AMR protection: key=%d AMR=0x%" PRIx64 "\n", key, */ |
| 291 | /* env->spr[SPR_AMR]); */ |
| 292 | |
Cédric Le Goater | 363248e | 2014-02-04 18:21:39 +0100 | [diff] [blame] | 293 | /* |
| 294 | * A store is permitted if the AMR bit is 0. Remove write |
| 295 | * protection if it is set. |
| 296 | */ |
David Gibson | f80872e | 2013-03-12 00:31:47 +0000 | [diff] [blame] | 297 | if (amrbits & 0x2) { |
Cédric Le Goater | 363248e | 2014-02-04 18:21:39 +0100 | [diff] [blame] | 298 | prot &= ~PAGE_WRITE; |
David Gibson | f80872e | 2013-03-12 00:31:47 +0000 | [diff] [blame] | 299 | } |
Cédric Le Goater | 363248e | 2014-02-04 18:21:39 +0100 | [diff] [blame] | 300 | /* |
| 301 | * A load is permitted if the AMR bit is 0. Remove read |
| 302 | * protection if it is set. |
| 303 | */ |
David Gibson | f80872e | 2013-03-12 00:31:47 +0000 | [diff] [blame] | 304 | if (amrbits & 0x1) { |
Cédric Le Goater | 363248e | 2014-02-04 18:21:39 +0100 | [diff] [blame] | 305 | prot &= ~PAGE_READ; |
David Gibson | f80872e | 2013-03-12 00:31:47 +0000 | [diff] [blame] | 306 | } |
| 307 | |
| 308 | return prot; |
| 309 | } |
| 310 | |
Aneesh Kumar K.V | 7c43bca | 2014-02-20 18:52:24 +0100 | [diff] [blame] | 311 | uint64_t ppc_hash64_start_access(PowerPCCPU *cpu, target_ulong pte_index) |
| 312 | { |
| 313 | uint64_t token = 0; |
| 314 | hwaddr pte_offset; |
| 315 | |
| 316 | pte_offset = pte_index * HASH_PTE_SIZE_64; |
| 317 | if (kvmppc_kern_htab) { |
| 318 | /* |
| 319 | * HTAB is controlled by KVM. Fetch the PTEG into a new buffer. |
| 320 | */ |
| 321 | token = kvmppc_hash64_read_pteg(cpu, pte_index); |
| 322 | if (token) { |
| 323 | return token; |
| 324 | } |
| 325 | /* |
| 326 | * pteg read failed, even though we have allocated htab via |
| 327 | * kvmppc_reset_htab. |
| 328 | */ |
| 329 | return 0; |
| 330 | } |
| 331 | /* |
| 332 | * HTAB is controlled by QEMU. Just point to the internally |
| 333 | * accessible PTEG. |
| 334 | */ |
| 335 | if (cpu->env.external_htab) { |
| 336 | token = (uint64_t)(uintptr_t) cpu->env.external_htab + pte_offset; |
| 337 | } else if (cpu->env.htab_base) { |
| 338 | token = cpu->env.htab_base + pte_offset; |
| 339 | } |
| 340 | return token; |
| 341 | } |
| 342 | |
| 343 | void ppc_hash64_stop_access(uint64_t token) |
| 344 | { |
| 345 | if (kvmppc_kern_htab) { |
Stefan Weil | a9ab06d | 2015-03-07 23:16:38 +0100 | [diff] [blame] | 346 | kvmppc_hash64_free_pteg(token); |
Aneesh Kumar K.V | 7c43bca | 2014-02-20 18:52:24 +0100 | [diff] [blame] | 347 | } |
| 348 | } |
| 349 | |
| 350 | static hwaddr ppc_hash64_pteg_search(CPUPPCState *env, hwaddr hash, |
David Gibson | aea390e | 2013-03-12 00:31:28 +0000 | [diff] [blame] | 351 | bool secondary, target_ulong ptem, |
| 352 | ppc_hash_pte64_t *pte) |
| 353 | { |
David Gibson | aea390e | 2013-03-12 00:31:28 +0000 | [diff] [blame] | 354 | int i; |
Aneesh Kumar K.V | 7c43bca | 2014-02-20 18:52:24 +0100 | [diff] [blame] | 355 | uint64_t token; |
| 356 | target_ulong pte0, pte1; |
| 357 | target_ulong pte_index; |
David Gibson | aea390e | 2013-03-12 00:31:28 +0000 | [diff] [blame] | 358 | |
Aneesh Kumar K.V | 7c43bca | 2014-02-20 18:52:24 +0100 | [diff] [blame] | 359 | pte_index = (hash & env->htab_mask) * HPTES_PER_GROUP; |
| 360 | token = ppc_hash64_start_access(ppc_env_get_cpu(env), pte_index); |
| 361 | if (!token) { |
| 362 | return -1; |
| 363 | } |
David Gibson | aea390e | 2013-03-12 00:31:28 +0000 | [diff] [blame] | 364 | for (i = 0; i < HPTES_PER_GROUP; i++) { |
Aneesh Kumar K.V | 7c43bca | 2014-02-20 18:52:24 +0100 | [diff] [blame] | 365 | pte0 = ppc_hash64_load_hpte0(env, token, i); |
| 366 | pte1 = ppc_hash64_load_hpte1(env, token, i); |
David Gibson | aea390e | 2013-03-12 00:31:28 +0000 | [diff] [blame] | 367 | |
| 368 | if ((pte0 & HPTE64_V_VALID) |
| 369 | && (secondary == !!(pte0 & HPTE64_V_SECONDARY)) |
| 370 | && HPTE64_V_COMPARE(pte0, ptem)) { |
| 371 | pte->pte0 = pte0; |
| 372 | pte->pte1 = pte1; |
Aneesh Kumar K.V | 7c43bca | 2014-02-20 18:52:24 +0100 | [diff] [blame] | 373 | ppc_hash64_stop_access(token); |
| 374 | return (pte_index + i) * HASH_PTE_SIZE_64; |
David Gibson | aea390e | 2013-03-12 00:31:28 +0000 | [diff] [blame] | 375 | } |
David Gibson | aea390e | 2013-03-12 00:31:28 +0000 | [diff] [blame] | 376 | } |
Aneesh Kumar K.V | 7c43bca | 2014-02-20 18:52:24 +0100 | [diff] [blame] | 377 | ppc_hash64_stop_access(token); |
| 378 | /* |
| 379 | * We didn't find a valid entry. |
| 380 | */ |
David Gibson | aea390e | 2013-03-12 00:31:28 +0000 | [diff] [blame] | 381 | return -1; |
| 382 | } |
| 383 | |
Aneesh Kumar K.V | ad3e67d | 2015-01-26 19:51:58 +0530 | [diff] [blame] | 384 | static uint64_t ppc_hash64_page_shift(ppc_slb_t *slb) |
| 385 | { |
| 386 | uint64_t epnshift; |
| 387 | |
| 388 | /* Page size according to the SLB, which we use to generate the |
| 389 | * EPN for hash table lookup.. When we implement more recent MMU |
| 390 | * extensions this might be different from the actual page size |
| 391 | * encoded in the PTE */ |
| 392 | if ((slb->vsid & SLB_VSID_LLP_MASK) == SLB_VSID_4K) { |
| 393 | epnshift = TARGET_PAGE_BITS; |
| 394 | } else if ((slb->vsid & SLB_VSID_LLP_MASK) == SLB_VSID_64K) { |
| 395 | epnshift = TARGET_PAGE_BITS_64K; |
| 396 | } else { |
| 397 | epnshift = TARGET_PAGE_BITS_16M; |
| 398 | } |
| 399 | return epnshift; |
| 400 | } |
| 401 | |
David Gibson | 7f3bdc2 | 2013-03-12 00:31:30 +0000 | [diff] [blame] | 402 | static hwaddr ppc_hash64_htab_lookup(CPUPPCState *env, |
| 403 | ppc_slb_t *slb, target_ulong eaddr, |
| 404 | ppc_hash_pte64_t *pte) |
David Gibson | c69b615 | 2013-03-12 00:31:08 +0000 | [diff] [blame] | 405 | { |
Aneesh Kumar K.V | 7c43bca | 2014-02-20 18:52:24 +0100 | [diff] [blame] | 406 | hwaddr pte_offset; |
David Gibson | a1ff751 | 2013-03-12 00:31:29 +0000 | [diff] [blame] | 407 | hwaddr hash; |
David Gibson | 1814889 | 2013-03-12 00:31:31 +0000 | [diff] [blame] | 408 | uint64_t vsid, epnshift, epnmask, epn, ptem; |
David Gibson | a1ff751 | 2013-03-12 00:31:29 +0000 | [diff] [blame] | 409 | |
Aneesh Kumar K.V | ad3e67d | 2015-01-26 19:51:58 +0530 | [diff] [blame] | 410 | epnshift = ppc_hash64_page_shift(slb); |
David Gibson | 1814889 | 2013-03-12 00:31:31 +0000 | [diff] [blame] | 411 | epnmask = ~((1ULL << epnshift) - 1); |
David Gibson | a1ff751 | 2013-03-12 00:31:29 +0000 | [diff] [blame] | 412 | |
David Gibson | a1ff751 | 2013-03-12 00:31:29 +0000 | [diff] [blame] | 413 | if (slb->vsid & SLB_VSID_B) { |
David Gibson | 1814889 | 2013-03-12 00:31:31 +0000 | [diff] [blame] | 414 | /* 1TB segment */ |
| 415 | vsid = (slb->vsid & SLB_VSID_VSID) >> SLB_VSID_SHIFT_1T; |
| 416 | epn = (eaddr & ~SEGMENT_MASK_1T) & epnmask; |
| 417 | hash = vsid ^ (vsid << 25) ^ (epn >> epnshift); |
David Gibson | a1ff751 | 2013-03-12 00:31:29 +0000 | [diff] [blame] | 418 | } else { |
David Gibson | 1814889 | 2013-03-12 00:31:31 +0000 | [diff] [blame] | 419 | /* 256M segment */ |
| 420 | vsid = (slb->vsid & SLB_VSID_VSID) >> SLB_VSID_SHIFT; |
| 421 | epn = (eaddr & ~SEGMENT_MASK_256M) & epnmask; |
| 422 | hash = vsid ^ (epn >> epnshift); |
David Gibson | a1ff751 | 2013-03-12 00:31:29 +0000 | [diff] [blame] | 423 | } |
David Gibson | 1814889 | 2013-03-12 00:31:31 +0000 | [diff] [blame] | 424 | ptem = (slb->vsid & SLB_VSID_PTEM) | ((epn >> 16) & HPTE64_V_AVPN); |
David Gibson | a1ff751 | 2013-03-12 00:31:29 +0000 | [diff] [blame] | 425 | |
David Gibson | a1ff751 | 2013-03-12 00:31:29 +0000 | [diff] [blame] | 426 | /* Page address translation */ |
Antony Pavlov | 339aaf5 | 2014-12-13 19:48:18 +0300 | [diff] [blame] | 427 | qemu_log_mask(CPU_LOG_MMU, |
| 428 | "htab_base " TARGET_FMT_plx " htab_mask " TARGET_FMT_plx |
David Gibson | a1ff751 | 2013-03-12 00:31:29 +0000 | [diff] [blame] | 429 | " hash " TARGET_FMT_plx "\n", |
| 430 | env->htab_base, env->htab_mask, hash); |
| 431 | |
David Gibson | a1ff751 | 2013-03-12 00:31:29 +0000 | [diff] [blame] | 432 | /* Primary PTEG lookup */ |
Antony Pavlov | 339aaf5 | 2014-12-13 19:48:18 +0300 | [diff] [blame] | 433 | qemu_log_mask(CPU_LOG_MMU, |
| 434 | "0 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx |
David Gibson | a1ff751 | 2013-03-12 00:31:29 +0000 | [diff] [blame] | 435 | " vsid=" TARGET_FMT_lx " ptem=" TARGET_FMT_lx |
| 436 | " hash=" TARGET_FMT_plx "\n", |
| 437 | env->htab_base, env->htab_mask, vsid, ptem, hash); |
Aneesh Kumar K.V | 7c43bca | 2014-02-20 18:52:24 +0100 | [diff] [blame] | 438 | pte_offset = ppc_hash64_pteg_search(env, hash, 0, ptem, pte); |
David Gibson | 7f3bdc2 | 2013-03-12 00:31:30 +0000 | [diff] [blame] | 439 | |
David Gibson | a1ff751 | 2013-03-12 00:31:29 +0000 | [diff] [blame] | 440 | if (pte_offset == -1) { |
| 441 | /* Secondary PTEG lookup */ |
Antony Pavlov | 339aaf5 | 2014-12-13 19:48:18 +0300 | [diff] [blame] | 442 | qemu_log_mask(CPU_LOG_MMU, |
| 443 | "1 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx |
David Gibson | a1ff751 | 2013-03-12 00:31:29 +0000 | [diff] [blame] | 444 | " vsid=" TARGET_FMT_lx " api=" TARGET_FMT_lx |
| 445 | " hash=" TARGET_FMT_plx "\n", env->htab_base, |
| 446 | env->htab_mask, vsid, ptem, ~hash); |
| 447 | |
Aneesh Kumar K.V | 7c43bca | 2014-02-20 18:52:24 +0100 | [diff] [blame] | 448 | pte_offset = ppc_hash64_pteg_search(env, ~hash, 1, ptem, pte); |
David Gibson | a1ff751 | 2013-03-12 00:31:29 +0000 | [diff] [blame] | 449 | } |
| 450 | |
David Gibson | 7f3bdc2 | 2013-03-12 00:31:30 +0000 | [diff] [blame] | 451 | return pte_offset; |
David Gibson | c69b615 | 2013-03-12 00:31:08 +0000 | [diff] [blame] | 452 | } |
David Gibson | 0480884 | 2013-03-12 00:31:09 +0000 | [diff] [blame] | 453 | |
David Gibson | 6d11d99 | 2013-03-12 00:31:43 +0000 | [diff] [blame] | 454 | static hwaddr ppc_hash64_pte_raddr(ppc_slb_t *slb, ppc_hash_pte64_t pte, |
| 455 | target_ulong eaddr) |
| 456 | { |
Aneesh Kumar K.V | ad3e67d | 2015-01-26 19:51:58 +0530 | [diff] [blame] | 457 | hwaddr mask; |
| 458 | int target_page_bits; |
David Gibson | 75d5ec8 | 2013-03-12 00:31:44 +0000 | [diff] [blame] | 459 | hwaddr rpn = pte.pte1 & HPTE64_R_RPN; |
Aneesh Kumar K.V | ad3e67d | 2015-01-26 19:51:58 +0530 | [diff] [blame] | 460 | /* |
| 461 | * We support 4K, 64K and 16M now |
| 462 | */ |
| 463 | target_page_bits = ppc_hash64_page_shift(slb); |
| 464 | mask = (1ULL << target_page_bits) - 1; |
David Gibson | 6d11d99 | 2013-03-12 00:31:43 +0000 | [diff] [blame] | 465 | return (rpn & ~mask) | (eaddr & mask); |
| 466 | } |
| 467 | |
Andreas Färber | d0e39c5 | 2013-09-02 14:14:24 +0200 | [diff] [blame] | 468 | int ppc_hash64_handle_mmu_fault(PowerPCCPU *cpu, target_ulong eaddr, |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 469 | int rwx, int mmu_idx) |
David Gibson | 0480884 | 2013-03-12 00:31:09 +0000 | [diff] [blame] | 470 | { |
Andreas Färber | d0e39c5 | 2013-09-02 14:14:24 +0200 | [diff] [blame] | 471 | CPUState *cs = CPU(cpu); |
| 472 | CPUPPCState *env = &cpu->env; |
David Gibson | 0480884 | 2013-03-12 00:31:09 +0000 | [diff] [blame] | 473 | ppc_slb_t *slb; |
David Gibson | 7f3bdc2 | 2013-03-12 00:31:30 +0000 | [diff] [blame] | 474 | hwaddr pte_offset; |
| 475 | ppc_hash_pte64_t pte; |
David Gibson | f80872e | 2013-03-12 00:31:47 +0000 | [diff] [blame] | 476 | int pp_prot, amr_prot, prot; |
David Gibson | b344074 | 2013-03-12 00:31:42 +0000 | [diff] [blame] | 477 | uint64_t new_pte1; |
David Gibson | e01b444 | 2013-03-12 00:31:40 +0000 | [diff] [blame] | 478 | const int need_prot[] = {PAGE_READ, PAGE_WRITE, PAGE_EXEC}; |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 479 | hwaddr raddr; |
David Gibson | 0480884 | 2013-03-12 00:31:09 +0000 | [diff] [blame] | 480 | |
David Gibson | 6a98011 | 2013-03-12 00:31:32 +0000 | [diff] [blame] | 481 | assert((rwx == 0) || (rwx == 1) || (rwx == 2)); |
| 482 | |
David Gibson | 65d6164 | 2013-03-12 00:31:23 +0000 | [diff] [blame] | 483 | /* 1. Handle real mode accesses */ |
| 484 | if (((rwx == 2) && (msr_ir == 0)) || ((rwx != 2) && (msr_dr == 0))) { |
| 485 | /* Translation is off */ |
| 486 | /* In real mode the top 4 effective address bits are ignored */ |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 487 | raddr = eaddr & 0x0FFFFFFFFFFFFFFFULL; |
Andreas Färber | 0c591eb | 2013-09-03 13:59:37 +0200 | [diff] [blame] | 488 | tlb_set_page(cs, eaddr & TARGET_PAGE_MASK, raddr & TARGET_PAGE_MASK, |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 489 | PAGE_READ | PAGE_WRITE | PAGE_EXEC, mmu_idx, |
| 490 | TARGET_PAGE_SIZE); |
David Gibson | 65d6164 | 2013-03-12 00:31:23 +0000 | [diff] [blame] | 491 | return 0; |
| 492 | } |
| 493 | |
David Gibson | bb21804 | 2013-03-12 00:31:26 +0000 | [diff] [blame] | 494 | /* 2. Translation is on, so look up the SLB */ |
David Gibson | 0480884 | 2013-03-12 00:31:09 +0000 | [diff] [blame] | 495 | slb = slb_lookup(env, eaddr); |
David Gibson | bb21804 | 2013-03-12 00:31:26 +0000 | [diff] [blame] | 496 | |
David Gibson | 0480884 | 2013-03-12 00:31:09 +0000 | [diff] [blame] | 497 | if (!slb) { |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 498 | if (rwx == 2) { |
Andreas Färber | 2710342 | 2013-08-26 08:31:06 +0200 | [diff] [blame] | 499 | cs->exception_index = POWERPC_EXCP_ISEG; |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 500 | env->error_code = 0; |
| 501 | } else { |
Andreas Färber | 2710342 | 2013-08-26 08:31:06 +0200 | [diff] [blame] | 502 | cs->exception_index = POWERPC_EXCP_DSEG; |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 503 | env->error_code = 0; |
| 504 | env->spr[SPR_DAR] = eaddr; |
| 505 | } |
| 506 | return 1; |
David Gibson | 0480884 | 2013-03-12 00:31:09 +0000 | [diff] [blame] | 507 | } |
| 508 | |
David Gibson | bb21804 | 2013-03-12 00:31:26 +0000 | [diff] [blame] | 509 | /* 3. Check for segment level no-execute violation */ |
| 510 | if ((rwx == 2) && (slb->vsid & SLB_VSID_N)) { |
Andreas Färber | 2710342 | 2013-08-26 08:31:06 +0200 | [diff] [blame] | 511 | cs->exception_index = POWERPC_EXCP_ISI; |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 512 | env->error_code = 0x10000000; |
| 513 | return 1; |
David Gibson | bb21804 | 2013-03-12 00:31:26 +0000 | [diff] [blame] | 514 | } |
| 515 | |
David Gibson | 7f3bdc2 | 2013-03-12 00:31:30 +0000 | [diff] [blame] | 516 | /* 4. Locate the PTE in the hash table */ |
| 517 | pte_offset = ppc_hash64_htab_lookup(env, slb, eaddr, &pte); |
| 518 | if (pte_offset == -1) { |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 519 | if (rwx == 2) { |
Andreas Färber | 2710342 | 2013-08-26 08:31:06 +0200 | [diff] [blame] | 520 | cs->exception_index = POWERPC_EXCP_ISI; |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 521 | env->error_code = 0x40000000; |
| 522 | } else { |
Andreas Färber | 2710342 | 2013-08-26 08:31:06 +0200 | [diff] [blame] | 523 | cs->exception_index = POWERPC_EXCP_DSI; |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 524 | env->error_code = 0; |
| 525 | env->spr[SPR_DAR] = eaddr; |
| 526 | if (rwx == 1) { |
| 527 | env->spr[SPR_DSISR] = 0x42000000; |
| 528 | } else { |
| 529 | env->spr[SPR_DSISR] = 0x40000000; |
| 530 | } |
| 531 | } |
| 532 | return 1; |
David Gibson | 7f3bdc2 | 2013-03-12 00:31:30 +0000 | [diff] [blame] | 533 | } |
Antony Pavlov | 339aaf5 | 2014-12-13 19:48:18 +0300 | [diff] [blame] | 534 | qemu_log_mask(CPU_LOG_MMU, |
| 535 | "found PTE at offset %08" HWADDR_PRIx "\n", pte_offset); |
David Gibson | 0480884 | 2013-03-12 00:31:09 +0000 | [diff] [blame] | 536 | |
David Gibson | 7f3bdc2 | 2013-03-12 00:31:30 +0000 | [diff] [blame] | 537 | /* 5. Check access permissions */ |
David Gibson | 7f3bdc2 | 2013-03-12 00:31:30 +0000 | [diff] [blame] | 538 | |
David Gibson | f80872e | 2013-03-12 00:31:47 +0000 | [diff] [blame] | 539 | pp_prot = ppc_hash64_pte_prot(env, slb, pte); |
| 540 | amr_prot = ppc_hash64_amr_prot(env, pte); |
| 541 | prot = pp_prot & amr_prot; |
David Gibson | 6a98011 | 2013-03-12 00:31:32 +0000 | [diff] [blame] | 542 | |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 543 | if ((need_prot[rwx] & ~prot) != 0) { |
David Gibson | 6a98011 | 2013-03-12 00:31:32 +0000 | [diff] [blame] | 544 | /* Access right violation */ |
Antony Pavlov | 339aaf5 | 2014-12-13 19:48:18 +0300 | [diff] [blame] | 545 | qemu_log_mask(CPU_LOG_MMU, "PTE access rejected\n"); |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 546 | if (rwx == 2) { |
Andreas Färber | 2710342 | 2013-08-26 08:31:06 +0200 | [diff] [blame] | 547 | cs->exception_index = POWERPC_EXCP_ISI; |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 548 | env->error_code = 0x08000000; |
| 549 | } else { |
David Gibson | f80872e | 2013-03-12 00:31:47 +0000 | [diff] [blame] | 550 | target_ulong dsisr = 0; |
| 551 | |
Andreas Färber | 2710342 | 2013-08-26 08:31:06 +0200 | [diff] [blame] | 552 | cs->exception_index = POWERPC_EXCP_DSI; |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 553 | env->error_code = 0; |
| 554 | env->spr[SPR_DAR] = eaddr; |
David Gibson | f80872e | 2013-03-12 00:31:47 +0000 | [diff] [blame] | 555 | if (need_prot[rwx] & ~pp_prot) { |
| 556 | dsisr |= 0x08000000; |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 557 | } |
David Gibson | f80872e | 2013-03-12 00:31:47 +0000 | [diff] [blame] | 558 | if (rwx == 1) { |
| 559 | dsisr |= 0x02000000; |
| 560 | } |
| 561 | if (need_prot[rwx] & ~amr_prot) { |
| 562 | dsisr |= 0x00200000; |
| 563 | } |
| 564 | env->spr[SPR_DSISR] = dsisr; |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 565 | } |
| 566 | return 1; |
David Gibson | 6a98011 | 2013-03-12 00:31:32 +0000 | [diff] [blame] | 567 | } |
| 568 | |
Antony Pavlov | 339aaf5 | 2014-12-13 19:48:18 +0300 | [diff] [blame] | 569 | qemu_log_mask(CPU_LOG_MMU, "PTE access granted !\n"); |
David Gibson | 87dc3fd | 2013-03-12 00:31:38 +0000 | [diff] [blame] | 570 | |
| 571 | /* 6. Update PTE referenced and changed bits if necessary */ |
| 572 | |
David Gibson | b344074 | 2013-03-12 00:31:42 +0000 | [diff] [blame] | 573 | new_pte1 = pte.pte1 | HPTE64_R_R; /* set referenced bit */ |
| 574 | if (rwx == 1) { |
| 575 | new_pte1 |= HPTE64_R_C; /* set changed (dirty) bit */ |
| 576 | } else { |
| 577 | /* Treat the page as read-only for now, so that a later write |
| 578 | * will pass through this function again to set the C bit */ |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 579 | prot &= ~PAGE_WRITE; |
David Gibson | b344074 | 2013-03-12 00:31:42 +0000 | [diff] [blame] | 580 | } |
| 581 | |
| 582 | if (new_pte1 != pte.pte1) { |
Aneesh Kumar K.V | 3f94170 | 2014-02-20 18:52:31 +0100 | [diff] [blame] | 583 | ppc_hash64_store_hpte(env, pte_offset / HASH_PTE_SIZE_64, |
| 584 | pte.pte0, new_pte1); |
David Gibson | 7f3bdc2 | 2013-03-12 00:31:30 +0000 | [diff] [blame] | 585 | } |
| 586 | |
David Gibson | 6d11d99 | 2013-03-12 00:31:43 +0000 | [diff] [blame] | 587 | /* 7. Determine the real address from the PTE */ |
David Gibson | e01b444 | 2013-03-12 00:31:40 +0000 | [diff] [blame] | 588 | |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 589 | raddr = ppc_hash64_pte_raddr(slb, pte, eaddr); |
| 590 | |
Andreas Färber | 0c591eb | 2013-09-03 13:59:37 +0200 | [diff] [blame] | 591 | tlb_set_page(cs, eaddr & TARGET_PAGE_MASK, raddr & TARGET_PAGE_MASK, |
David Gibson | caa597b | 2013-03-12 00:31:46 +0000 | [diff] [blame] | 592 | prot, mmu_idx, TARGET_PAGE_SIZE); |
David Gibson | 6d11d99 | 2013-03-12 00:31:43 +0000 | [diff] [blame] | 593 | |
David Gibson | e01b444 | 2013-03-12 00:31:40 +0000 | [diff] [blame] | 594 | return 0; |
David Gibson | 0480884 | 2013-03-12 00:31:09 +0000 | [diff] [blame] | 595 | } |
David Gibson | 629bd51 | 2013-03-12 00:31:11 +0000 | [diff] [blame] | 596 | |
David Gibson | f2ad6be | 2013-03-12 00:31:13 +0000 | [diff] [blame] | 597 | hwaddr ppc_hash64_get_phys_page_debug(CPUPPCState *env, target_ulong addr) |
| 598 | { |
David Gibson | 5883d8b | 2013-03-12 00:31:45 +0000 | [diff] [blame] | 599 | ppc_slb_t *slb; |
| 600 | hwaddr pte_offset; |
| 601 | ppc_hash_pte64_t pte; |
David Gibson | f2ad6be | 2013-03-12 00:31:13 +0000 | [diff] [blame] | 602 | |
David Gibson | 5883d8b | 2013-03-12 00:31:45 +0000 | [diff] [blame] | 603 | if (msr_dr == 0) { |
| 604 | /* In real mode the top 4 effective address bits are ignored */ |
| 605 | return addr & 0x0FFFFFFFFFFFFFFFULL; |
| 606 | } |
| 607 | |
| 608 | slb = slb_lookup(env, addr); |
| 609 | if (!slb) { |
David Gibson | f2ad6be | 2013-03-12 00:31:13 +0000 | [diff] [blame] | 610 | return -1; |
| 611 | } |
| 612 | |
David Gibson | 5883d8b | 2013-03-12 00:31:45 +0000 | [diff] [blame] | 613 | pte_offset = ppc_hash64_htab_lookup(env, slb, addr, &pte); |
| 614 | if (pte_offset == -1) { |
| 615 | return -1; |
| 616 | } |
| 617 | |
| 618 | return ppc_hash64_pte_raddr(slb, pte, addr) & TARGET_PAGE_MASK; |
David Gibson | f2ad6be | 2013-03-12 00:31:13 +0000 | [diff] [blame] | 619 | } |
Aneesh Kumar K.V | c138593 | 2014-02-20 18:52:38 +0100 | [diff] [blame] | 620 | |
| 621 | void ppc_hash64_store_hpte(CPUPPCState *env, |
| 622 | target_ulong pte_index, |
| 623 | target_ulong pte0, target_ulong pte1) |
| 624 | { |
Andreas Färber | 33276f1 | 2014-03-09 19:29:41 +0100 | [diff] [blame] | 625 | CPUState *cs = CPU(ppc_env_get_cpu(env)); |
Aneesh Kumar K.V | c138593 | 2014-02-20 18:52:38 +0100 | [diff] [blame] | 626 | |
| 627 | if (kvmppc_kern_htab) { |
Stefan Weil | a9ab06d | 2015-03-07 23:16:38 +0100 | [diff] [blame] | 628 | kvmppc_hash64_write_pte(env, pte_index, pte0, pte1); |
| 629 | return; |
Aneesh Kumar K.V | c138593 | 2014-02-20 18:52:38 +0100 | [diff] [blame] | 630 | } |
| 631 | |
| 632 | pte_index *= HASH_PTE_SIZE_64; |
| 633 | if (env->external_htab) { |
| 634 | stq_p(env->external_htab + pte_index, pte0); |
| 635 | stq_p(env->external_htab + pte_index + HASH_PTE_SIZE_64/2, pte1); |
| 636 | } else { |
| 637 | stq_phys(cs->as, env->htab_base + pte_index, pte0); |
| 638 | stq_phys(cs->as, env->htab_base + pte_index + HASH_PTE_SIZE_64/2, pte1); |
| 639 | } |
| 640 | } |