[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 06/14] tcg/arm: Support unaligned access for softmmu
From: |
Peter Maydell |
Subject: |
Re: [PATCH v3 06/14] tcg/arm: Support unaligned access for softmmu |
Date: |
Fri, 20 Aug 2021 14:34:38 +0100 |
On Wed, 18 Aug 2021 at 22:32, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> From armv6, the architecture supports unaligned accesses.
> All we need to do is perform the correct alignment check
> in tcg_out_tlb_read and not use LDRD/STRD when the access
> is not aligned.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> @@ -1578,27 +1576,32 @@ static TCGReg tcg_out_tlb_read(TCGContext *s, TCGReg
> addrlo, TCGReg addrhi,
>
> /*
> * Check alignment, check comparators.
> - * Do this in no more than 3 insns. Use MOVW for v7, if possible,
> + * Do this in 2-4 insns. Use MOVW for v7, if possible,
> * to reduce the number of sequential conditional instructions.
> * Almost all guests have at least 4k pages, which means that we need
> * to clear at least 9 bits even for an 8-byte memory, which means it
> * isn't worth checking for an immediate operand for BIC.
> */
> + /* For unaligned accesses, test the page of the last byte. */
> + t_addr = addrlo;
> + if (a_mask < s_mask) {
> + t_addr = TCG_REG_R0;
> + tcg_out_dat_imm(s, COND_AL, ARITH_ADD, t_addr,
> + addrlo, s_mask - a_mask);
> + }
I don't understand what this comment means or why we're doing the
addition. If we know we need to check eg whether the address is 2-aligned,
why aren't we just checking whether it's 2-aligned ? Could you
expand on the explanation a bit?
thanks
-- PMM
- [PATCH v3 00/14] tcg/arm: Unaligned access and other cleanup, Richard Henderson, 2021/08/18
- [PATCH v3 01/14] tcg/arm: Remove fallback definition of __ARM_ARCH, Richard Henderson, 2021/08/18
- [PATCH v3 03/14] tcg/arm: Simplify use_armvt5_instructions, Richard Henderson, 2021/08/18
- [PATCH v3 04/14] tcg/arm: Support armv4t in tcg_out_goto and tcg_out_call, Richard Henderson, 2021/08/18
- [PATCH v3 05/14] tcg/arm: Examine QEMU_TCG_DEBUG environment variable, Richard Henderson, 2021/08/18
- [PATCH v3 06/14] tcg/arm: Support unaligned access for softmmu, Richard Henderson, 2021/08/18
- Re: [PATCH v3 06/14] tcg/arm: Support unaligned access for softmmu,
Peter Maydell <=
- [PATCH v3 07/14] tcg/arm: Split out tcg_out_ldstm, Richard Henderson, 2021/08/18
- [PATCH v3 02/14] tcg/arm: Standardize on tcg_out_<branch>_{reg,imm}, Richard Henderson, 2021/08/18
- [PATCH v3 08/14] tcg/arm: Simplify usage of encode_imm, Richard Henderson, 2021/08/18
- [PATCH v3 09/14] tcg/arm: Drop inline markers, Richard Henderson, 2021/08/18