mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
hw/riscv: Split out the boot functions
Split the common RISC-V boot functions into a seperate file. This allows us to share the common code. Signed-off-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
This commit is contained in:
parent
05446f4133
commit
0ac24d56c5
7 changed files with 110 additions and 93 deletions
|
@ -36,12 +36,12 @@
|
|||
#include "hw/riscv/riscv_hart.h"
|
||||
#include "hw/riscv/sifive_clint.h"
|
||||
#include "hw/riscv/spike.h"
|
||||
#include "hw/riscv/boot.h"
|
||||
#include "chardev/char.h"
|
||||
#include "sysemu/arch_init.h"
|
||||
#include "sysemu/device_tree.h"
|
||||
#include "sysemu/qtest.h"
|
||||
#include "exec/address-spaces.h"
|
||||
#include "elf.h"
|
||||
|
||||
#include <libfdt.h>
|
||||
|
||||
|
@ -54,19 +54,6 @@ static const struct MemmapEntry {
|
|||
[SPIKE_DRAM] = { 0x80000000, 0x0 },
|
||||
};
|
||||
|
||||
static target_ulong load_kernel(const char *kernel_filename)
|
||||
{
|
||||
uint64_t kernel_entry, kernel_high;
|
||||
|
||||
if (load_elf_ram_sym(kernel_filename, NULL, NULL, NULL,
|
||||
&kernel_entry, NULL, &kernel_high, 0, EM_RISCV, 1, 0,
|
||||
NULL, true, htif_symbol_callback) < 0) {
|
||||
error_report("could not load kernel '%s'", kernel_filename);
|
||||
exit(1);
|
||||
}
|
||||
return kernel_entry;
|
||||
}
|
||||
|
||||
static void create_fdt(SpikeState *s, const struct MemmapEntry *memmap,
|
||||
uint64_t mem_size, const char *cmdline)
|
||||
{
|
||||
|
@ -199,7 +186,7 @@ static void spike_board_init(MachineState *machine)
|
|||
mask_rom);
|
||||
|
||||
if (machine->kernel_filename) {
|
||||
load_kernel(machine->kernel_filename);
|
||||
riscv_load_kernel(machine->kernel_filename);
|
||||
}
|
||||
|
||||
/* reset vector */
|
||||
|
@ -287,7 +274,7 @@ static void spike_v1_10_0_board_init(MachineState *machine)
|
|||
mask_rom);
|
||||
|
||||
if (machine->kernel_filename) {
|
||||
load_kernel(machine->kernel_filename);
|
||||
riscv_load_kernel(machine->kernel_filename);
|
||||
}
|
||||
|
||||
/* reset vector */
|
||||
|
@ -372,7 +359,7 @@ static void spike_v1_09_1_board_init(MachineState *machine)
|
|||
mask_rom);
|
||||
|
||||
if (machine->kernel_filename) {
|
||||
load_kernel(machine->kernel_filename);
|
||||
riscv_load_kernel(machine->kernel_filename);
|
||||
}
|
||||
|
||||
/* reset vector */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue