diff options
author | James Hogan <james.hogan@imgtec.com> | 2017-07-18 12:55:53 +0100 |
---|---|---|
committer | Yongbok Kim <yongbok.kim@imgtec.com> | 2017-07-20 22:42:26 +0100 |
commit | 9fbf4a58c90183b30bb2c8ad971ccce7e6716a16 (patch) | |
tree | 67ca716a8ee58d9ffb47ffcab4a1a882b78732e6 /target/mips/translate.c | |
parent | 8fffc64696783b1ff1d17262d098976479895660 (diff) | |
download | qemu-9fbf4a58c90183b30bb2c8ad971ccce7e6716a16.zip qemu-9fbf4a58c90183b30bb2c8ad971ccce7e6716a16.tar.gz qemu-9fbf4a58c90183b30bb2c8ad971ccce7e6716a16.tar.bz2 |
target/mips: Check memory permissions with mem_idx
When performing virtual to physical address translation, check the
required privilege level based on the mem_idx rather than the mode in
the hflags. This will allow EVA loads & stores to operate safely only on
user memory from kernel mode.
For the cases where the mmu_idx doesn't need to be overridden
(mips_cpu_get_phys_page_debug() and cpu_mips_translate_address()), we
calculate the required mmu_idx using cpu_mmu_index(). Note that this
only tests the MIPS_HFLAG_KSU bits rather than MIPS_HFLAG_MODE, so we
don't test the debug mode hflag MIPS_HFLAG_DM any longer. This should be
fine as get_physical_address() only compares against MIPS_HFLAG_UM and
MIPS_HFLAG_SM, neither of which should get set by compute_hflags() when
MIPS_HFLAG_DM is set.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Yongbok Kim <yongbok.kim@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Yongbok Kim <yongbok.kim@imgtec.com>
Diffstat (limited to 'target/mips/translate.c')
0 files changed, 0 insertions, 0 deletions