unicorn/qemu/target/mips
James Hogan 8595d11eb4
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.

Backports commit 9fbf4a58c90183b30bb2c8ad971ccce7e6716a16 from qemu
2018-03-04 00:40:22 -05:00
..
cpu-qom.h Move target-* CPU file into a target/ folder 2018-03-01 22:50:58 -05:00
cpu.c Move target-* CPU file into a target/ folder 2018-03-01 22:50:58 -05:00
cpu.h target-mips: make ITC Configuration Tags accessible to the CPU 2018-03-04 00:34:30 -05:00
dsp_helper.c Move target-* CPU file into a target/ folder 2018-03-01 22:50:58 -05:00
helper.c target/mips: Check memory permissions with mem_idx 2018-03-04 00:40:22 -05:00
helper.h target-mips: make ITC Configuration Tags accessible to the CPU 2018-03-04 00:34:30 -05:00
lmi_helper.c Move target-* CPU file into a target/ folder 2018-03-01 22:50:58 -05:00
Makefile.objs Move target-* CPU file into a target/ folder 2018-03-01 22:50:58 -05:00
mips-defs.h Move target-* CPU file into a target/ folder 2018-03-01 22:50:58 -05:00
msa_helper.c Move target-* CPU file into a target/ folder 2018-03-01 22:50:58 -05:00
op_helper.c target-mips: make ITC Configuration Tags accessible to the CPU 2018-03-04 00:34:30 -05:00
TODO Move target-* CPU file into a target/ folder 2018-03-01 22:50:58 -05:00
translate_init.c target-mips: enable CM GCR in MIPS64R6-generic CPU 2018-03-04 00:24:09 -05:00
translate.c target/mips: Decode microMIPS EVA load & store instructions 2018-03-04 00:37:39 -05:00
unicorn.c Move target-* CPU file into a target/ folder 2018-03-01 22:50:58 -05:00
unicorn.h Move target-* CPU file into a target/ folder 2018-03-01 22:50:58 -05:00