[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 01/18] target/s390x: Truncate 32-bit psw_addr before creat
From: |
David Hildenbrand |
Subject: |
Re: [PATCH v3 01/18] target/s390x: Truncate 32-bit psw_addr before creating TB |
Date: |
Fri, 27 Sep 2019 12:23:06 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 26.09.19 18:25, Richard Henderson wrote:
> If, somehow, the psw_addr is out of range, truncate early
> rather than after we get into gen_intermediate_code.
>
> Reviewed-by: David Hildenbrand <address@hidden>
> Signed-off-by: Richard Henderson <address@hidden>
> ---
> target/s390x/cpu.h | 26 +++++++++++++++++++-------
> target/s390x/translate.c | 6 ------
> 2 files changed, 19 insertions(+), 13 deletions(-)
>
> diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
> index e74a809257..ce20dafd23 100644
> --- a/target/s390x/cpu.h
> +++ b/target/s390x/cpu.h
> @@ -357,18 +357,30 @@ static inline int cpu_mmu_index(CPUS390XState *env,
> bool ifetch)
> #endif
> }
>
> -static inline void cpu_get_tb_cpu_state(CPUS390XState* env, target_ulong *pc,
> - target_ulong *cs_base, uint32_t
> *flags)
> +static inline void cpu_get_tb_cpu_state(CPUS390XState* env,
> + target_ulong *p_pc,
> + target_ulong *cs_base,
> + uint32_t *p_flags)
> {
> - *pc = env->psw.addr;
> - *cs_base = env->ex_value;
> - *flags = (env->psw.mask >> FLAG_MASK_PSW_SHIFT) & FLAG_MASK_PSW;
> + uint32_t flags;
> + uint64_t pc;
> +
> + flags = (env->psw.mask >> FLAG_MASK_PSW_SHIFT) & FLAG_MASK_PSW;
> if (env->cregs[0] & CR0_AFP) {
> - *flags |= FLAG_MASK_AFP;
> + flags |= FLAG_MASK_AFP;
> }
> if (env->cregs[0] & CR0_VECTOR) {
> - *flags |= FLAG_MASK_VECTOR;
> + flags |= FLAG_MASK_VECTOR;
> }
> +
> + pc = env->psw.addr;
> + if (!(flags & FLAG_MASK_64)) {
> + pc &= 0x7fffffff;
> + }
If you're fancy, you could also add 24-bit addressing mode wrapping.
Maybe unlikely(!(flags & FLAG_MASK_64)), but not sure how big the gain
will actually be.
--
Thanks,
David / dhildenb
- [PATCH v3 00/18] target/s390: Use tcg unwinding for ilen, Richard Henderson, 2019/09/26
- [PATCH v3 02/18] target/s390x: Add ilen to unwind data, Richard Henderson, 2019/09/26
- [PATCH v3 01/18] target/s390x: Truncate 32-bit psw_addr before creating TB, Richard Henderson, 2019/09/26
- Re: [PATCH v3 01/18] target/s390x: Truncate 32-bit psw_addr before creating TB,
David Hildenbrand <=
- [PATCH v3 07/18] target/s390x: Handle tec in s390_cpu_tlb_fill, Richard Henderson, 2019/09/26
- [PATCH v3 08/18] target/s390: Return exception from mmu_translate_real, Richard Henderson, 2019/09/26
- [PATCH v3 03/18] target/s390x: Remove ilen parameter from tcg_s390_program_interrupt, Richard Henderson, 2019/09/26
- [PATCH v3 09/18] target/s390x: Remove exc argument to mmu_translate_asce, Richard Henderson, 2019/09/26