diff options
| author | Richard Henderson <richard.henderson@linaro.org> | 2024-10-04 13:00:47 -0700 |
|---|---|---|
| committer | Richard Henderson <richard.henderson@linaro.org> | 2024-10-13 11:27:03 -0700 |
| commit | da335fe12a5da71a33d7afc2075a341f26213f53 (patch) | |
| tree | eb4cc9cba06594e580e5ac8a45fec88d6003b6a5 /include/exec | |
| parent | 49d1866a6e53b84fd0aceced39ee3d01eb77e813 (diff) | |
| download | focaccia-qemu-da335fe12a5da71a33d7afc2075a341f26213f53.tar.gz focaccia-qemu-da335fe12a5da71a33d7afc2075a341f26213f53.zip | |
include/exec/memop: Move get_alignment_bits from tcg.h
This function is specific to MemOp, not TCG in general. Reviewed-by: Helge Deller <deller@gmx.de> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'include/exec')
| -rw-r--r-- | include/exec/memop.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/exec/memop.h b/include/exec/memop.h index f881fe7af4..97720a8ee7 100644 --- a/include/exec/memop.h +++ b/include/exec/memop.h @@ -170,4 +170,27 @@ static inline bool memop_big_endian(MemOp op) return (op & MO_BSWAP) == MO_BE; } +/** + * get_alignment_bits + * @memop: MemOp value + * + * Extract the alignment size from the memop. + */ +static inline unsigned get_alignment_bits(MemOp memop) +{ + unsigned a = memop & MO_AMASK; + + if (a == MO_UNALN) { + /* No alignment required. */ + a = 0; + } else if (a == MO_ALIGN) { + /* A natural alignment requirement. */ + a = memop & MO_SIZE; + } else { + /* A specific alignment requirement. */ + a = a >> MO_ASHIFT; + } + return a; +} + #endif |