|
From: | Richard Henderson |
Subject: | Re: [PATCH v1 40/43] hw/loongarch: Add LoongArch boot code and load elf function. |
Date: | Mon, 18 Apr 2022 08:11:24 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 |
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~
[Prev in Thread] | Current Thread | [Next in Thread] |