target/riscv: Reuse the conversion function of priv_spec
Public the conversion function of priv_spec in cpu.h, so that tcg-cpu.c could also use it. Signed-off-by: Jim Shu <jim.shu@sifive.com> Signed-off-by: Fea.Wang <fea.wang@sifive.com> Reviewed-by: Frank Chang <frank.chang@sifive.com> Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20240606135454.119186-2-fea.wang@sifive.com> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
50a92d9b46
commit
a1a8e7768f
@ -1790,7 +1790,7 @@ static int priv_spec_from_str(const char *priv_spec_str)
|
|||||||
return priv_version;
|
return priv_version;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *priv_spec_to_str(int priv_version)
|
const char *priv_spec_to_str(int priv_version)
|
||||||
{
|
{
|
||||||
switch (priv_version) {
|
switch (priv_version) {
|
||||||
case PRIV_VERSION_1_10_0:
|
case PRIV_VERSION_1_10_0:
|
||||||
|
@ -830,4 +830,5 @@ const char *satp_mode_str(uint8_t satp_mode, bool is_32_bit);
|
|||||||
/* Implemented in th_csr.c */
|
/* Implemented in th_csr.c */
|
||||||
void th_register_custom_csrs(RISCVCPU *cpu);
|
void th_register_custom_csrs(RISCVCPU *cpu);
|
||||||
|
|
||||||
|
const char *priv_spec_to_str(int priv_version);
|
||||||
#endif /* RISCV_CPU_H */
|
#endif /* RISCV_CPU_H */
|
||||||
|
@ -76,16 +76,11 @@ static void riscv_cpu_write_misa_bit(RISCVCPU *cpu, uint32_t bit,
|
|||||||
|
|
||||||
static const char *cpu_priv_ver_to_str(int priv_ver)
|
static const char *cpu_priv_ver_to_str(int priv_ver)
|
||||||
{
|
{
|
||||||
switch (priv_ver) {
|
const char *priv_spec_str = priv_spec_to_str(priv_ver);
|
||||||
case PRIV_VERSION_1_10_0:
|
|
||||||
return "v1.10.0";
|
|
||||||
case PRIV_VERSION_1_11_0:
|
|
||||||
return "v1.11.0";
|
|
||||||
case PRIV_VERSION_1_12_0:
|
|
||||||
return "v1.12.0";
|
|
||||||
}
|
|
||||||
|
|
||||||
g_assert_not_reached();
|
g_assert(priv_spec_str);
|
||||||
|
|
||||||
|
return priv_spec_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void riscv_cpu_synchronize_from_tb(CPUState *cs,
|
static void riscv_cpu_synchronize_from_tb(CPUState *cs,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user