[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 16/30] target-sparc: allow priveleged ASIs in hyperpr
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PULL 16/30] target-sparc: allow priveleged ASIs in hyperprivileged mode |
Date: |
Wed, 11 Jan 2017 18:55:52 -0800 |
From: Artyom Tarasenko <address@hidden>
Signed-off-by: Artyom Tarasenko <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
---
target/sparc/ldst_helper.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/target/sparc/ldst_helper.c b/target/sparc/ldst_helper.c
index 387732d..301616b 100644
--- a/target/sparc/ldst_helper.c
+++ b/target/sparc/ldst_helper.c
@@ -293,6 +293,20 @@ static inline target_ulong asi_address_mask(CPUSPARCState
*env,
}
return addr;
}
+
+static inline void do_check_asi(CPUSPARCState *env, int asi, uintptr_t ra)
+{
+ /* ASIs >= 0x80 are user mode.
+ * ASIs >= 0x30 are hyper mode (or super if hyper is not available).
+ * ASIs <= 0x2f are super mode.
+ */
+ if (asi < 0x80
+ && !cpu_hypervisor_mode(env)
+ && (!cpu_supervisor_mode(env)
+ || (asi >= 0x30 && cpu_has_hypervisor(env)))) {
+ cpu_raise_exception_ra(env, TT_PRIV_ACT, ra);
+ }
+}
#endif
static void do_check_align(CPUSPARCState *env, target_ulong addr,
@@ -1118,13 +1132,7 @@ uint64_t helper_ld_asi(CPUSPARCState *env, target_ulong
addr,
asi &= 0xff;
- if ((asi < 0x80 && (env->pstate & PS_PRIV) == 0)
- || (cpu_has_hypervisor(env)
- && asi >= 0x30 && asi < 0x80
- && !(env->hpstate & HS_PRIV))) {
- cpu_raise_exception_ra(env, TT_PRIV_ACT, GETPC());
- }
-
+ do_check_asi(env, asi, GETPC());
do_check_align(env, addr, size - 1, GETPC());
addr = asi_address_mask(env, asi, addr);
@@ -1423,13 +1431,7 @@ void helper_st_asi(CPUSPARCState *env, target_ulong
addr, target_ulong val,
asi &= 0xff;
- if ((asi < 0x80 && (env->pstate & PS_PRIV) == 0)
- || (cpu_has_hypervisor(env)
- && asi >= 0x30 && asi < 0x80
- && !(env->hpstate & HS_PRIV))) {
- cpu_raise_exception_ra(env, TT_PRIV_ACT, GETPC());
- }
-
+ do_check_asi(env, asi, GETPC());
do_check_align(env, addr, size - 1, GETPC());
addr = asi_address_mask(env, asi, addr);
--
2.9.3
- [Qemu-devel] [PULL 06/30] target-sparc: on UA2005 don't deliver Interrupt_level_n IRQs in hypervisor mode, (continued)
- [Qemu-devel] [PULL 06/30] target-sparc: on UA2005 don't deliver Interrupt_level_n IRQs in hypervisor mode, Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 07/30] target-sparc: simplify replace_tlb_entry by using TTE_PGSIZE, Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 08/30] target-sparc: implement UA2005 scratchpad registers, Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 09/30] target-sparc: implement UltraSPARC-T1 Strand status ASR, Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 10/30] target-sparc: hypervisor mode takes over nucleus mode, Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 11/30] target-sparc: implement UA2005 hypervisor traps, Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 12/30] target-sparc: implement UA2005 GL register, Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 13/30] target-sparc: implement UA2005 rdhpstate and wrhpstate instructions, Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 14/30] target-sparc: fix immediate UA2005 traps, Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 15/30] target-sparc: use direct address translation in hyperprivileged mode, Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 16/30] target-sparc: allow priveleged ASIs in hyperprivileged mode,
Richard Henderson <=
- [Qemu-devel] [PULL 17/30] target-sparc: ignore writes to UA2005 CPU mondo queue register, Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 18/30] target-sparc: replace the last tlb entry when no free entries left, Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 19/30] target-sparc: use SparcV9MMU type for sparc64 I/D-MMUs, Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 20/30] target-sparc: implement UA2005 TSB Pointers, Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 21/30] target-sparc: simplify ultrasparc_tsb_pointer, Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 22/30] target-sparc: allow 256M sized pages, Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 23/30] target-sparc: implement auto-demapping for UA2005 CPUs, Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 24/30] target-sparc: add more registers to dump_mmu, Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 25/30] target-sparc: implement UA2005 ASI_MMU (0x21), Richard Henderson, 2017/01/11
- [Qemu-devel] [PULL 26/30] target-sparc: store the UA2005 entries in sun4u format, Richard Henderson, 2017/01/11