mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-22 01:21:53 -06:00
accel/tcg: Report unaligned atomics for user-only
Use the new cpu_loop_exit_sigbus for atomic_mmu_lookup, which has access to complete alignment info from the TCGMemOpIdx arg. Reviewed-by: Warner Losh <imp@bsdimp.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
aebe51538b
commit
fce3f47430
1 changed files with 12 additions and 1 deletions
|
@ -474,11 +474,22 @@ static void *atomic_mmu_lookup(CPUArchState *env, target_ulong addr,
|
||||||
MemOpIdx oi, int size, int prot,
|
MemOpIdx oi, int size, int prot,
|
||||||
uintptr_t retaddr)
|
uintptr_t retaddr)
|
||||||
{
|
{
|
||||||
|
MemOp mop = get_memop(oi);
|
||||||
|
int a_bits = get_alignment_bits(mop);
|
||||||
|
void *ret;
|
||||||
|
|
||||||
|
/* Enforce guest required alignment. */
|
||||||
|
if (unlikely(addr & ((1 << a_bits) - 1))) {
|
||||||
|
MMUAccessType t = prot == PAGE_READ ? MMU_DATA_LOAD : MMU_DATA_STORE;
|
||||||
|
cpu_loop_exit_sigbus(env_cpu(env), addr, t, retaddr);
|
||||||
|
}
|
||||||
|
|
||||||
/* Enforce qemu required alignment. */
|
/* Enforce qemu required alignment. */
|
||||||
if (unlikely(addr & (size - 1))) {
|
if (unlikely(addr & (size - 1))) {
|
||||||
cpu_loop_exit_atomic(env_cpu(env), retaddr);
|
cpu_loop_exit_atomic(env_cpu(env), retaddr);
|
||||||
}
|
}
|
||||||
void *ret = g2h(env_cpu(env), addr);
|
|
||||||
|
ret = g2h(env_cpu(env), addr);
|
||||||
set_helper_retaddr(retaddr);
|
set_helper_retaddr(retaddr);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue