2017-10-01 23:11:45 +03:00
|
|
|
/*
|
|
|
|
* HPPA memory access helper routines
|
|
|
|
*
|
|
|
|
* Copyright (c) 2017 Helge Deller
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2020-10-23 15:33:53 +03:00
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2017-10-01 23:11:45 +03:00
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "qemu/osdep.h"
|
2022-02-07 11:27:56 +03:00
|
|
|
#include "qemu/log.h"
|
2017-10-01 23:11:45 +03:00
|
|
|
#include "cpu.h"
|
|
|
|
#include "exec/exec-all.h"
|
|
|
|
#include "exec/helper-proto.h"
|
2019-07-09 18:20:52 +03:00
|
|
|
#include "hw/core/cpu.h"
|
2019-03-11 22:15:55 +03:00
|
|
|
#include "trace.h"
|
2017-10-01 23:11:45 +03:00
|
|
|
|
2023-09-18 00:54:16 +03:00
|
|
|
hwaddr hppa_abs_to_phys_pa2_w1(vaddr addr)
|
|
|
|
{
|
2023-11-07 20:28:56 +03:00
|
|
|
/*
|
|
|
|
* Figure H-8 "62-bit Absolute Accesses when PSW W-bit is 1" describes
|
|
|
|
* an algorithm in which a 62-bit absolute address is transformed to
|
|
|
|
* a 64-bit physical address. This must then be combined with that
|
|
|
|
* pictured in Figure H-11 "Physical Address Space Mapping", in which
|
|
|
|
* the full physical address is truncated to the N-bit physical address
|
|
|
|
* supported by the implementation.
|
|
|
|
*
|
|
|
|
* Since the supported physical address space is below 54 bits, the
|
|
|
|
* H-8 algorithm is moot and all that is left is to truncate.
|
|
|
|
*/
|
|
|
|
QEMU_BUILD_BUG_ON(TARGET_PHYS_ADDR_SPACE_BITS > 54);
|
|
|
|
return sextract64(addr, 0, TARGET_PHYS_ADDR_SPACE_BITS);
|
2023-09-18 00:54:16 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
hwaddr hppa_abs_to_phys_pa2_w0(vaddr addr)
|
|
|
|
{
|
2023-11-07 20:28:56 +03:00
|
|
|
/*
|
|
|
|
* See Figure H-10, "Absolute Accesses when PSW W-bit is 0",
|
|
|
|
* combined with Figure H-11, as above.
|
|
|
|
*/
|
2023-09-18 00:54:16 +03:00
|
|
|
if (likely(extract32(addr, 28, 4) != 0xf)) {
|
|
|
|
/* Memory address space */
|
2023-11-07 20:28:56 +03:00
|
|
|
addr = (uint32_t)addr;
|
|
|
|
} else if (extract32(addr, 24, 4) != 0) {
|
2023-09-18 00:54:16 +03:00
|
|
|
/* I/O address space */
|
2023-11-07 20:28:56 +03:00
|
|
|
addr = (int32_t)addr;
|
|
|
|
} else {
|
2024-01-03 21:55:55 +03:00
|
|
|
/*
|
|
|
|
* PDC address space:
|
|
|
|
* Figures H-10 and H-11 of the parisc2.0 spec do not specify
|
|
|
|
* where to map into the 64-bit PDC address space.
|
|
|
|
* We map with an offset which equals the 32-bit address, which
|
|
|
|
* is what can be seen on physical machines too.
|
|
|
|
*/
|
|
|
|
addr = (uint32_t)addr;
|
2023-11-07 20:28:56 +03:00
|
|
|
addr |= -1ull << (TARGET_PHYS_ADDR_SPACE_BITS - 4);
|
2023-09-18 00:54:16 +03:00
|
|
|
}
|
2023-11-07 20:28:56 +03:00
|
|
|
return addr;
|
2023-09-18 00:54:16 +03:00
|
|
|
}
|
|
|
|
|
2023-10-27 08:13:12 +03:00
|
|
|
static HPPATLBEntry *hppa_find_tlb(CPUHPPAState *env, vaddr addr)
|
2017-10-27 11:17:12 +03:00
|
|
|
{
|
2023-10-27 10:24:30 +03:00
|
|
|
IntervalTreeNode *i = interval_tree_iter_first(&env->tlb_root, addr, addr);
|
2017-10-27 11:17:12 +03:00
|
|
|
|
2023-10-27 10:24:30 +03:00
|
|
|
if (i) {
|
|
|
|
HPPATLBEntry *ent = container_of(i, HPPATLBEntry, itree);
|
|
|
|
trace_hppa_tlb_find_entry(env, ent, ent->entry_valid,
|
|
|
|
ent->itree.start, ent->itree.last, ent->pa);
|
|
|
|
return ent;
|
2017-10-27 11:17:12 +03:00
|
|
|
}
|
2019-03-11 22:15:55 +03:00
|
|
|
trace_hppa_tlb_find_entry_not_found(env, addr);
|
2017-10-27 11:17:12 +03:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2023-10-27 08:13:12 +03:00
|
|
|
static void hppa_flush_tlb_ent(CPUHPPAState *env, HPPATLBEntry *ent,
|
2023-09-13 11:55:59 +03:00
|
|
|
bool force_flush_btlb)
|
2017-10-27 17:26:36 +03:00
|
|
|
{
|
2019-03-23 03:51:33 +03:00
|
|
|
CPUState *cs = env_cpu(env);
|
2023-10-27 10:24:30 +03:00
|
|
|
bool is_btlb;
|
2023-09-13 11:55:59 +03:00
|
|
|
|
|
|
|
if (!ent->entry_valid) {
|
|
|
|
return;
|
|
|
|
}
|
2017-10-27 17:26:36 +03:00
|
|
|
|
2023-10-27 08:21:47 +03:00
|
|
|
trace_hppa_tlb_flush_ent(env, ent, ent->itree.start,
|
|
|
|
ent->itree.last, ent->pa);
|
2019-03-11 22:15:55 +03:00
|
|
|
|
2023-10-27 08:21:47 +03:00
|
|
|
tlb_flush_range_by_mmuidx(cs, ent->itree.start,
|
|
|
|
ent->itree.last - ent->itree.start + 1,
|
|
|
|
HPPA_MMU_FLUSH_MASK, TARGET_LONG_BITS);
|
2023-09-13 11:55:59 +03:00
|
|
|
|
2023-10-27 10:24:30 +03:00
|
|
|
/* Never clear BTLBs, unless forced to do so. */
|
2023-10-13 03:46:55 +03:00
|
|
|
is_btlb = ent < &env->tlb[HPPA_BTLB_ENTRIES(env)];
|
2023-10-27 10:24:30 +03:00
|
|
|
if (is_btlb && !force_flush_btlb) {
|
2023-09-13 11:55:59 +03:00
|
|
|
return;
|
2017-10-27 17:26:36 +03:00
|
|
|
}
|
|
|
|
|
2023-10-27 10:24:30 +03:00
|
|
|
interval_tree_remove(&ent->itree, &env->tlb_root);
|
2017-10-27 17:26:36 +03:00
|
|
|
memset(ent, 0, sizeof(*ent));
|
2023-10-27 10:24:30 +03:00
|
|
|
|
|
|
|
if (!is_btlb) {
|
|
|
|
ent->unused_next = env->tlb_unused;
|
|
|
|
env->tlb_unused = ent;
|
|
|
|
}
|
2017-10-27 17:26:36 +03:00
|
|
|
}
|
|
|
|
|
2023-10-27 10:24:30 +03:00
|
|
|
static void hppa_flush_tlb_range(CPUHPPAState *env, vaddr va_b, vaddr va_e)
|
2023-11-02 02:07:48 +03:00
|
|
|
{
|
2023-10-27 10:24:30 +03:00
|
|
|
IntervalTreeNode *i, *n;
|
2023-11-02 02:07:48 +03:00
|
|
|
|
2023-10-27 10:24:30 +03:00
|
|
|
i = interval_tree_iter_first(&env->tlb_root, va_b, va_e);
|
|
|
|
for (; i ; i = n) {
|
|
|
|
HPPATLBEntry *ent = container_of(i, HPPATLBEntry, itree);
|
2023-11-02 02:07:48 +03:00
|
|
|
|
2023-10-27 10:24:30 +03:00
|
|
|
/*
|
|
|
|
* Find the next entry now: In the normal case the current entry
|
|
|
|
* will be removed, but in the BTLB case it will remain.
|
|
|
|
*/
|
|
|
|
n = interval_tree_iter_next(i, va_b, va_e);
|
|
|
|
hppa_flush_tlb_ent(env, ent, false);
|
2023-11-02 02:07:48 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-27 08:13:12 +03:00
|
|
|
static HPPATLBEntry *hppa_alloc_tlb_ent(CPUHPPAState *env)
|
2017-10-27 17:26:36 +03:00
|
|
|
{
|
2023-10-27 10:24:30 +03:00
|
|
|
HPPATLBEntry *ent = env->tlb_unused;
|
2023-09-13 11:55:59 +03:00
|
|
|
|
2023-10-27 10:24:30 +03:00
|
|
|
if (ent == NULL) {
|
2023-10-13 03:46:55 +03:00
|
|
|
uint32_t btlb_entries = HPPA_BTLB_ENTRIES(env);
|
2023-10-27 10:24:30 +03:00
|
|
|
uint32_t i = env->tlb_last;
|
2017-10-27 17:26:36 +03:00
|
|
|
|
2023-10-13 03:46:55 +03:00
|
|
|
if (i < btlb_entries || i >= ARRAY_SIZE(env->tlb)) {
|
|
|
|
i = btlb_entries;
|
2023-10-27 10:24:30 +03:00
|
|
|
}
|
|
|
|
env->tlb_last = i + 1;
|
2017-10-27 17:26:36 +03:00
|
|
|
|
2023-10-27 10:24:30 +03:00
|
|
|
ent = &env->tlb[i];
|
|
|
|
hppa_flush_tlb_ent(env, ent, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
env->tlb_unused = ent->unused_next;
|
2017-10-27 17:26:36 +03:00
|
|
|
return ent;
|
|
|
|
}
|
|
|
|
|
2017-10-27 11:17:12 +03:00
|
|
|
int hppa_get_physical_address(CPUHPPAState *env, vaddr addr, int mmu_idx,
|
2023-09-13 11:55:59 +03:00
|
|
|
int type, hwaddr *pphys, int *pprot,
|
2023-10-27 08:13:12 +03:00
|
|
|
HPPATLBEntry **tlb_entry)
|
2017-10-27 11:17:12 +03:00
|
|
|
{
|
|
|
|
hwaddr phys;
|
2023-08-07 12:52:39 +03:00
|
|
|
int prot, r_prot, w_prot, x_prot, priv;
|
2023-10-27 08:13:12 +03:00
|
|
|
HPPATLBEntry *ent;
|
2017-10-27 11:17:12 +03:00
|
|
|
int ret = -1;
|
|
|
|
|
2023-09-13 11:55:59 +03:00
|
|
|
if (tlb_entry) {
|
|
|
|
*tlb_entry = NULL;
|
|
|
|
}
|
|
|
|
|
2023-11-07 23:13:17 +03:00
|
|
|
/* Virtual translation disabled. Map absolute to physical. */
|
|
|
|
if (MMU_IDX_MMU_DISABLED(mmu_idx)) {
|
|
|
|
switch (mmu_idx) {
|
|
|
|
case MMU_ABS_W_IDX:
|
|
|
|
phys = hppa_abs_to_phys_pa2_w1(addr);
|
|
|
|
break;
|
|
|
|
case MMU_ABS_IDX:
|
|
|
|
if (hppa_is_pa20(env)) {
|
|
|
|
phys = hppa_abs_to_phys_pa2_w0(addr);
|
|
|
|
} else {
|
|
|
|
phys = (uint32_t)addr;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
g_assert_not_reached();
|
|
|
|
}
|
2017-10-27 11:17:12 +03:00
|
|
|
prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
|
|
|
|
goto egress;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Find a valid tlb entry that matches the virtual address. */
|
|
|
|
ent = hppa_find_tlb(env, addr);
|
2023-10-27 10:24:30 +03:00
|
|
|
if (ent == NULL) {
|
2017-10-27 11:17:12 +03:00
|
|
|
phys = 0;
|
|
|
|
prot = 0;
|
2019-03-11 22:15:54 +03:00
|
|
|
ret = (type == PAGE_EXEC) ? EXCP_ITLB_MISS : EXCP_DTLB_MISS;
|
2017-10-27 11:17:12 +03:00
|
|
|
goto egress;
|
|
|
|
}
|
|
|
|
|
2023-09-13 11:55:59 +03:00
|
|
|
if (tlb_entry) {
|
|
|
|
*tlb_entry = ent;
|
|
|
|
}
|
|
|
|
|
2017-10-27 11:17:12 +03:00
|
|
|
/* We now know the physical address. */
|
2023-10-27 08:21:47 +03:00
|
|
|
phys = ent->pa + (addr - ent->itree.start);
|
2017-10-27 11:17:12 +03:00
|
|
|
|
|
|
|
/* Map TLB access_rights field to QEMU protection. */
|
2023-08-07 12:52:39 +03:00
|
|
|
priv = MMU_IDX_TO_PRIV(mmu_idx);
|
|
|
|
r_prot = (priv <= ent->ar_pl1) * PAGE_READ;
|
|
|
|
w_prot = (priv <= ent->ar_pl2) * PAGE_WRITE;
|
|
|
|
x_prot = (ent->ar_pl2 <= priv && priv <= ent->ar_pl1) * PAGE_EXEC;
|
2017-10-27 11:17:12 +03:00
|
|
|
switch (ent->ar_type) {
|
|
|
|
case 0: /* read-only: data page */
|
|
|
|
prot = r_prot;
|
|
|
|
break;
|
|
|
|
case 1: /* read/write: dynamic data page */
|
|
|
|
prot = r_prot | w_prot;
|
|
|
|
break;
|
|
|
|
case 2: /* read/execute: normal code page */
|
|
|
|
prot = r_prot | x_prot;
|
|
|
|
break;
|
|
|
|
case 3: /* read/write/execute: dynamic code page */
|
|
|
|
prot = r_prot | w_prot | x_prot;
|
|
|
|
break;
|
|
|
|
default: /* execute: promote to privilege level type & 3 */
|
|
|
|
prot = x_prot;
|
2017-12-15 23:37:26 +03:00
|
|
|
break;
|
2017-10-27 11:17:12 +03:00
|
|
|
}
|
|
|
|
|
2019-03-11 22:16:00 +03:00
|
|
|
/* access_id == 0 means public page and no check is performed */
|
2023-11-02 01:17:04 +03:00
|
|
|
if (ent->access_id && MMU_IDX_TO_P(mmu_idx)) {
|
2019-03-11 22:16:00 +03:00
|
|
|
/* If bits [31:1] match, and bit 0 is set, suppress write. */
|
|
|
|
int match = ent->access_id * 2 + 1;
|
|
|
|
|
|
|
|
if (match == env->cr[CR_PID1] || match == env->cr[CR_PID2] ||
|
|
|
|
match == env->cr[CR_PID3] || match == env->cr[CR_PID4]) {
|
|
|
|
prot &= PAGE_READ | PAGE_EXEC;
|
|
|
|
if (type == PAGE_WRITE) {
|
|
|
|
ret = EXCP_DMPI;
|
|
|
|
goto egress;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-10-27 11:17:12 +03:00
|
|
|
|
|
|
|
/* No guest access type indicates a non-architectural access from
|
|
|
|
within QEMU. Bypass checks for access, D, B and T bits. */
|
|
|
|
if (type == 0) {
|
|
|
|
goto egress;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (unlikely(!(prot & type))) {
|
|
|
|
/* The access isn't allowed -- Inst/Data Memory Protection Fault. */
|
2019-04-23 09:36:21 +03:00
|
|
|
ret = (type & PAGE_EXEC) ? EXCP_IMP : EXCP_DMAR;
|
2017-10-27 11:17:12 +03:00
|
|
|
goto egress;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* In reverse priority order, check for conditions which raise faults.
|
|
|
|
As we go, remove PROT bits that cover the condition we want to check.
|
|
|
|
In this way, the resulting PROT will force a re-check of the
|
|
|
|
architectural TLB entry for the next access. */
|
|
|
|
if (unlikely(!ent->d)) {
|
|
|
|
if (type & PAGE_WRITE) {
|
|
|
|
/* The D bit is not set -- TLB Dirty Bit Fault. */
|
|
|
|
ret = EXCP_TLB_DIRTY;
|
|
|
|
}
|
|
|
|
prot &= PAGE_READ | PAGE_EXEC;
|
|
|
|
}
|
|
|
|
if (unlikely(ent->b)) {
|
|
|
|
if (type & PAGE_WRITE) {
|
|
|
|
/* The B bit is set -- Data Memory Break Fault. */
|
|
|
|
ret = EXCP_DMB;
|
|
|
|
}
|
|
|
|
prot &= PAGE_READ | PAGE_EXEC;
|
|
|
|
}
|
|
|
|
if (unlikely(ent->t)) {
|
|
|
|
if (!(type & PAGE_EXEC)) {
|
|
|
|
/* The T bit is set -- Page Reference Fault. */
|
|
|
|
ret = EXCP_PAGE_REF;
|
|
|
|
}
|
|
|
|
prot &= PAGE_EXEC;
|
|
|
|
}
|
|
|
|
|
|
|
|
egress:
|
2023-11-07 23:13:17 +03:00
|
|
|
*pphys = phys;
|
2017-10-27 11:17:12 +03:00
|
|
|
*pprot = prot;
|
2019-03-11 22:15:55 +03:00
|
|
|
trace_hppa_tlb_get_physical_address(env, ret, prot, addr, phys);
|
2017-10-27 11:17:12 +03:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2017-10-01 23:11:45 +03:00
|
|
|
hwaddr hppa_cpu_get_phys_page_debug(CPUState *cs, vaddr addr)
|
|
|
|
{
|
2017-10-27 11:17:12 +03:00
|
|
|
HPPACPU *cpu = HPPA_CPU(cs);
|
|
|
|
hwaddr phys;
|
2023-11-07 23:13:17 +03:00
|
|
|
int prot, excp, mmu_idx;
|
2017-10-27 11:17:12 +03:00
|
|
|
|
|
|
|
/* If the (data) mmu is disabled, bypass translation. */
|
|
|
|
/* ??? We really ought to know if the code mmu is disabled too,
|
|
|
|
in order to get the correct debugging dumps. */
|
2023-11-07 23:13:17 +03:00
|
|
|
mmu_idx = (cpu->env.psw & PSW_D ? MMU_KERNEL_IDX :
|
|
|
|
cpu->env.psw & PSW_W ? MMU_ABS_W_IDX : MMU_ABS_IDX);
|
2017-10-27 11:17:12 +03:00
|
|
|
|
2023-11-07 23:13:17 +03:00
|
|
|
excp = hppa_get_physical_address(&cpu->env, addr, mmu_idx, 0,
|
2023-09-13 11:55:59 +03:00
|
|
|
&phys, &prot, NULL);
|
2017-10-27 11:17:12 +03:00
|
|
|
|
|
|
|
/* Since we're translating for debugging, the only error that is a
|
|
|
|
hard error is no translation at all. Otherwise, while a real cpu
|
|
|
|
access might not have permission, the debugger does. */
|
|
|
|
return excp == EXCP_DTLB_MISS ? -1 : phys;
|
2017-10-01 23:11:45 +03:00
|
|
|
}
|
|
|
|
|
2024-01-12 00:50:11 +03:00
|
|
|
void hppa_set_ior_and_isr(CPUHPPAState *env, vaddr addr, bool mmu_disabled)
|
2023-10-27 13:35:57 +03:00
|
|
|
{
|
|
|
|
if (env->psw & PSW_Q) {
|
|
|
|
/*
|
|
|
|
* For pa1.x, the offset and space never overlap, and so we
|
|
|
|
* simply extract the high and low part of the virtual address.
|
|
|
|
*
|
|
|
|
* For pa2.0, the formation of these are described in section
|
|
|
|
* "Interruption Parameter Registers", page 2-15.
|
|
|
|
*/
|
|
|
|
env->cr[CR_IOR] = (uint32_t)addr;
|
|
|
|
env->cr[CR_ISR] = addr >> 32;
|
|
|
|
|
|
|
|
if (hppa_is_pa20(env)) {
|
|
|
|
if (mmu_disabled) {
|
|
|
|
/*
|
|
|
|
* If data translation was disabled, the ISR contains
|
|
|
|
* the upper portion of the abs address, zero-extended.
|
|
|
|
*/
|
|
|
|
env->cr[CR_ISR] &= 0x3fffffff;
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* If data translation was enabled, the upper two bits
|
|
|
|
* of the IOR (the b field) are equal to the two space
|
|
|
|
* bits from the base register used to form the gva.
|
|
|
|
*/
|
|
|
|
uint64_t b;
|
|
|
|
|
2024-01-03 22:35:18 +03:00
|
|
|
b = env->unwind_breg ? env->gr[env->unwind_breg] : 0;
|
2023-10-27 13:35:57 +03:00
|
|
|
b >>= (env->psw & PSW_W ? 62 : 30);
|
|
|
|
env->cr[CR_IOR] |= b << 62;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-01-12 00:50:11 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
G_NORETURN static void
|
|
|
|
raise_exception_with_ior(CPUHPPAState *env, int excp, uintptr_t retaddr,
|
|
|
|
vaddr addr, bool mmu_disabled)
|
|
|
|
{
|
|
|
|
CPUState *cs = env_cpu(env);
|
|
|
|
|
|
|
|
cs->exception_index = excp;
|
|
|
|
hppa_set_ior_and_isr(env, addr, mmu_disabled);
|
|
|
|
|
2023-10-27 13:35:57 +03:00
|
|
|
cpu_loop_exit_restore(cs, retaddr);
|
|
|
|
}
|
|
|
|
|
2019-04-02 11:30:10 +03:00
|
|
|
bool hppa_cpu_tlb_fill(CPUState *cs, vaddr addr, int size,
|
|
|
|
MMUAccessType type, int mmu_idx,
|
|
|
|
bool probe, uintptr_t retaddr)
|
2017-10-01 23:11:45 +03:00
|
|
|
{
|
2017-10-27 11:17:12 +03:00
|
|
|
HPPACPU *cpu = HPPA_CPU(cs);
|
2019-03-11 22:15:55 +03:00
|
|
|
CPUHPPAState *env = &cpu->env;
|
2023-10-27 08:13:12 +03:00
|
|
|
HPPATLBEntry *ent;
|
2017-10-27 11:17:12 +03:00
|
|
|
int prot, excp, a_prot;
|
|
|
|
hwaddr phys;
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case MMU_INST_FETCH:
|
|
|
|
a_prot = PAGE_EXEC;
|
|
|
|
break;
|
|
|
|
case MMU_DATA_STORE:
|
|
|
|
a_prot = PAGE_WRITE;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
a_prot = PAGE_READ;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2019-03-11 22:15:55 +03:00
|
|
|
excp = hppa_get_physical_address(env, addr, mmu_idx,
|
2023-09-13 11:55:59 +03:00
|
|
|
a_prot, &phys, &prot, &ent);
|
2017-10-27 11:17:12 +03:00
|
|
|
if (unlikely(excp >= 0)) {
|
2019-04-02 11:30:10 +03:00
|
|
|
if (probe) {
|
|
|
|
return false;
|
|
|
|
}
|
2019-03-11 22:15:55 +03:00
|
|
|
trace_hppa_tlb_fill_excp(env, addr, size, type, mmu_idx);
|
2023-10-27 13:35:57 +03:00
|
|
|
|
2017-10-27 11:17:12 +03:00
|
|
|
/* Failure. Raise the indicated exception. */
|
2023-11-07 22:33:45 +03:00
|
|
|
raise_exception_with_ior(env, excp, retaddr, addr,
|
|
|
|
MMU_IDX_MMU_DISABLED(mmu_idx));
|
2017-10-27 11:17:12 +03:00
|
|
|
}
|
2017-10-01 23:11:45 +03:00
|
|
|
|
2019-03-11 22:15:55 +03:00
|
|
|
trace_hppa_tlb_fill_success(env, addr & TARGET_PAGE_MASK,
|
|
|
|
phys & TARGET_PAGE_MASK, size, type, mmu_idx);
|
2023-10-27 11:09:21 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Success! Store the translation into the QEMU TLB.
|
|
|
|
* Note that we always install a single-page entry, because that
|
|
|
|
* is what works best with softmmu -- anything else will trigger
|
|
|
|
* the large page protection mask. We do not require this,
|
|
|
|
* because we record the large page here in the hppa tlb.
|
|
|
|
*/
|
2017-10-01 23:11:45 +03:00
|
|
|
tlb_set_page(cs, addr & TARGET_PAGE_MASK, phys & TARGET_PAGE_MASK,
|
2023-10-27 11:09:21 +03:00
|
|
|
prot, mmu_idx, TARGET_PAGE_SIZE);
|
2019-04-02 11:30:10 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-10-27 17:26:36 +03:00
|
|
|
/* Insert (Insn/Data) TLB Address. Note this is PA 1.1 only. */
|
2023-10-18 07:11:19 +03:00
|
|
|
void HELPER(itlba_pa11)(CPUHPPAState *env, target_ulong addr, target_ulong reg)
|
2017-10-27 17:26:36 +03:00
|
|
|
{
|
2023-10-27 10:24:30 +03:00
|
|
|
HPPATLBEntry *ent;
|
2017-10-27 17:26:36 +03:00
|
|
|
|
2023-10-27 10:24:30 +03:00
|
|
|
/* Zap any old entries covering ADDR. */
|
2023-11-02 02:07:48 +03:00
|
|
|
addr &= TARGET_PAGE_MASK;
|
2023-10-27 10:24:30 +03:00
|
|
|
hppa_flush_tlb_range(env, addr, addr + TARGET_PAGE_SIZE - 1);
|
2017-10-27 17:26:36 +03:00
|
|
|
|
2023-10-27 10:24:30 +03:00
|
|
|
ent = env->tlb_partial;
|
|
|
|
if (ent == NULL) {
|
|
|
|
ent = hppa_alloc_tlb_ent(env);
|
|
|
|
env->tlb_partial = ent;
|
2017-10-27 17:26:36 +03:00
|
|
|
}
|
|
|
|
|
2023-10-27 10:24:30 +03:00
|
|
|
/* Note that ent->entry_valid == 0 already. */
|
|
|
|
ent->itree.start = addr;
|
|
|
|
ent->itree.last = addr + TARGET_PAGE_SIZE - 1;
|
|
|
|
ent->pa = extract32(reg, 5, 20) << TARGET_PAGE_BITS;
|
|
|
|
trace_hppa_tlb_itlba(env, ent, ent->itree.start, ent->itree.last, ent->pa);
|
2017-10-27 17:26:36 +03:00
|
|
|
}
|
|
|
|
|
2023-10-13 03:55:12 +03:00
|
|
|
static void set_access_bits_pa11(CPUHPPAState *env, HPPATLBEntry *ent,
|
2023-10-18 07:11:19 +03:00
|
|
|
target_ulong reg)
|
2017-10-27 17:26:36 +03:00
|
|
|
{
|
|
|
|
ent->access_id = extract32(reg, 1, 18);
|
|
|
|
ent->u = extract32(reg, 19, 1);
|
|
|
|
ent->ar_pl2 = extract32(reg, 20, 2);
|
|
|
|
ent->ar_pl1 = extract32(reg, 22, 2);
|
|
|
|
ent->ar_type = extract32(reg, 24, 3);
|
|
|
|
ent->b = extract32(reg, 27, 1);
|
|
|
|
ent->d = extract32(reg, 28, 1);
|
|
|
|
ent->t = extract32(reg, 29, 1);
|
|
|
|
ent->entry_valid = 1;
|
2023-10-27 10:24:30 +03:00
|
|
|
|
|
|
|
interval_tree_insert(&ent->itree, &env->tlb_root);
|
2019-03-11 22:15:55 +03:00
|
|
|
trace_hppa_tlb_itlbp(env, ent, ent->access_id, ent->u, ent->ar_pl2,
|
|
|
|
ent->ar_pl1, ent->ar_type, ent->b, ent->d, ent->t);
|
2017-10-27 17:26:36 +03:00
|
|
|
}
|
2017-10-27 19:33:23 +03:00
|
|
|
|
2023-09-13 11:55:59 +03:00
|
|
|
/* Insert (Insn/Data) TLB Protection. Note this is PA 1.1 only. */
|
2023-10-18 07:11:19 +03:00
|
|
|
void HELPER(itlbp_pa11)(CPUHPPAState *env, target_ulong addr, target_ulong reg)
|
2023-09-13 11:55:59 +03:00
|
|
|
{
|
2023-10-27 10:24:30 +03:00
|
|
|
HPPATLBEntry *ent = env->tlb_partial;
|
2023-09-13 11:55:59 +03:00
|
|
|
|
2023-10-27 10:24:30 +03:00
|
|
|
if (ent) {
|
|
|
|
env->tlb_partial = NULL;
|
|
|
|
if (ent->itree.start <= addr && addr <= ent->itree.last) {
|
2023-10-13 03:55:12 +03:00
|
|
|
set_access_bits_pa11(env, ent, reg);
|
2023-10-27 10:24:30 +03:00
|
|
|
return;
|
|
|
|
}
|
2023-09-13 11:55:59 +03:00
|
|
|
}
|
2023-10-27 10:24:30 +03:00
|
|
|
qemu_log_mask(LOG_GUEST_ERROR, "ITLBP not following ITLBA\n");
|
2023-09-13 11:55:59 +03:00
|
|
|
}
|
|
|
|
|
2023-10-18 07:11:19 +03:00
|
|
|
static void itlbt_pa20(CPUHPPAState *env, target_ulong r1,
|
|
|
|
target_ulong r2, vaddr va_b)
|
2023-10-13 03:55:12 +03:00
|
|
|
{
|
|
|
|
HPPATLBEntry *ent;
|
|
|
|
vaddr va_e;
|
|
|
|
uint64_t va_size;
|
|
|
|
int mask_shift;
|
|
|
|
|
|
|
|
mask_shift = 2 * (r1 & 0xf);
|
2023-11-10 22:27:43 +03:00
|
|
|
va_size = (uint64_t)TARGET_PAGE_SIZE << mask_shift;
|
2023-10-13 03:55:12 +03:00
|
|
|
va_b &= -va_size;
|
|
|
|
va_e = va_b + va_size - 1;
|
|
|
|
|
|
|
|
hppa_flush_tlb_range(env, va_b, va_e);
|
|
|
|
ent = hppa_alloc_tlb_ent(env);
|
|
|
|
|
|
|
|
ent->itree.start = va_b;
|
|
|
|
ent->itree.last = va_e;
|
2023-11-07 20:28:56 +03:00
|
|
|
|
|
|
|
/* Extract all 52 bits present in the page table entry. */
|
|
|
|
ent->pa = r1 << (TARGET_PAGE_BITS - 5);
|
|
|
|
/* Align per the page size. */
|
|
|
|
ent->pa &= TARGET_PAGE_MASK << mask_shift;
|
|
|
|
/* Ignore the bits beyond physical address space. */
|
|
|
|
ent->pa = sextract64(ent->pa, 0, TARGET_PHYS_ADDR_SPACE_BITS);
|
|
|
|
|
2023-10-13 03:55:12 +03:00
|
|
|
ent->t = extract64(r2, 61, 1);
|
|
|
|
ent->d = extract64(r2, 60, 1);
|
|
|
|
ent->b = extract64(r2, 59, 1);
|
|
|
|
ent->ar_type = extract64(r2, 56, 3);
|
|
|
|
ent->ar_pl1 = extract64(r2, 54, 2);
|
|
|
|
ent->ar_pl2 = extract64(r2, 52, 2);
|
|
|
|
ent->u = extract64(r2, 51, 1);
|
|
|
|
/* o = bit 50 */
|
|
|
|
/* p = bit 49 */
|
|
|
|
ent->access_id = extract64(r2, 1, 31);
|
|
|
|
ent->entry_valid = 1;
|
|
|
|
|
|
|
|
interval_tree_insert(&ent->itree, &env->tlb_root);
|
|
|
|
trace_hppa_tlb_itlba(env, ent, ent->itree.start, ent->itree.last, ent->pa);
|
|
|
|
trace_hppa_tlb_itlbp(env, ent, ent->access_id, ent->u,
|
|
|
|
ent->ar_pl2, ent->ar_pl1, ent->ar_type,
|
|
|
|
ent->b, ent->d, ent->t);
|
|
|
|
}
|
|
|
|
|
2023-10-18 07:11:19 +03:00
|
|
|
void HELPER(idtlbt_pa20)(CPUHPPAState *env, target_ulong r1, target_ulong r2)
|
2023-10-13 03:55:12 +03:00
|
|
|
{
|
|
|
|
vaddr va_b = deposit64(env->cr[CR_IOR], 32, 32, env->cr[CR_ISR]);
|
|
|
|
itlbt_pa20(env, r1, r2, va_b);
|
|
|
|
}
|
|
|
|
|
2023-10-18 07:11:19 +03:00
|
|
|
void HELPER(iitlbt_pa20)(CPUHPPAState *env, target_ulong r1, target_ulong r2)
|
2023-10-13 03:55:12 +03:00
|
|
|
{
|
|
|
|
vaddr va_b = deposit64(env->cr[CR_IIAOQ], 32, 32, env->cr[CR_IIASQ]);
|
|
|
|
itlbt_pa20(env, r1, r2, va_b);
|
|
|
|
}
|
|
|
|
|
2023-10-27 07:41:41 +03:00
|
|
|
/* Purge (Insn/Data) TLB. */
|
2017-10-27 19:33:23 +03:00
|
|
|
static void ptlb_work(CPUState *cpu, run_on_cpu_data data)
|
|
|
|
{
|
2023-09-14 03:22:49 +03:00
|
|
|
CPUHPPAState *env = cpu_env(cpu);
|
2023-10-27 07:41:41 +03:00
|
|
|
vaddr start = data.target_ptr;
|
|
|
|
vaddr end;
|
2017-10-27 19:33:23 +03:00
|
|
|
|
2023-10-27 07:41:41 +03:00
|
|
|
/*
|
|
|
|
* PA2.0 allows a range of pages encoded into GR[b], which we have
|
|
|
|
* copied into the bottom bits of the otherwise page-aligned address.
|
|
|
|
* PA1.x will always provide zero here, for a single page flush.
|
|
|
|
*/
|
|
|
|
end = start & 0xf;
|
|
|
|
start &= TARGET_PAGE_MASK;
|
2023-11-10 22:27:43 +03:00
|
|
|
end = (vaddr)TARGET_PAGE_SIZE << (2 * end);
|
2023-10-27 07:41:41 +03:00
|
|
|
end = start + end - 1;
|
|
|
|
|
|
|
|
hppa_flush_tlb_range(env, start, end);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This is local to the current cpu. */
|
|
|
|
void HELPER(ptlb_l)(CPUHPPAState *env, target_ulong addr)
|
|
|
|
{
|
|
|
|
trace_hppa_tlb_ptlb_local(env);
|
|
|
|
ptlb_work(env_cpu(env), RUN_ON_CPU_TARGET_PTR(addr));
|
2017-10-27 19:33:23 +03:00
|
|
|
}
|
|
|
|
|
2023-10-27 07:41:41 +03:00
|
|
|
/* This is synchronous across all processors. */
|
2017-10-27 19:33:23 +03:00
|
|
|
void HELPER(ptlb)(CPUHPPAState *env, target_ulong addr)
|
|
|
|
{
|
2019-03-23 03:51:33 +03:00
|
|
|
CPUState *src = env_cpu(env);
|
2017-10-27 19:33:23 +03:00
|
|
|
CPUState *cpu;
|
2023-11-01 19:56:42 +03:00
|
|
|
bool wait = false;
|
2023-10-27 10:24:30 +03:00
|
|
|
|
2019-03-11 22:15:55 +03:00
|
|
|
trace_hppa_tlb_ptlb(env);
|
2017-10-27 19:33:23 +03:00
|
|
|
run_on_cpu_data data = RUN_ON_CPU_TARGET_PTR(addr);
|
|
|
|
|
|
|
|
CPU_FOREACH(cpu) {
|
|
|
|
if (cpu != src) {
|
|
|
|
async_run_on_cpu(cpu, ptlb_work, data);
|
2023-11-01 19:56:42 +03:00
|
|
|
wait = true;
|
2017-10-27 19:33:23 +03:00
|
|
|
}
|
|
|
|
}
|
2023-11-01 19:56:42 +03:00
|
|
|
if (wait) {
|
|
|
|
async_safe_run_on_cpu(src, ptlb_work, data);
|
|
|
|
} else {
|
|
|
|
ptlb_work(src, data);
|
|
|
|
}
|
2017-10-27 19:33:23 +03:00
|
|
|
}
|
|
|
|
|
2023-10-27 10:24:30 +03:00
|
|
|
void hppa_ptlbe(CPUHPPAState *env)
|
|
|
|
{
|
2023-10-13 03:46:55 +03:00
|
|
|
uint32_t btlb_entries = HPPA_BTLB_ENTRIES(env);
|
2023-10-27 10:24:30 +03:00
|
|
|
uint32_t i;
|
|
|
|
|
|
|
|
/* Zap the (non-btlb) tlb entries themselves. */
|
2023-10-13 03:46:55 +03:00
|
|
|
memset(&env->tlb[btlb_entries], 0,
|
|
|
|
sizeof(env->tlb) - btlb_entries * sizeof(env->tlb[0]));
|
|
|
|
env->tlb_last = btlb_entries;
|
2023-10-27 10:24:30 +03:00
|
|
|
env->tlb_partial = NULL;
|
|
|
|
|
|
|
|
/* Put them all onto the unused list. */
|
2023-10-13 03:46:55 +03:00
|
|
|
env->tlb_unused = &env->tlb[btlb_entries];
|
|
|
|
for (i = btlb_entries; i < ARRAY_SIZE(env->tlb) - 1; ++i) {
|
2023-10-27 10:24:30 +03:00
|
|
|
env->tlb[i].unused_next = &env->tlb[i + 1];
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Re-initialize the interval tree with only the btlb entries. */
|
|
|
|
memset(&env->tlb_root, 0, sizeof(env->tlb_root));
|
2023-10-13 03:46:55 +03:00
|
|
|
for (i = 0; i < btlb_entries; ++i) {
|
2023-10-27 10:24:30 +03:00
|
|
|
if (env->tlb[i].entry_valid) {
|
|
|
|
interval_tree_insert(&env->tlb[i].itree, &env->tlb_root);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tlb_flush_by_mmuidx(env_cpu(env), HPPA_MMU_FLUSH_MASK);
|
|
|
|
}
|
|
|
|
|
2017-10-27 19:33:23 +03:00
|
|
|
/* Purge (Insn/Data) TLB entry. This affects an implementation-defined
|
|
|
|
number of pages/entries (we choose all), and is local to the cpu. */
|
|
|
|
void HELPER(ptlbe)(CPUHPPAState *env)
|
|
|
|
{
|
2019-03-11 22:15:55 +03:00
|
|
|
trace_hppa_tlb_ptlbe(env);
|
2023-09-13 11:55:59 +03:00
|
|
|
qemu_log_mask(CPU_LOG_MMU, "FLUSH ALL TLB ENTRIES\n");
|
2023-10-27 10:24:30 +03:00
|
|
|
hppa_ptlbe(env);
|
2017-10-27 19:33:23 +03:00
|
|
|
}
|
2017-11-05 12:50:47 +03:00
|
|
|
|
2019-03-11 22:16:00 +03:00
|
|
|
void cpu_hppa_change_prot_id(CPUHPPAState *env)
|
|
|
|
{
|
2023-11-02 01:17:04 +03:00
|
|
|
tlb_flush_by_mmuidx(env_cpu(env), HPPA_MMU_FLUSH_P_MASK);
|
2019-03-11 22:16:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void HELPER(change_prot_id)(CPUHPPAState *env)
|
|
|
|
{
|
|
|
|
cpu_hppa_change_prot_id(env);
|
|
|
|
}
|
|
|
|
|
2023-10-18 07:11:19 +03:00
|
|
|
target_ulong HELPER(lpa)(CPUHPPAState *env, target_ulong addr)
|
2017-11-05 12:50:47 +03:00
|
|
|
{
|
|
|
|
hwaddr phys;
|
|
|
|
int prot, excp;
|
|
|
|
|
|
|
|
excp = hppa_get_physical_address(env, addr, MMU_KERNEL_IDX, 0,
|
2023-09-13 11:55:59 +03:00
|
|
|
&phys, &prot, NULL);
|
2017-11-05 12:50:47 +03:00
|
|
|
if (excp >= 0) {
|
|
|
|
if (excp == EXCP_DTLB_MISS) {
|
|
|
|
excp = EXCP_NA_DTLB_MISS;
|
|
|
|
}
|
2019-03-11 22:15:55 +03:00
|
|
|
trace_hppa_tlb_lpa_failed(env, addr);
|
2023-10-27 13:35:57 +03:00
|
|
|
raise_exception_with_ior(env, excp, GETPC(), addr, false);
|
2017-11-05 12:50:47 +03:00
|
|
|
}
|
2019-03-11 22:15:55 +03:00
|
|
|
trace_hppa_tlb_lpa_success(env, addr, phys);
|
2017-11-05 12:50:47 +03:00
|
|
|
return phys;
|
|
|
|
}
|
2017-12-15 23:37:26 +03:00
|
|
|
|
|
|
|
/* Return the ar_type of the TLB at VADDR, or -1. */
|
|
|
|
int hppa_artype_for_page(CPUHPPAState *env, target_ulong vaddr)
|
|
|
|
{
|
2023-10-27 08:13:12 +03:00
|
|
|
HPPATLBEntry *ent = hppa_find_tlb(env, vaddr);
|
2017-12-15 23:37:26 +03:00
|
|
|
return ent ? ent->ar_type : -1;
|
|
|
|
}
|
2023-09-13 12:25:09 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* diag_btlb() emulates the PDC PDC_BLOCK_TLB firmware call to
|
|
|
|
* allow operating systems to modify the Block TLB (BTLB) entries.
|
|
|
|
* For implementation details see page 1-13 in
|
|
|
|
* https://parisc.wiki.kernel.org/images-parisc/e/ef/Pdc11-v0.96-Ch1-procs.pdf
|
|
|
|
*/
|
|
|
|
void HELPER(diag_btlb)(CPUHPPAState *env)
|
|
|
|
{
|
|
|
|
unsigned int phys_page, len, slot;
|
|
|
|
int mmu_idx = cpu_mmu_index(env, 0);
|
|
|
|
uintptr_t ra = GETPC();
|
2023-10-27 08:13:12 +03:00
|
|
|
HPPATLBEntry *btlb;
|
2023-09-13 12:25:09 +03:00
|
|
|
uint64_t virt_page;
|
|
|
|
uint32_t *vaddr;
|
2023-10-13 03:46:55 +03:00
|
|
|
uint32_t btlb_entries = HPPA_BTLB_ENTRIES(env);
|
2023-09-13 12:25:09 +03:00
|
|
|
|
|
|
|
/* BTLBs are not supported on 64-bit CPUs */
|
2023-10-13 03:46:55 +03:00
|
|
|
if (btlb_entries == 0) {
|
|
|
|
env->gr[28] = -1; /* nonexistent procedure */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-09-13 12:25:09 +03:00
|
|
|
env->gr[28] = 0; /* PDC_OK */
|
|
|
|
|
|
|
|
switch (env->gr[25]) {
|
|
|
|
case 0:
|
|
|
|
/* return BTLB parameters */
|
|
|
|
qemu_log_mask(CPU_LOG_MMU, "PDC_BLOCK_TLB: PDC_BTLB_INFO\n");
|
|
|
|
vaddr = probe_access(env, env->gr[24], 4 * sizeof(target_ulong),
|
|
|
|
MMU_DATA_STORE, mmu_idx, ra);
|
|
|
|
if (vaddr == NULL) {
|
|
|
|
env->gr[28] = -10; /* invalid argument */
|
|
|
|
} else {
|
|
|
|
vaddr[0] = cpu_to_be32(1);
|
|
|
|
vaddr[1] = cpu_to_be32(16 * 1024);
|
2023-10-13 03:46:55 +03:00
|
|
|
vaddr[2] = cpu_to_be32(PA10_BTLB_FIXED);
|
|
|
|
vaddr[3] = cpu_to_be32(PA10_BTLB_VARIABLE);
|
2023-09-13 12:25:09 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
/* insert BTLB entry */
|
|
|
|
virt_page = env->gr[24]; /* upper 32 bits */
|
|
|
|
virt_page <<= 32;
|
|
|
|
virt_page |= env->gr[23]; /* lower 32 bits */
|
|
|
|
phys_page = env->gr[22];
|
|
|
|
len = env->gr[21];
|
|
|
|
slot = env->gr[19];
|
|
|
|
qemu_log_mask(CPU_LOG_MMU, "PDC_BLOCK_TLB: PDC_BTLB_INSERT "
|
|
|
|
"0x%08llx-0x%08llx: vpage 0x%llx for phys page 0x%04x len %d "
|
|
|
|
"into slot %d\n",
|
|
|
|
(long long) virt_page << TARGET_PAGE_BITS,
|
|
|
|
(long long) (virt_page + len) << TARGET_PAGE_BITS,
|
|
|
|
(long long) virt_page, phys_page, len, slot);
|
2023-10-13 03:46:55 +03:00
|
|
|
if (slot < btlb_entries) {
|
2023-09-13 12:25:09 +03:00
|
|
|
btlb = &env->tlb[slot];
|
2023-10-27 10:24:30 +03:00
|
|
|
|
|
|
|
/* Force flush of possibly existing BTLB entry. */
|
2023-09-13 12:25:09 +03:00
|
|
|
hppa_flush_tlb_ent(env, btlb, true);
|
2023-10-27 10:24:30 +03:00
|
|
|
|
|
|
|
/* Create new BTLB entry */
|
2023-10-27 08:21:47 +03:00
|
|
|
btlb->itree.start = virt_page << TARGET_PAGE_BITS;
|
|
|
|
btlb->itree.last = btlb->itree.start + len * TARGET_PAGE_SIZE - 1;
|
2023-09-13 12:25:09 +03:00
|
|
|
btlb->pa = phys_page << TARGET_PAGE_BITS;
|
2023-10-13 03:55:12 +03:00
|
|
|
set_access_bits_pa11(env, btlb, env->gr[20]);
|
2023-09-13 12:25:09 +03:00
|
|
|
btlb->t = 0;
|
|
|
|
btlb->d = 1;
|
|
|
|
} else {
|
|
|
|
env->gr[28] = -10; /* invalid argument */
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
/* Purge BTLB entry */
|
|
|
|
slot = env->gr[22];
|
|
|
|
qemu_log_mask(CPU_LOG_MMU, "PDC_BLOCK_TLB: PDC_BTLB_PURGE slot %d\n",
|
|
|
|
slot);
|
2023-10-13 03:46:55 +03:00
|
|
|
if (slot < btlb_entries) {
|
2023-09-13 12:25:09 +03:00
|
|
|
btlb = &env->tlb[slot];
|
|
|
|
hppa_flush_tlb_ent(env, btlb, true);
|
|
|
|
} else {
|
|
|
|
env->gr[28] = -10; /* invalid argument */
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
/* Purge all BTLB entries */
|
|
|
|
qemu_log_mask(CPU_LOG_MMU, "PDC_BLOCK_TLB: PDC_BTLB_PURGE_ALL\n");
|
2023-10-13 03:46:55 +03:00
|
|
|
for (slot = 0; slot < btlb_entries; slot++) {
|
2023-09-13 12:25:09 +03:00
|
|
|
btlb = &env->tlb[slot];
|
|
|
|
hppa_flush_tlb_ent(env, btlb, true);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
env->gr[28] = -2; /* nonexistent option */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|