summaryrefslogtreecommitdiffstats
path: root/target/riscv/cpu.h
diff options
context:
space:
mode:
authorPeter Maydell2019-02-14 14:15:45 +0100
committerPeter Maydell2019-02-14 14:15:45 +0100
commit4856c2c70c87d7a76c8ea208e7568f5637e78840 (patch)
treeeb6f4962c9c7936730edb2f372a5a6759f7c4bee /target/riscv/cpu.h
parentMerge remote-tracking branch 'remotes/rth/tags/pull-hppa-20190212' into staging (diff)
parentriscv: Ensure the kernel start address is correctly cast (diff)
downloadqemu-4856c2c70c87d7a76c8ea208e7568f5637e78840.tar.gz
qemu-4856c2c70c87d7a76c8ea208e7568f5637e78840.tar.xz
qemu-4856c2c70c87d7a76c8ea208e7568f5637e78840.zip
Merge remote-tracking branch 'remotes/palmer/tags/riscv-for-master-4.0-sf1' into staging
RISC-V Patches for the 4.0 Soft Freeze, Part 1 This patch set contains a handful of patches I've collected over the last few weeks. There's nothing really fundamental, but I thought it would be good to send these out now as there are some other patch sets on the mailing list that are getting ready to go. As far as the actual patches, there's: * A set that cleans up our FS dirty-mode handling. * Support for writing MISA. * The removal of Michael as a maintainer. * A fix to {m,s}counteren handling. * A fix to make sure the kernel's start address is computed correctly on 32-bit targets. This makes my "RISC-V Patches for 3.2, Part 3" pull request defunct, as it contains the same patches but based on a newer master. As usual, I've tested this using a Fedora boot on the latest Linux. This patch set does not include Bastian's decodetree patches because there were some merge conflicts and while I've cleaned them up I want to get a round of review first. # gpg: Signature made Wed 13 Feb 2019 15:37:50 GMT # gpg: using RSA key 00CE76D1834960DFCE886DF8EF4CA1502CCBAB41 # gpg: issuer "palmer@dabbelt.com" # gpg: Good signature from "Palmer Dabbelt <palmer@dabbelt.com>" [unknown] # gpg: aka "Palmer Dabbelt <palmer@sifive.com>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 00CE 76D1 8349 60DF CE88 6DF8 EF4C A150 2CCB AB41 * remotes/palmer/tags/riscv-for-master-4.0-sf1: riscv: Ensure the kernel start address is correctly cast target/riscv: fix counter-enable checks in ctr() MAINTAINERS: Remove Michael Clark as a RISC-V Maintainer RISC-V: Add misa runtime write support RISC-V: Add misa.MAFD checks to translate RISC-V: Add misa to DisasContext RISC-V: Add priv_ver to DisasContext RISC-V: Use riscv prefix consistently on cpu helpers RISC-V: Implement mstatus.TSR/TW/TVM RISC-V: Mark mstatus.fs dirty RISC-V: Split out mstatus_fs from tb_flags Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'target/riscv/cpu.h')
-rw-r--r--target/riscv/cpu.h31
1 files changed, 16 insertions, 15 deletions
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index 743f02c8b9..5c2aebf132 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -86,7 +86,8 @@
so a cpu features bitfield is required, likewise for optional PMP support */
enum {
RISCV_FEATURE_MMU,
- RISCV_FEATURE_PMP
+ RISCV_FEATURE_PMP,
+ RISCV_FEATURE_MISA
};
#define USER_VERSION_2_02_0 0x00020200
@@ -118,6 +119,7 @@ struct CPURISCVState {
target_ulong user_ver;
target_ulong priv_ver;
target_ulong misa;
+ target_ulong misa_mask;
uint32_t features;
@@ -256,7 +258,7 @@ int riscv_cpu_handle_mmu_fault(CPUState *cpu, vaddr address, int size,
char *riscv_isa_string(RISCVCPU *cpu);
void riscv_cpu_list(FILE *f, fprintf_function cpu_fprintf);
-#define cpu_signal_handler cpu_riscv_signal_handler
+#define cpu_signal_handler riscv_cpu_signal_handler
#define cpu_list riscv_cpu_list
#define cpu_mmu_index riscv_cpu_mmu_index
@@ -264,19 +266,18 @@ void riscv_cpu_list(FILE *f, fprintf_function cpu_fprintf);
uint32_t riscv_cpu_update_mip(RISCVCPU *cpu, uint32_t mask, uint32_t value);
#define BOOL_TO_MASK(x) (-!!(x)) /* helper for riscv_cpu_update_mip value */
#endif
-void riscv_set_mode(CPURISCVState *env, target_ulong newpriv);
+void riscv_cpu_set_mode(CPURISCVState *env, target_ulong newpriv);
void riscv_translate_init(void);
-RISCVCPU *cpu_riscv_init(const char *cpu_model);
-int cpu_riscv_signal_handler(int host_signum, void *pinfo, void *puc);
-void QEMU_NORETURN do_raise_exception_err(CPURISCVState *env,
- uint32_t exception, uintptr_t pc);
+int riscv_cpu_signal_handler(int host_signum, void *pinfo, void *puc);
+void QEMU_NORETURN riscv_raise_exception(CPURISCVState *env,
+ uint32_t exception, uintptr_t pc);
-target_ulong cpu_riscv_get_fflags(CPURISCVState *env);
-void cpu_riscv_set_fflags(CPURISCVState *env, target_ulong);
+target_ulong riscv_cpu_get_fflags(CPURISCVState *env);
+void riscv_cpu_set_fflags(CPURISCVState *env, target_ulong);
-#define TB_FLAGS_MMU_MASK 3
-#define TB_FLAGS_FP_ENABLE MSTATUS_FS
+#define TB_FLAGS_MMU_MASK 3
+#define TB_FLAGS_MSTATUS_FS MSTATUS_FS
static inline void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc,
target_ulong *cs_base, uint32_t *flags)
@@ -284,7 +285,7 @@ static inline void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc,
*pc = env->pc;
*cs_base = 0;
#ifdef CONFIG_USER_ONLY
- *flags = TB_FLAGS_FP_ENABLE;
+ *flags = TB_FLAGS_MSTATUS_FS;
#else
*flags = cpu_mmu_index(env, 0) | (env->mstatus & MSTATUS_FS);
#endif
@@ -293,13 +294,13 @@ static inline void cpu_get_tb_cpu_state(CPURISCVState *env, target_ulong *pc,
int riscv_csrrw(CPURISCVState *env, int csrno, target_ulong *ret_value,
target_ulong new_value, target_ulong write_mask);
-static inline void csr_write_helper(CPURISCVState *env, target_ulong val,
- int csrno)
+static inline void riscv_csr_write(CPURISCVState *env, int csrno,
+ target_ulong val)
{
riscv_csrrw(env, csrno, NULL, val, MAKE_64BIT_MASK(0, TARGET_LONG_BITS));
}
-static inline target_ulong csr_read_helper(CPURISCVState *env, int csrno)
+static inline target_ulong riscv_csr_read(CPURISCVState *env, int csrno)
{
target_ulong val = 0;
riscv_csrrw(env, csrno, &val, 0, 0);