From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: alex.bennee@linaro.org, pbonzini@redhat.com,
mark.cave-ayland@ilande.co.uk, f4bug@amsat.org
Subject: [PATCH 01/15] NOTFORMERGE q800: test case for do_unaligned_access issue
Date: Sat, 19 Jun 2021 10:26:12 -0700 [thread overview]
Message-ID: <20210619172626.875885-2-richard.henderson@linaro.org> (raw)
In-Reply-To: <20210619172626.875885-1-richard.henderson@linaro.org>
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
A hack so that the built-in rom for -M a800 triggers the
problem within the first two instructions.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/m68k/q800.c | 131 ++++---------------------------------------------
1 file changed, 9 insertions(+), 122 deletions(-)
diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c
index 11376daa85..9795ceb06a 100644
--- a/hw/m68k/q800.c
+++ b/hw/m68k/q800.c
@@ -174,26 +174,13 @@ static void main_cpu_reset(void *opaque)
CPUState *cs = CPU(cpu);
cpu_reset(cs);
- cpu->env.aregs[7] = ldl_phys(cs->as, 0);
- cpu->env.pc = ldl_phys(cs->as, 4);
+ cpu->env.aregs[7] = 0x1000;
+ cpu->env.pc = MACROM_ADDR;
}
static uint8_t fake_mac_rom[] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
- /* offset: 0xa - mac_reset */
-
- /* via2[vDirB] |= VIA2B_vPower */
- 0x20, 0x7C, 0x50, 0xF0, 0x24, 0x00, /* moveal VIA2_BASE+vDirB,%a0 */
- 0x10, 0x10, /* moveb %a0@,%d0 */
- 0x00, 0x00, 0x00, 0x04, /* orib #4,%d0 */
- 0x10, 0x80, /* moveb %d0,%a0@ */
-
- /* via2[vBufB] &= ~VIA2B_vPower */
- 0x20, 0x7C, 0x50, 0xF0, 0x20, 0x00, /* moveal VIA2_BASE+vBufB,%a0 */
- 0x10, 0x10, /* moveb %a0@,%d0 */
- 0x02, 0x00, 0xFF, 0xFB, /* andib #-5,%d0 */
- 0x10, 0x80, /* moveb %d0,%a0@ */
+ 0x41, 0xf9, 0x50, 0x00, 0x00, 0x00, /* lea 0x50000000,%a0 */
+ 0x30, 0x28, 0x11, 0xff, /* movew %a0@(4607),%d0 */
/* while (true) ; */
0x60, 0xFE /* bras [self] */
@@ -202,24 +189,11 @@ static uint8_t fake_mac_rom[] = {
static void q800_init(MachineState *machine)
{
M68kCPU *cpu = NULL;
- int linux_boot;
- int32_t kernel_size;
- uint64_t elf_entry;
- char *filename;
- int bios_size;
- ram_addr_t initrd_base;
- int32_t initrd_size;
MemoryRegion *rom;
MemoryRegion *io;
const int io_slice_nb = (IO_SIZE / IO_SLICE) - 1;
int i;
ram_addr_t ram_size = machine->ram_size;
- const char *kernel_filename = machine->kernel_filename;
- const char *initrd_filename = machine->initrd_filename;
- const char *kernel_cmdline = machine->kernel_cmdline;
- const char *bios_name = machine->firmware ?: MACROM_FILENAME;
- hwaddr parameters_base;
- CPUState *cs;
DeviceState *dev;
DeviceState *via_dev;
DeviceState *escc_orgate;
@@ -231,8 +205,6 @@ static void q800_init(MachineState *machine)
DeviceState *glue;
DriveInfo *dinfo;
- linux_boot = (kernel_filename != NULL);
-
if (ram_size > 1 * GiB) {
error_report("Too much memory for this machine: %" PRId64 " MiB, "
"maximum 1024 MiB", ram_size / MiB);
@@ -392,96 +364,11 @@ static void q800_init(MachineState *machine)
qdev_prop_set_uint8(dev, "depth", graphic_depth);
qdev_realize_and_unref(dev, BUS(nubus), &error_fatal);
- cs = CPU(cpu);
- if (linux_boot) {
- uint64_t high;
- kernel_size = load_elf(kernel_filename, NULL, NULL, NULL,
- &elf_entry, NULL, &high, NULL, 1,
- EM_68K, 0, 0);
- if (kernel_size < 0) {
- error_report("could not load kernel '%s'", kernel_filename);
- exit(1);
- }
- stl_phys(cs->as, 4, elf_entry); /* reset initial PC */
- parameters_base = (high + 1) & ~1;
-
- BOOTINFO1(cs->as, parameters_base, BI_MACHTYPE, MACH_MAC);
- BOOTINFO1(cs->as, parameters_base, BI_FPUTYPE, FPU_68040);
- BOOTINFO1(cs->as, parameters_base, BI_MMUTYPE, MMU_68040);
- BOOTINFO1(cs->as, parameters_base, BI_CPUTYPE, CPU_68040);
- BOOTINFO1(cs->as, parameters_base, BI_MAC_CPUID, CPUB_68040);
- BOOTINFO1(cs->as, parameters_base, BI_MAC_MODEL, MAC_MODEL_Q800);
- BOOTINFO1(cs->as, parameters_base,
- BI_MAC_MEMSIZE, ram_size >> 20); /* in MB */
- BOOTINFO2(cs->as, parameters_base, BI_MEMCHUNK, 0, ram_size);
- BOOTINFO1(cs->as, parameters_base, BI_MAC_VADDR, VIDEO_BASE);
- BOOTINFO1(cs->as, parameters_base, BI_MAC_VDEPTH, graphic_depth);
- BOOTINFO1(cs->as, parameters_base, BI_MAC_VDIM,
- (graphic_height << 16) | graphic_width);
- BOOTINFO1(cs->as, parameters_base, BI_MAC_VROW,
- (graphic_width * graphic_depth + 7) / 8);
- BOOTINFO1(cs->as, parameters_base, BI_MAC_SCCBASE, SCC_BASE);
-
- rom = g_malloc(sizeof(*rom));
- memory_region_init_ram_ptr(rom, NULL, "m68k_fake_mac.rom",
- sizeof(fake_mac_rom), fake_mac_rom);
- memory_region_set_readonly(rom, true);
- memory_region_add_subregion(get_system_memory(), MACROM_ADDR, rom);
-
- if (kernel_cmdline) {
- BOOTINFOSTR(cs->as, parameters_base, BI_COMMAND_LINE,
- kernel_cmdline);
- }
-
- /* load initrd */
- if (initrd_filename) {
- initrd_size = get_image_size(initrd_filename);
- if (initrd_size < 0) {
- error_report("could not load initial ram disk '%s'",
- initrd_filename);
- exit(1);
- }
-
- initrd_base = (ram_size - initrd_size) & TARGET_PAGE_MASK;
- load_image_targphys(initrd_filename, initrd_base,
- ram_size - initrd_base);
- BOOTINFO2(cs->as, parameters_base, BI_RAMDISK, initrd_base,
- initrd_size);
- } else {
- initrd_base = 0;
- initrd_size = 0;
- }
- BOOTINFO0(cs->as, parameters_base, BI_LAST);
- } else {
- uint8_t *ptr;
- /* allocate and load BIOS */
- rom = g_malloc(sizeof(*rom));
- memory_region_init_rom(rom, NULL, "m68k_mac.rom", MACROM_SIZE,
- &error_abort);
- filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
- memory_region_add_subregion(get_system_memory(), MACROM_ADDR, rom);
-
- /* Load MacROM binary */
- if (filename) {
- bios_size = load_image_targphys(filename, MACROM_ADDR, MACROM_SIZE);
- g_free(filename);
- } else {
- bios_size = -1;
- }
-
- /* Remove qtest_enabled() check once firmware files are in the tree */
- if (!qtest_enabled()) {
- if (bios_size < 0 || bios_size > MACROM_SIZE) {
- error_report("could not load MacROM '%s'", bios_name);
- exit(1);
- }
-
- ptr = rom_ptr(MACROM_ADDR, MACROM_SIZE);
- stl_phys(cs->as, 0, ldl_p(ptr)); /* reset initial SP */
- stl_phys(cs->as, 4,
- MACROM_ADDR + ldl_p(ptr + 4)); /* reset initial PC */
- }
- }
+ rom = g_malloc(sizeof(*rom));
+ memory_region_init_ram_ptr(rom, NULL, "m68k_fake_mac.rom",
+ sizeof(fake_mac_rom), fake_mac_rom);
+ memory_region_set_readonly(rom, true);
+ memory_region_add_subregion(get_system_memory(), MACROM_ADDR, rom);
}
static void q800_machine_class_init(ObjectClass *oc, void *data)
--
2.25.1
next prev parent reply other threads:[~2021-06-19 17:28 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-19 17:26 [PATCH 00/15] accel/tcg: Fix for #360 and other i/o alignment issues Richard Henderson
2021-06-19 17:26 ` Richard Henderson [this message]
2021-06-19 17:26 ` [PATCH 02/15] accel/tcg: Extract load_helper_unaligned from load_helper Richard Henderson
2021-06-19 17:26 ` [PATCH 03/15] accel/tcg: Use byte ops for unaligned loads Richard Henderson
2021-06-19 17:26 ` [PATCH 04/15] accel/tcg: Don't test for watchpoints for code read Richard Henderson
2021-06-21 18:29 ` Philippe Mathieu-Daudé
2021-06-19 17:26 ` [PATCH 05/15] accel/tcg: Handle page span access before i/o access Richard Henderson
2021-06-19 17:26 ` [PATCH 06/15] softmmu/memory: Inline memory_region_dispatch_read1 Richard Henderson
2021-06-21 18:25 ` Philippe Mathieu-Daudé
2021-06-19 17:26 ` [PATCH 07/15] softmmu/memory: Simplify access_with_adjusted_size interface Richard Henderson
2021-06-21 18:27 ` Philippe Mathieu-Daudé
2021-06-19 17:26 ` [PATCH 08/15] hw/net/e1000e: Fix size of io operations Richard Henderson
2021-06-19 17:26 ` [PATCH 09/15] hw/net/e1000e: Fix impl.min_access_size Richard Henderson
2021-06-21 7:20 ` Jason Wang
2021-06-19 17:26 ` [PATCH 10/15] hw/pci-host/q35: Improve blackhole_ops Richard Henderson
2021-06-21 18:31 ` Philippe Mathieu-Daudé
2021-06-19 17:26 ` [PATCH 11/15] hw/scsi/megasas: Fix megasas_mmio_ops sizes Richard Henderson
2021-06-19 17:26 ` [PATCH 12/15] hw/scsi/megasas: Improve megasas_queue_ops min_access_size Richard Henderson
2021-06-19 17:26 ` [PATCH 13/15] softmmu/memory: Disallow short writes Richard Henderson
2021-06-19 17:26 ` [PATCH 14/15] softmmu/memory: Support some unaligned access Richard Henderson
2021-06-19 17:26 ` [PATCH 15/15] RFC accel/tcg: Defer some unaligned accesses to memory subsystem Richard Henderson
2021-06-20 13:08 ` [PATCH 00/15] accel/tcg: Fix for #360 and other i/o alignment issues Mark Cave-Ayland
2021-06-20 14:33 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210619172626.875885-2-richard.henderson@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alex.bennee@linaro.org \
--cc=f4bug@amsat.org \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).