unicorn/qemu
Paolo Bonzini a6ea34ee0c
exec: skip MMIO regions correctly in cpu_physical_memory_write_rom_internal
Loading the BIOS in the mac99 machine is interesting, because there is a
PROM in the middle of the BIOS region (from 16K to 32K). Before memory
region accesses were clamped, when QEMU was asked to load a BIOS from
0xfff00000 to 0xffffffff it would put even those 16K from the BIOS file
into the region. This is weird because those 16K were not actually
visible between 0xfff04000 and 0xfff07fff. However, it worked.

After clamping was added, this also worked. In this case, the
cpu_physical_memory_write_rom_internal function split the write in
three parts: the first 16K were copied, the PROM area (second 16K) were
ignored, then the rest was copied.

Problems then started with commit 965eb2f (exec: do not clamp accesses
to MMIO regions, 2015-06-17). Clamping accesses is not done for MMIO
regions because they can overlap wildly, and MMIO registers can be
expected to perform full-width accesses based only on their address
(with no respect for adjacent registers that could decode to completely
different MemoryRegions). However, this lack of clamping also applied
to the PROM area! cpu_physical_memory_write_rom_internal thus failed
to copy the third range above, i.e. only copied the first 16K of the BIOS.

In effect, address_space_translate is expecting _something else_ to do
the clamping for MMIO regions if the incoming length is large. This
"something else" is memory_access_size in the case of address_space_rw,
so use the same logic in cpu_physical_memory_write_rom_internal.

Backports commit b242e0e0e2969c044a318e56f7988bbd84de1f63 from qemu
2018-02-17 15:23:16 -05:00
..
default-configs arm64eb: add support for ARM64 big endian. 2017-04-24 23:30:01 +08:00
docs docs: clarify memory region lifecycle 2018-02-12 15:11:21 -05:00
fpu softfloat: expand out STATUS macro 2018-02-12 13:43:13 -05:00
hw qerror: Clean up QERR_ macros to expand into a single string 2018-02-17 15:23:09 -05:00
include Stop including qemu-common.h in memory.h 2018-02-17 15:23:16 -05:00
qapi qerror: Clean up QERR_ macros to expand into a single string 2018-02-17 15:23:09 -05:00
qobject qerror: Finally unused, clean up 2018-02-17 15:23:10 -05:00
qom qerror: Clean up QERR_ macros to expand into a single string 2018-02-17 15:23:09 -05:00
scripts Save copies of generated qapi files. 2017-01-21 00:30:50 +11:00
target-arm target-arm: Implement YIELD insn to yield in ARM and Thumb translators 2018-02-17 15:23:14 -05:00
target-i386 qerror: Clean up QERR_ macros to expand into a single string 2018-02-17 15:23:09 -05:00
target-m68k m68k: remove useless parameter op_size from gen_lea_indexed() 2018-02-17 15:23:14 -05:00
target-mips target-mips: add mips32r6-generic CPU definition 2018-02-17 15:23:13 -05:00
target-sparc target-*: Increment num_insns immediately after tcg_gen_insn_start 2018-02-11 12:46:30 -05:00
tcg cpu-defs: Move CPU_TEMP_BUF_NLONGS to tcg 2018-02-17 15:23:15 -05:00
util bitmap: add atomic test and clear 2018-02-13 10:02:12 -05:00
aarch64.h memory: Add global-locking property to memory regions 2018-02-17 15:23:16 -05:00
aarch64eb.h memory: Add global-locking property to memory regions 2018-02-17 15:23:16 -05:00
accel.c Automated leading tab to spaces conversion. 2017-01-21 12:28:22 +11:00
arm.h memory: Add global-locking property to memory regions 2018-02-17 15:23:16 -05:00
armeb.h memory: Add global-locking property to memory regions 2018-02-17 15:23:16 -05:00
CODING_STYLE import 2015-08-21 15:04:50 +08:00
configure tcg: Drop ia64 host support 2018-02-04 18:33:02 -05:00
COPYING import 2015-08-21 15:04:50 +08:00
COPYING.LIB import 2015-08-21 15:04:50 +08:00
cpu-exec.c include/exec: Move tb hash functions out 2018-02-17 15:23:15 -05:00
cpus.c cleanup more synchronization code 2017-01-09 14:05:39 +08:00
cputlb.c memory: replace cpu_physical_memory_reset_dirty() with test-and-clear 2018-02-13 11:25:45 -05:00
exec.c exec: skip MMIO regions correctly in cpu_physical_memory_write_rom_internal 2018-02-17 15:23:16 -05:00
gen_all_header.sh arm64eb: add support for ARM64 big endian. 2017-04-24 23:30:01 +08:00
glib_compat.c Merge branch 'master' into msvc2 2017-04-21 01:17:00 +08:00
HACKING import 2015-08-21 15:04:50 +08:00
header_gen.py memory: Add global-locking property to memory regions 2018-02-17 15:23:16 -05:00
ioport.c memory: Define API for MemoryRegionOps to take attrs and return status 2018-02-12 17:17:27 -05:00
LICENSE import 2015-08-21 15:04:50 +08:00
m68k.h memory: Add global-locking property to memory regions 2018-02-17 15:23:16 -05:00
Makefile cleanup qemu/default-configs/ 2017-01-19 14:52:30 +08:00
Makefile.objs cleanup qemu/Makefile.objs 2017-01-21 21:50:12 +08:00
Makefile.target tcg: Move some opcode generation functions out of line 2018-02-09 08:10:00 -05:00
memory.c memory: Add global-locking property to memory regions 2018-02-17 15:23:16 -05:00
memory_mapping.c memory_mapping: Rework cpu related includes 2018-02-17 15:23:15 -05:00
mips.h memory: Add global-locking property to memory regions 2018-02-17 15:23:16 -05:00
mips64.h memory: Add global-locking property to memory regions 2018-02-17 15:23:16 -05:00
mips64el.h memory: Add global-locking property to memory regions 2018-02-17 15:23:16 -05:00
mipsel.h memory: Add global-locking property to memory regions 2018-02-17 15:23:16 -05:00
powerpc.h memory: Add global-locking property to memory regions 2018-02-17 15:23:16 -05:00
qapi-schema.json import 2015-08-21 15:04:50 +08:00
qemu-log.c import 2015-08-21 15:04:50 +08:00
qemu-timer.c timer is redundant 2017-01-20 16:46:58 +08:00
rules.mak import 2015-08-21 15:04:50 +08:00
softmmu_template.h Add MemTxAttrs to the IOTLB 2018-02-12 18:38:38 -05:00
sparc.h memory: Add global-locking property to memory regions 2018-02-17 15:23:16 -05:00
sparc64.h memory: Add global-locking property to memory regions 2018-02-17 15:23:16 -05:00
tcg-runtime.c platform.h move #3 2017-01-21 00:13:21 +11:00
translate-all.c include/exec: Move tb hash functions out 2018-02-17 15:23:15 -05:00
translate-all.h translate-all: remove unnecessary argument to tb_invalidate_phys_range 2018-02-13 09:04:51 -05:00
unicorn_common.h This code should now build the x86_x64-softmmu part 2. 2017-01-19 22:50:28 +11:00
VERSION import 2015-08-21 15:04:50 +08:00
vl.c This code should now build the x86_x64-softmmu part 2. 2017-01-19 22:50:28 +11:00
vl.h import 2015-08-21 15:04:50 +08:00
x86_64.h memory: Add global-locking property to memory regions 2018-02-17 15:23:16 -05:00