[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [qemu-s390x] [Qemu-devel] [PATCH v2 02/28] s390x/tcg: MVCL: Zero out
From: |
Richard Henderson |
Subject: |
Re: [qemu-s390x] [Qemu-devel] [PATCH v2 02/28] s390x/tcg: MVCL: Zero out unused bits of address |
Date: |
Wed, 11 Sep 2019 10:40:04 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 9/6/19 3:57 AM, David Hildenbrand wrote:
> We have to zero out unused bits in 24 and 31-bit addressing mode.
> Provide a new helper.
>
> Signed-off-by: David Hildenbrand <address@hidden>
> ---
> target/s390x/mem_helper.c | 24 ++++++++++++++++++++++--
> 1 file changed, 22 insertions(+), 2 deletions(-)
Reviewed-by: Richard Henderson <address@hidden>
> diff --git a/target/s390x/mem_helper.c b/target/s390x/mem_helper.c
> index 39ee9b3175..3152bdafe2 100644
> --- a/target/s390x/mem_helper.c
> +++ b/target/s390x/mem_helper.c
> @@ -469,6 +469,26 @@ static inline uint64_t get_address(CPUS390XState *env,
> int reg)
> return wrap_address(env, env->regs[reg]);
> }
>
> +/*
> + * Store the address to the given register, zeroing out unused leftmost
> + * bits in bit positions 32-63 (24-bit and 31-bit mode only).
> + */
> +static inline void set_address_zero(CPUS390XState *env, int reg,
> + uint64_t address)
> +{
> + if (env->psw.mask & PSW_MASK_64) {
> + env->regs[reg] = address;
> + } else {
> + if (!(env->psw.mask & PSW_MASK_32)) {
> + address &= 0x00ffffff;
> + env->regs[reg] = deposit64(env->regs[reg], 0, 32, address);
> + } else {
> + address &= 0x7fffffff;
> + env->regs[reg] = deposit64(env->regs[reg], 0, 32, address);
> + }
You could perhaps sink the deposit and store line into the outer else.
r~