diff options
author | Richard Henderson <richard.henderson@linaro.org> | 2021-04-19 13:22:37 -0700 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2021-04-30 11:16:50 +0100 |
commit | 9d486b40e895b0e4cfaf47a0bdbd9144547b66d5 (patch) | |
tree | dcfebf31e2776db5329086bc253f70d63b47502a /target/arm/translate.h | |
parent | 4479ec30c9c4d2399b6e5bf4e77d136cfd27aebd (diff) | |
download | qemu-9d486b40e895b0e4cfaf47a0bdbd9144547b66d5.zip qemu-9d486b40e895b0e4cfaf47a0bdbd9144547b66d5.tar.gz qemu-9d486b40e895b0e4cfaf47a0bdbd9144547b66d5.tar.bz2 |
target/arm: Adjust gen_aa32_{ld, st}_i32 for align+endianness
Create a finalize_memop function that computes alignment and
endianness and returns the final MemOp for the operation.
Split out gen_aa32_{ld,st}_internal_i32 which bypasses any special
handling of endianness or alignment. Adjust gen_aa32_{ld,st}_i32
so that s->be_data is not added by the callers.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20210419202257.161730-12-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target/arm/translate.h')
-rw-r--r-- | target/arm/translate.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/target/arm/translate.h b/target/arm/translate.h index b185c14..0c60b83 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -459,4 +459,28 @@ static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour flavour) return statusptr; } +/** + * finalize_memop: + * @s: DisasContext + * @opc: size+sign+align of the memory operation + * + * Build the complete MemOp for a memory operation, including alignment + * and endianness. + * + * If (op & MO_AMASK) then the operation already contains the required + * alignment, e.g. for AccType_ATOMIC. Otherwise, this an optionally + * unaligned operation, e.g. for AccType_NORMAL. + * + * In the latter case, there are configuration bits that require alignment, + * and this is applied here. Note that there is no way to indicate that + * no alignment should ever be enforced; this must be handled manually. + */ +static inline MemOp finalize_memop(DisasContext *s, MemOp opc) +{ + if (s->align_mem && !(opc & MO_AMASK)) { + opc |= MO_ALIGN; + } + return opc | s->be_data; +} + #endif /* TARGET_ARM_TRANSLATE_H */ |