hw/riscv: Add a riscv_is_32_bit() function

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Palmer Dabbelt <palmerdabbelt@google.com>
Reviewed-by: Bin Meng <bin.meng@windriver.com>
Tested-by: Bin Meng <bin.meng@windriver.com>
Message-id: 4c6a85dfb6dd470aa79356ebc1b02f479c2758e0.1602634524.git.alistair.francis@wdc.com
This commit is contained in:
Alistair Francis 2020-10-13 17:17:30 -07:00
parent e66c531e13
commit c407784291
2 changed files with 11 additions and 0 deletions

View File

@ -40,6 +40,15 @@
#define fw_dynamic_info_data(__val) cpu_to_le64(__val) #define fw_dynamic_info_data(__val) cpu_to_le64(__val)
#endif #endif
bool riscv_is_32_bit(MachineState *machine)
{
if (!strncmp(machine->cpu_type, "rv32", 4)) {
return true;
} else {
return false;
}
}
target_ulong riscv_find_and_load_firmware(MachineState *machine, target_ulong riscv_find_and_load_firmware(MachineState *machine,
const char *default_machine_firmware, const char *default_machine_firmware,
hwaddr firmware_load_addr, hwaddr firmware_load_addr,

View File

@ -23,6 +23,8 @@
#include "exec/cpu-defs.h" #include "exec/cpu-defs.h"
#include "hw/loader.h" #include "hw/loader.h"
bool riscv_is_32_bit(MachineState *machine);
target_ulong riscv_find_and_load_firmware(MachineState *machine, target_ulong riscv_find_and_load_firmware(MachineState *machine,
const char *default_machine_firmware, const char *default_machine_firmware,
hwaddr firmware_load_addr, hwaddr firmware_load_addr,