On 12/7/20 7:14 PM, Philippe Mathieu-Daudé wrote: > Hi Jiaxun, > > On 12/7/20 6:02 AM, Jiaxun Yang wrote: >> Add a bootloader helper to generate simple bootloaders for kernel. >> It can help us reduce inline hex hack and also keep MIPS release 6 >> compatibility easier. > > Great idea :) > >> >> Signed-off-by: Jiaxun Yang <jiaxun.y...@flygoat.com> >> --- >> hw/mips/bootloader.c | 150 ++++++++++++++++++++++++++++++++++++++ >> hw/mips/meson.build | 2 +- >> include/hw/mips/cpudevs.h | 8 ++ >> 3 files changed, 159 insertions(+), 1 deletion(-) >> create mode 100644 hw/mips/bootloader.c ... >> +void bl_gen_writeq(uint32_t **p, uint64_t val, uint32_t addr) > > Well, addr has to be uint64_t... else you wrap KSEG1 on 64-bit.
Oops I misread addr/val. > > bl_gen_write_u64? > >> +{ >> + /* 64 Only */ > > if (!cpu_supports_isa(cpu, ISA_MIPS64)) { > g_assert_not_reached(); /* unsupported */ > } > >> + bl_gen_dli(p, 26, val); >> + bl_gen_li(p, 27, addr); >> + bl_gen_sd(p, 26, 27, 0x0); >> +}