On 4/15/22 02:40, Xiaojuan Yang wrote:
+static void ls3a5k_aui_boot(uint64_t start_addr) +{ + unsigned int ls3a5k_aui_boot_code[] = { + 0x18000064, /* pcaddi $r4, 0x3 */ + 0x28c00084, /* ld.d $r4, $r4, 0 */ + 0x4c000080, /* jirl $r0, $r4, 0 */ + start_addr, /* elf pc address */ + }; + int bios_size = sizeof(ls3a5k_aui_boot_code); + + rom_add_blob_fixed("bios", ls3a5k_aui_boot_code, bios_size, LA_BIOS_BASE);
This only works on little endian hosts. While you could fix this, it seems better to use a reset hook to cpu_set_pc() directly. E.g. hw/arm/boot.c, do_cpu_reset.
+ memory_region_init_ram(&lams->bios, NULL, "loongarch.bios", + LA_BIOS_SIZE, &error_fatal); + memory_region_set_readonly(&lams->bios, true);
This is exactly memory_region_init_rom.
+#define LA_BIOS_SIZE (4 * 1024 * 1024)
qemu/units.h has MiB. r~