mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
tcg: Improve the alignment check infrastructure
Some architectures (e.g. ARMv8) need the address which is aligned to a size more than the size of the memory access. To support such check it's enough the current costless alignment check implementation in QEMU, but we need to support an alignment size specifying. Signed-off-by: Sergey Sorokin <afarallax@yandex.ru> Message-Id: <1466705806-679898-1-git-send-email-afarallax@yandex.ru> Signed-off-by: Richard Henderson <rth@twiddle.net> [rth: Assert in tcg_canonicalize_memop. Leave get_alignment_bits available for, though unused by, user-mode. Retain logging difference based on ALIGNED_ONLY.]
This commit is contained in:
parent
59d7c14eef
commit
1f00b27f17
9 changed files with 159 additions and 108 deletions
|
@ -1081,19 +1081,20 @@ static void tcg_out_tlb_read(TCGContext *s, TCGReg addr_reg, TCGMemOp opc,
|
|||
int tlb_offset = is_read ?
|
||||
offsetof(CPUArchState, tlb_table[mem_index][0].addr_read)
|
||||
: offsetof(CPUArchState, tlb_table[mem_index][0].addr_write);
|
||||
int s_mask = (1 << (opc & MO_SIZE)) - 1;
|
||||
int a_bits = get_alignment_bits(opc);
|
||||
TCGReg base = TCG_AREG0, x3;
|
||||
uint64_t tlb_mask;
|
||||
|
||||
/* For aligned accesses, we check the first byte and include the alignment
|
||||
bits within the address. For unaligned access, we check that we don't
|
||||
cross pages using the address of the last byte of the access. */
|
||||
if ((opc & MO_AMASK) == MO_ALIGN || s_mask == 0) {
|
||||
tlb_mask = TARGET_PAGE_MASK | s_mask;
|
||||
if (a_bits >= 0) {
|
||||
/* A byte access or an alignment check required */
|
||||
tlb_mask = TARGET_PAGE_MASK | ((1 << a_bits) - 1);
|
||||
x3 = addr_reg;
|
||||
} else {
|
||||
tcg_out_insn(s, 3401, ADDI, TARGET_LONG_BITS == 64,
|
||||
TCG_REG_X3, addr_reg, s_mask);
|
||||
TCG_REG_X3, addr_reg, (1 << (opc & MO_SIZE)) - 1);
|
||||
tlb_mask = TARGET_PAGE_MASK;
|
||||
x3 = TCG_REG_X3;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue