[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 11/22] riscv: Change type of valid_vm_1_10_[32|64] to bool
From: |
Palmer Dabbelt |
Subject: |
[PULL 11/22] riscv: Change type of valid_vm_1_10_[32|64] to bool |
Date: |
Mon, 6 Mar 2023 14:02:48 -0800 |
From: Alexandre Ghiti <alexghiti@rivosinc.com>
This array is actually used as a boolean so swap its current char type
to a boolean and at the same time, change the type of validate_vm to
bool since it returns valid_vm_1_10_[32|64].
Suggested-by: Andrew Jones <ajones@ventanamicro.com>
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Frank Chang <frank.chang@sifive.com>
Message-ID: <20230303131252.892893-3-alexghiti@rivosinc.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
---
target/riscv/csr.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/target/riscv/csr.c b/target/riscv/csr.c
index 3106f96212..d93d481bd6 100644
--- a/target/riscv/csr.c
+++ b/target/riscv/csr.c
@@ -1141,16 +1141,16 @@ static const target_ulong hip_writable_mask = MIP_VSSIP;
static const target_ulong hvip_writable_mask = MIP_VSSIP | MIP_VSTIP |
MIP_VSEIP;
static const target_ulong vsip_writable_mask = MIP_VSSIP;
-static const char valid_vm_1_10_32[16] = {
- [VM_1_10_MBARE] = 1,
- [VM_1_10_SV32] = 1
+static const bool valid_vm_1_10_32[16] = {
+ [VM_1_10_MBARE] = true,
+ [VM_1_10_SV32] = true
};
-static const char valid_vm_1_10_64[16] = {
- [VM_1_10_MBARE] = 1,
- [VM_1_10_SV39] = 1,
- [VM_1_10_SV48] = 1,
- [VM_1_10_SV57] = 1
+static const bool valid_vm_1_10_64[16] = {
+ [VM_1_10_MBARE] = true,
+ [VM_1_10_SV39] = true,
+ [VM_1_10_SV48] = true,
+ [VM_1_10_SV57] = true
};
/* Machine Information Registers */
@@ -1230,7 +1230,7 @@ static RISCVException read_mstatus(CPURISCVState *env,
int csrno,
return RISCV_EXCP_NONE;
}
-static int validate_vm(CPURISCVState *env, target_ulong vm)
+static bool validate_vm(CPURISCVState *env, target_ulong vm)
{
if (riscv_cpu_mxl(env) == MXL_RV32) {
return valid_vm_1_10_32[vm & 0xf];
@@ -2669,7 +2669,8 @@ static RISCVException read_satp(CPURISCVState *env, int
csrno,
static RISCVException write_satp(CPURISCVState *env, int csrno,
target_ulong val)
{
- target_ulong vm, mask;
+ target_ulong mask;
+ bool vm;
if (!riscv_cpu_cfg(env)->mmu) {
return RISCV_EXCP_NONE;
--
2.39.2
- [PULL 00/22] Sixth RISC-V PR for 8.0, Palmer Dabbelt, 2023/03/06
- [PULL 01/22] target/riscv: implement Zicboz extension, Palmer Dabbelt, 2023/03/06
- [PULL 03/22] target/riscv: add Zicbop cbo.prefetch{i, r, m} placeholder, Palmer Dabbelt, 2023/03/06
- [PULL 05/22] disas/riscv Fix ctzw disassemble, Palmer Dabbelt, 2023/03/06
- [PULL 02/22] target/riscv: implement Zicbom extension, Palmer Dabbelt, 2023/03/06
- [PULL 06/22] target/riscv: cpu: Implement get_arch_id callback, Palmer Dabbelt, 2023/03/06
- [PULL 04/22] hw/riscv/virt.c: add cbo[mz]-block-size fdt properties, Palmer Dabbelt, 2023/03/06
- [PULL 07/22] hw: intc: Use cpu_by_arch_id to fetch CPU state, Palmer Dabbelt, 2023/03/06
- [PULL 08/22] gitlab/opensbi: Move to docker:stable, Palmer Dabbelt, 2023/03/06
- [PULL 10/22] riscv: Pass Object to register_cpu_props instead of DeviceState, Palmer Dabbelt, 2023/03/06
- [PULL 11/22] riscv: Change type of valid_vm_1_10_[32|64] to bool,
Palmer Dabbelt <=
- [PULL 09/22] roms/opensbi: Upgrade from v1.1 to v1.2, Palmer Dabbelt, 2023/03/06
- [PULL 15/22] hw/riscv/virt: Add OEM_ID and OEM_TABLE_ID fields, Palmer Dabbelt, 2023/03/06
- [PULL 12/22] riscv: Allow user to set the satp mode, Palmer Dabbelt, 2023/03/06
- [PULL 14/22] riscv: Correctly set the device-tree entry 'mmu-type', Palmer Dabbelt, 2023/03/06
- [PULL 13/22] riscv: Introduce satp mode hw capabilities, Palmer Dabbelt, 2023/03/06
- [PULL 17/22] hw/riscv/virt: Add memmap pointer to RiscVVirtState, Palmer Dabbelt, 2023/03/06
- [PULL 18/22] hw/riscv/virt: Enable basic ACPI infrastructure, Palmer Dabbelt, 2023/03/06
- [PULL 16/22] hw/riscv/virt: Add a switch to disable ACPI, Palmer Dabbelt, 2023/03/06
- [PULL 19/22] hw/riscv/virt: virt-acpi-build.c: Add RINTC in MADT, Palmer Dabbelt, 2023/03/06
- [PULL 20/22] hw/riscv/virt: virt-acpi-build.c: Add RHCT Table, Palmer Dabbelt, 2023/03/06