mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
target/riscv: Replace riscv_cpu_is_32bit with riscv_cpu_mxl
Shortly, the set of supported XL will not be just 32 and 64, and representing that properly using the enumeration will be imperative. Two places, booting and gdb, intentionally use misa_mxl_max to emphasize the use of the reset value of misa.mxl, and not the current cpu state. Reviewed-by: LIU Zhiwei <zhiwei_liu@c-sky.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20211020031709.359469-5-richard.henderson@linaro.org Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
e91a7227cb
commit
db23e5d981
8 changed files with 45 additions and 34 deletions
|
@ -152,7 +152,7 @@ bool riscv_cpu_fp_enabled(CPURISCVState *env)
|
|||
|
||||
void riscv_cpu_swap_hypervisor_regs(CPURISCVState *env)
|
||||
{
|
||||
uint64_t sd = riscv_cpu_is_32bit(env) ? MSTATUS32_SD : MSTATUS64_SD;
|
||||
uint64_t sd = riscv_cpu_mxl(env) == MXL_RV32 ? MSTATUS32_SD : MSTATUS64_SD;
|
||||
uint64_t mstatus_mask = MSTATUS_MXR | MSTATUS_SUM | MSTATUS_FS |
|
||||
MSTATUS_SPP | MSTATUS_SPIE | MSTATUS_SIE |
|
||||
MSTATUS64_UXL | sd;
|
||||
|
@ -447,7 +447,7 @@ static int get_physical_address(CPURISCVState *env, hwaddr *physical,
|
|||
|
||||
if (first_stage == true) {
|
||||
if (use_background) {
|
||||
if (riscv_cpu_is_32bit(env)) {
|
||||
if (riscv_cpu_mxl(env) == MXL_RV32) {
|
||||
base = (hwaddr)get_field(env->vsatp, SATP32_PPN) << PGSHIFT;
|
||||
vm = get_field(env->vsatp, SATP32_MODE);
|
||||
} else {
|
||||
|
@ -455,7 +455,7 @@ static int get_physical_address(CPURISCVState *env, hwaddr *physical,
|
|||
vm = get_field(env->vsatp, SATP64_MODE);
|
||||
}
|
||||
} else {
|
||||
if (riscv_cpu_is_32bit(env)) {
|
||||
if (riscv_cpu_mxl(env) == MXL_RV32) {
|
||||
base = (hwaddr)get_field(env->satp, SATP32_PPN) << PGSHIFT;
|
||||
vm = get_field(env->satp, SATP32_MODE);
|
||||
} else {
|
||||
|
@ -465,7 +465,7 @@ static int get_physical_address(CPURISCVState *env, hwaddr *physical,
|
|||
}
|
||||
widened = 0;
|
||||
} else {
|
||||
if (riscv_cpu_is_32bit(env)) {
|
||||
if (riscv_cpu_mxl(env) == MXL_RV32) {
|
||||
base = (hwaddr)get_field(env->hgatp, SATP32_PPN) << PGSHIFT;
|
||||
vm = get_field(env->hgatp, SATP32_MODE);
|
||||
} else {
|
||||
|
@ -558,7 +558,7 @@ restart:
|
|||
}
|
||||
|
||||
target_ulong pte;
|
||||
if (riscv_cpu_is_32bit(env)) {
|
||||
if (riscv_cpu_mxl(env) == MXL_RV32) {
|
||||
pte = address_space_ldl(cs->as, pte_addr, attrs, &res);
|
||||
} else {
|
||||
pte = address_space_ldq(cs->as, pte_addr, attrs, &res);
|
||||
|
@ -678,7 +678,7 @@ static void raise_mmu_exception(CPURISCVState *env, target_ulong address,
|
|||
int page_fault_exceptions, vm;
|
||||
uint64_t stap_mode;
|
||||
|
||||
if (riscv_cpu_is_32bit(env)) {
|
||||
if (riscv_cpu_mxl(env) == MXL_RV32) {
|
||||
stap_mode = SATP32_MODE;
|
||||
} else {
|
||||
stap_mode = SATP64_MODE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue