mbox series

[00/17] target/avr: Increase page size

Message ID 20250323173730.3213964-1-richard.henderson@linaro.org
Headers show
Series target/avr: Increase page size | expand

Message

Richard Henderson March 23, 2025, 5:37 p.m. UTC
For single-binary, we would really like to have a common
TARGET_PAGE_BITS_MIN.  A value of 10 will suffice for armv4
and will just fit required page flags and alignment.

AVR's use of TARGET_PAGE_BITS == 8 is unfortunate, and is due to
having memory mapped i/o in the first 256 or 512 bytes and sram
starting immediately afterward -- the softmmu page table mapping
really doesn't like mixed i/o and sram on the same page.

My solution is to bias the entire AVR address space up in the
QEMU address space.  This places sram at the start of the second
QEMU page, and the i/o immediately beforehand, at the end of
the first QEMU page.

Once the bias exists, we can choose any value we like.
Use this to select a larger page size, based on the size of sram.
This minimizes the number of pages required to span flash and sram.

There are also two bugs fixed in the avr disassembler.


r~


Richard Henderson (17):
  hw/core/cpu: Use size_t for memory_rw_debug len argument
  target/avr: Fix buffer read in avr_print_insn
  target/avr: Improve decode of LDS, STS
  target/avr: Remove OFFSET_CPU_REGISTERS
  target/avr: Move cpu register accesses into system memory
  target/avr: Use cpu_stb_mmuidx_ra in helper_fullwr
  target/avr: Use do_stb in avr_cpu_do_interrupt
  target/avr: Add offset-io cpu property
  target/avr: Introduce gen_data_{load,store}_raw
  target/avr: Update cpu_sp after push and pop
  target/avr: Implement CPUState.memory_rw_debug
  target/avr: Handle offset_io in helper.c
  target/avr: Handle offset_io in avr_cpu_realizefn
  hw/avr: Set offset_io and increase page size to 1k
  hw/avr: Pass mcu_type to class_base_init via .class_data
  hw/avr: Move AtmegaMcuClass to atmega.h
  target/avr: Enable TARGET_PAGE_BITS_VARY

 hw/avr/atmega.h           |  20 +++
 include/hw/core/cpu.h     |   2 +-
 target/avr/cpu-param.h    |  13 +-
 target/avr/cpu.h          |  11 +-
 target/avr/helper.h       |   3 -
 target/sparc/cpu.h        |   2 +-
 hw/avr/arduino.c          |  31 ++++-
 hw/avr/atmega.c           |  76 ++++++-----
 target/avr/cpu.c          |  49 +++++++
 target/avr/disas.c        |  21 ++-
 target/avr/helper.c       | 263 +++++++++++++++++---------------------
 target/avr/translate.c    | 106 +++++++++------
 target/sparc/mmu_helper.c |   2 +-
 target/avr/insn.decode    |   7 +-
 14 files changed, 346 insertions(+), 260 deletions(-)