]> git.proxmox.com Git - mirror_qemu.git/commit
cputlb: Don't assume do_unassigned_access() never returns
authorPeter Maydell <peter.maydell@linaro.org>
Tue, 28 Feb 2017 12:08:15 +0000 (12:08 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 28 Feb 2017 12:08:15 +0000 (12:08 +0000)
commit44d7ce0ef39cb45e13d384574d79799eb3d39834
tree5ed855093566d915a700617df2c194d33520fd3d
parenta4f5c5b72380deeccd53a6890ea3782f10ca8054
cputlb: Don't assume do_unassigned_access() never returns

In get_page_addr_code(), if the guest PC doesn't correspond to RAM
then we currently run the CPU's do_unassigned_access() hook if it has
one, and otherwise we give up and exit QEMU with a more-or-less
useful message.  This code assumes that the do_unassigned_access hook
will never return, because if it does then we'll plough on attempting
to use a non-RAM TLB entry to get a RAM address and will abort() in
qemu_ram_addr_from_host_nofail().  Unfortunately some CPU
implementations of this hook do return: Microblaze, SPARC and the ARM
v7M.

Change the code to call report_bad_exec() if the hook returns, as
well as if it didn't have one.  This means we can tidy it up to use
the cpu_unassigned_access() function which wraps the "get the CPU
class and call the hook if it has one" work, since we aren't trying
to distinguish "no hook" from "hook existed and returned" any more.

This brings the handling of this hook into line with the handling
used for data accesses, where "hook returned" is treated the
same as "no hook existed" and gets you the default behaviour.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
cputlb.c